Skip to content

Commit

Permalink
remove unbound type parameters (JuliaGPU#1585)
Browse files Browse the repository at this point in the history
Unbound type parameters often cause performance issues and run time
dispatch.

Issue found using JuliaLang/julia#46608
  • Loading branch information
nsajko authored and simonbyrne committed Nov 13, 2023
1 parent e67c21a commit 5495b95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/cudadrv/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ being slightly faster.
cudacall

# FIXME: can we make this infer properly?
cudacall(f, types::Tuple, args...; kwargs...) where {N} =
cudacall(f, types::Tuple, args...; kwargs...) =
cudacall(f, Base.to_tuple_type(types), args...; kwargs...)

function cudacall(f, types::Type, args...; kwargs...)
Expand Down
4 changes: 2 additions & 2 deletions lib/cudadrv/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ trim(pool::CuMemoryPool, bytes_to_keep::Integer=0) = cuMemPoolTrimTo(pool, bytes
Returns attribute `attr` about `pool`. The type of the returned value depends on the
attribute, and as such must be passed as the `X` parameter.
"""
function attribute(X::Type, pool::CuMemoryPool, attr::CUmemPool_attribute) where {T}
function attribute(X::Type, pool::CuMemoryPool, attr::CUmemPool_attribute)
value = Ref{X}()
cuMemPoolGetAttribute(pool, attr, value)
return value[]
Expand All @@ -87,7 +87,7 @@ end
Sets attribute` attr` on a pointer `ptr` to `val`.
"""
function attribute!(pool::CuMemoryPool, attr::CUmemPool_attribute, value) where {T}
function attribute!(pool::CuMemoryPool, attr::CUmemPool_attribute, value)
cuMemPoolSetAttribute(pool, attr, Ref(value))
return
end
Expand Down
2 changes: 1 addition & 1 deletion src/sorting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ of values and an index array for doing `sortperm!`. Cannot provide a stable
`sort!` although `sortperm!` is properly stable. To reverse, set `rev=true`
rather than `lt=!isless` (otherwise stability of sortperm breaks down).
"""
function bitonic_sort!(c; by = identity, lt = isless, rev = false) where {T}
function bitonic_sort!(c; by = identity, lt = isless, rev = false)
c_len = if typeof(c) <: Tuple
length(c[1])
else
Expand Down

0 comments on commit 5495b95

Please sign in to comment.