-
Notifications
You must be signed in to change notification settings - Fork 2
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
Instruction selection error from loads and stores on CUDA #33
Comments
I am trying to create a minimal example for EnzymeAD/Enzyme.jl#511 but am struggling to get Atomix to work on the GPU. The error I get for the above examples is different to that shown. For example: using Atomix, CUDA
function load(xs)
Atomix.@atomic xs[1]
nothing
end
@cuda load(CUDA.zeros(1))
I also get a similar error with the suggestion at the top: function load2(xs)
x = Atomix.@atomic xs[1] += 0
nothing
end
@cuda load2(CUDA.zeros(1)) If I try the following I get a different error: function load3(xs)
if threadIdx().x == 1
Atomix.@atomic xs[1]
end
nothing
end
@cuda load3(CUDA.zeros(1))
I am on Julia 1.8.2, Atomix 0.1.0 and CUDA 3.12.1. System info:
|
So to get the actual LLVM error
Then you get:
One way around this would be JuliaGPU/CUDA.jl#1644 |
Is that expected to work currently? I get the same error when using that branch. |
No not yet fully, and I haven't done the work to integrate it with Atomix. |
This works though:
|
Works for me, I'll see how this plays with Enzyme gradients. |
But the atomic decrement is still wrong
|
But ...
|
(This is not really an Atomix issue but it's not clear where to track this.)
Currently, LLVM does not seem to select atomic store and load on CUDA (see Examples below). Until it is fixed in LLVM, as a short-term solution, it may be nice to use
@device_override
in CUDA.jl to emit appropriate device-specific instructions throughLLVM.Interop.atomic_pointer*
APIs.Ref:
JuliaGPU/CUDA.jl#1353
JuliaGPU/CUDA.jl#1393
Workaround
If you really need to establish some atomic ordering semantics, sometimes it can be done by using some stronger operations such as:
Examples
The text was updated successfully, but these errors were encountered: