Skip to content

Commit

Permalink
delta function for CI was previously type-unstable, so inline had to …
Browse files Browse the repository at this point in the history
…be used for GPU executions, otherwise the code could not compile.

This fix makes delta type stable and there is no need to inline the function.
No noticeable performance change.
  • Loading branch information
b-fg committed May 2, 2023
1 parent 31114ad commit 614a545
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ GPUArray = Union{CuArray,ROCArray}
Return a CartesianIndex of dimension `N` which is one at index `i` and zero elsewhere.
"""
@inline δ(i,N::Int) = CI(ntuple(j -> j==i ? 1 : 0, N))
@inline δ(i,I::CartesianIndex{N}) where {N} = δ(i,N)
δ(i,::Val{N}) where N = CI(ntuple(j -> j==i ? 1 : 0, N))
δ(i,I::CartesianIndex{N}) where N = δ(i, Val{N}())

"""
inside(a)
Expand Down

0 comments on commit 614a545

Please sign in to comment.