Skip to content

Missing @atomicswap implementation for CUDA #49

@Keluaa

Description

@Keluaa

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions