Skip to content

Commit 7f38439

Browse files
committed
Remove some ambiguities.
1 parent 6a0d60f commit 7f38439

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

lib/cudadrv/state.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ function Base.get(x::PerDevice, dev::CuDevice, val)
470470
end
471471
end
472472

473-
function Base.get!(constructor::F, x::PerDevice{T}, dev::CuDevice) where {F, T}
473+
function Base.get!(constructor::F, x::PerDevice{T}, dev::CuDevice) where {F <: Base.Callable, T}
474474
y = get_values(x)
475475
id = deviceid(dev)+1
476476
ctx = device_context(id) # may be nothing

lib/cudadrv/synchronization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Base.put!(c::BidirectionalChannel{T}, v::T) where T
4343
end
4444
end
4545

46-
function Base.take!(f, c::BidirectionalChannel{T}) where T
46+
function Base.take!(f::Base.Callable, c::BidirectionalChannel{T}) where T
4747
lock(c)
4848
try
4949
# notify the producer that we're ready to accept a value

lib/utils/threading.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ end
2323
LazyInitialized{T}(validator=nothing) where {T} =
2424
LazyInitialized{T,typeof(validator)}(Threads.Atomic{Int}(0), Ref{T}(), validator)
2525

26-
@inline function Base.get!(constructor, x::LazyInitialized)
26+
@inline function Base.get!(constructor::Base.Callable, x::LazyInitialized)
2727
while x.guard[] != 2
2828
initialize!(x, constructor)
2929
end

src/device/texture.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,15 @@ end
5656
Base.Tuple(x::Vec4) = tuple(x.a, x.b, x.c, x.d)
5757

5858
for (dispatch_rettyp, julia_rettyp, llvm_rettyp) in
59-
((:Signed, :(Vec4{UInt32}), :v4u32),
60-
(:Unsigned, :(Vec4{Int32}), :v4s32),
59+
((:Signed, :(Vec4{Int32}), :v4u32),
60+
(:Unsigned, :(Vec4{UInt32}), :v4s32),
6161
(:AbstractFloat, :(Vec4{Float32}), :v4f32))
6262

63-
eltyp = :(Union{$dispatch_rettyp, NTuple{<:Any,$dispatch_rettyp}})
63+
eltyp = :(Union{$dispatch_rettyp,
64+
NTuple{1,$dispatch_rettyp},
65+
NTuple{2,$dispatch_rettyp},
66+
NTuple{3,$dispatch_rettyp},
67+
NTuple{4,$dispatch_rettyp}})
6468

6569
# tex1D only supports array memory
6670
@eval tex(texObject::CuDeviceTexture{<:$eltyp,1,ArrayMemory}, x::Number) =
@@ -74,7 +78,7 @@ for (dispatch_rettyp, julia_rettyp, llvm_rettyp) in
7478
julia_sig = ntuple(_->Float32, dims)
7579
julia_params = ntuple(i->:($(julia_args[i])::Number), dims)
7680

77-
@eval tex(texObject::CuDeviceTexture{<:$eltyp,$dims,}, $(julia_params...)) =
81+
@eval tex(texObject::CuDeviceTexture{<:$eltyp,$dims}, $(julia_params...)) =
7882
Tuple(ccall($("llvm.nvvm.tex.unified.$llvm_dim.$llvm_rettyp.f32"), llvmcall,
7983
$julia_rettyp, (CUtexObject, $(julia_sig...)), texObject, $(julia_args...)))
8084
end

test/base/aqua.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let ambs = Aqua.detect_ambiguities(CUDA; recursive=true)
99
pkg_match(pkgname, pkgdir::Nothing) = false
1010
pkg_match(pkgname, pkgdir::AbstractString) = occursin(pkgname, pkgdir)
1111
filter!(x -> pkg_match("CUDA", pkgdir(last(x).module)), ambs)
12-
@test length(ambs) 51
12+
@test length(ambs) 18
1313
end
1414

1515
Aqua.test_undefined_exports(CUDA)

0 commit comments

Comments
 (0)