Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-Int64 indices in scatter #543

Merged
merged 4 commits into from
Oct 4, 2023
Merged

Allow non-Int64 indices in scatter #543

merged 4 commits into from
Oct 4, 2023

Conversation

pxl-th
Copy link
Member

@pxl-th pxl-th commented Oct 2, 2023

  • Allow non-Int64 indices in scatter by promoting them to Int64 inside the kernel.
    This is especially useful when performing reduction over big arrays into a few bins.
    Indices can be of Int8 type, saving a lot of space.
  • Fix typo in Test_Enzyme. I guess the intention was to disallow any Julia 1.10 version.
julia> v"1.10.0-beta2" <= v"1.10"
true

julia> v"1.10.0-beta2" <= v"1.10-"
false

PR Checklist

  • Tests are added
  • Documentation, if applicable

@pxl-th pxl-th changed the title Fix typo in version comparison Allow non-Int64 indices in scatter Oct 2, 2023
src/scatter.jl Outdated
Comment on lines 132 to 134
@inline _atomix_convert_i64(x::Int64) = x
@inline _atomix_convert_i64(x::Integer) = Int(x)
@inline _atomix_convert_i64(x) = x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the _atomix_ here mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I just wanted to "signal" that it is related to Atomix.IndexableRef initially. Renamed to _convert_i64.

Copy link
Member Author

@pxl-th pxl-th Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I forgot to mention that casting to Int is only needed for atomics, where we take Atomix.pointer(::Atomix.IndexableRef) which works only with Int type.

Copy link
Member

@ToucheSir ToucheSir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, merge when ready

@pxl-th pxl-th merged commit 607de4b into master Oct 4, 2023
10 of 12 checks passed
@pxl-th pxl-th deleted the pxl-th/fix-typo branch October 4, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants