From 614a545e903e9ceac3ca2cea6206d54d7cb75f40 Mon Sep 17 00:00:00 2001 From: Bernat Font Date: Tue, 2 May 2023 13:48:17 +0200 Subject: [PATCH] delta function for CI was previously type-unstable, so inline had to 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. --- src/util.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.jl b/src/util.jl index 8c8696a1..69f9fac5 100644 --- a/src/util.jl +++ b/src/util.jl @@ -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)