-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
GPU array scalar indexing edge cases #48
Comments
Please include the error messages for both failures. Do they fail on CPU too? |
This is only a problem on GPU because of scalar indexing. On current main it should give
Resolving this method ambiguity is easy of course, but it's not clear what the alternative would be. In my opinion it wasn't really a good idea for this package to start down the road of supporting |
FWIW, this is the historical context that led to using the wrapper: FluxML/Flux.jl#1459 (comment). One continuing tension with this package is that the code paths needed for a memory-efficient type can be in conflict for the ones needed for GPU support. Generally the idea was to have people use this outside of AD/GPU (i.e. during preprocessing and data loading) and materialize before using AD/GPU. Which is not to say the status quo is ideal, but it sheds some light on why GPU support hasn't been the No. 1 priority historically. |
I think the |
I think there is a bigger issue here of what exactly do you do in the edge cases that this package allows where you would seem to have to scalar index a GPU array. However there is redundancy between this issue and #28, feel free to close if you don't think it's doing anything. |
Isn't this just how arrays work? E.g. one role of When it wraps a GPU array, the first is no harder, but almost none of the AbstractMatrix fallbacks will work. You get scalar indexing and then you either fix it (supply a routine) or avoid it. Having no supertype would perhaps give more obvious error message, like "MethodError: no method matching reverse(A::Transpose{Float64, JLArray{Float64, 2}})". |
This issue came up during #47.
There are some rather awkward cases where it is not clear how to elide scalar indexing into GPU arrays. For example
Both sides of this test are currently broken. The failure currently in main is a method ambiguity, however it's not entirely clear how to fix this as there don't seem to be easy answers about what to do in this case. I doubt it is possible to cover every conceivable such edge case, at some point users should have to materialize the array.
I think probably what needs to be done here is to add documentation and possibly convenience methods describing circumstances in which arrays should be materialized. Even though there's no clear answer to this I'm opening this issue because as of now the handling of this is extremely wonky, and any users not intimately familiar with Julia array packages will be justifiably confused.
The text was updated successfully, but these errors were encountered: