You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@kernelfunctionlocalmem(A)
I =@index(Global, Linear)
i =@index(Local, Linear)
N =groupsize()
lmem =@localmem Int (N,) # Ok iff groupsize is static
lmem[i] = i
@synchronize
A[I] = lmem[N - i +1]
end
This works as expected on the GPU, but on the CPU there is counter-intuitive variable scoping going on. The first weird part is that after the @synchronize the lifetime of N has ended.
And so I thought I could just re-introduce the variable...
@kernelfunctionlocalmem(A)
I =@index(Global, Linear)
i =@index(Local, Linear)
N =groupsize()
lmem =@localmem Int (N,) # Ok iff groupsize is static
lmem[i] = i
@synchronize
N =groupsize()
A[I] = lmem[N - i +1]
end
But it turns out that I made @localmem special, and its live-time begins in an outside scope, which of course is now also missing N.
I will have to think about how to fix this. But most likely this means that we need a "non-divergent value" or a group constant value. In return we might be able to get rid of @private, and do the right thing automatically for all divergent values.
The text was updated successfully, but these errors were encountered:
I just found myself writing a kernel like this:
This works as expected on the GPU, but on the CPU there is counter-intuitive variable scoping going on. The first weird part is that after the
@synchronize
the lifetime ofN
has ended.And so I thought I could just re-introduce the variable...
But it turns out that I made
@localmem
special, and its live-time begins in an outside scope, which of course is now also missingN
.I will have to think about how to fix this. But most likely this means that we need a "non-divergent value" or a group constant value. In return we might be able to get rid of
@private
, and do the right thing automatically for all divergent values.The text was updated successfully, but these errors were encountered: