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

allowscalar do block functionality missing? #715

Closed
leios opened this issue Jan 8, 2025 · 1 comment · Fixed by #716
Closed

allowscalar do block functionality missing? #715

leios opened this issue Jan 8, 2025 · 1 comment · Fixed by #716

Comments

@leios
Copy link

leios commented Jan 8, 2025

Note on scalar indexing with AMDGPU:

julia> CUDA.allowscalar() do
           a[1]
       end
0.0f0

Works in CUDA

julia> AMDGPU.allowscalar() do
           b[1]
       end
ERROR: MethodError: no method matching allowscalar(::var"#5#6")

Closest candidates are:
  allowscalar(::Bool)
   @ AMDGPU ~/.julia/packages/AMDGPU/Debbg/src/AMDGPU.jl:128

Stacktrace:
 [1] top-level scope
   @ REPL[13]:1

Does not work on AMD.

The @allowscalar macro and allowscalar(true) work as intended

The warnings suggest that AMDGPU.allowscalar() do ... end should work:

┌ Warning: It's not recommended to use allowscalar([true]) to allow scalar indexing.
│ Instead, use `allowscalar() do end` or `@allowscalar` to denote exactly which operations can use scalar operations.
└ @ GPUArraysCore ~/.julia/packages/GPUArraysCore/GMsgk/src/GPUArraysCore.jl:188
@leios leios changed the title allowscalar do block functionality missing? allowscalar do block functionality missing? Jan 8, 2025
@vchuravy
Copy link
Member

vchuravy commented Jan 8, 2025

AMDGPU should just import GPUArraysCore: allowscalar instead of

allowscalar(x::Bool) = GPUArrays.allowscalar(x)

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 a pull request may close this issue.

2 participants