Skip to content

Commit 3c1e3ee

Browse files
committed
Extend supports_atomics to include type
1 parent 110d784 commit 3c1e3ee

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/KernelAbstractions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,15 +553,15 @@ function ones(backend::Backend, ::Type{T}, dims::Tuple) where {T}
553553
end
554554

555555
"""
556-
supports_atomics(::Backend)::Bool
556+
supports_atomics(::Backend, [T::Type{<:Number}])::Bool
557557
558-
Returns whether `@atomic` operations are supported by the backend.
558+
Returns whether `@atomic` operations of type `T` are supported by the backend.
559559
560560
!!! note
561561
Backend implementations **must** implement this function,
562562
only if they **do not** support atomic operations with Atomix.
563563
"""
564-
supports_atomics(::Backend) = true
564+
supports_atomics(::Backend, T::Type{<:Number}=Number) = true
565565

566566
"""
567567
supports_float64(::Backend)::Bool

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ struct NewBackend <: KernelAbstractions.GPU end
2424
@test_throws MethodError KernelAbstractions.ones(backend, Float32, 1)
2525

2626
@test KernelAbstractions.supports_atomics(backend) == true
27+
@test KernelAbstractions.supports_atomics(backend, Float64) == true
28+
@test KernelAbstractions.supports_atomics(backend, Int32) == true
29+
2730
@test KernelAbstractions.supports_float64(backend) == true
2831

2932
@test KernelAbstractions.priority!(backend, :high) === nothing

0 commit comments

Comments
 (0)