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

Missing @atomicswap implementation for CUDA #49

Open
Keluaa opened this issue Dec 18, 2024 · 0 comments
Open

Missing @atomicswap implementation for CUDA #49

Keluaa opened this issue Dec 18, 2024 · 0 comments

Comments

@Keluaa
Copy link

Keluaa commented Dec 18, 2024

For example CUDA.atomic_xchg! exists yet it isn't called by Atomic.modify!.
Changing this function by adding two lines does the trick:

@inline function Atomix.modify!(ref::CuIndexableRef, op::OP, x, order) where {OP}
    # ...
    elseif op === Atomix.right
        CUDA.atomic_xchg!(ptr, x)
    # ...
end

I do not know if this is supported by the other GPU backends.

There is also the case of Atomix.get! and Atomix.set! which aren't supported. There is no direct equivalent in CUDA, but doing a CUDA.atomic_add!(x, 0) works like a load and CUDA.atomic_xchg!(x, y) works as a store. Would it be better to use those until there is a nicer solution?

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

No branches or pull requests

1 participant