KernelAbstractions.jl icon indicating copy to clipboard operation
KernelAbstractions.jl copied to clipboard

Offsetting kernel indices

Open glwagner opened this issue 2 years ago • 2 comments

It'd be extremely useful to have a feature for offsetting the kernel index, either at launch time or setup time.

Not sure what the best design or interface would be. @simone-silvestri and I discussed possibly embellishing StaticSize:

https://github.com/JuliaGPU/KernelAbstractions.jl/blob/4128c3db26f4b9fef59d9589655ea96c35ea2db1/src/nditeration.jl#L14-L17

Our work exclusively uses statically sized kernels so I think we'd prefer a way to specify the offsets statically; eg the size and offset are simultaneously determined.

But another possibility would be to accept offsets as a kwarg similar to how ndrange is accepted for DynamicSize?

glwagner avatar Apr 18 '23 14:04 glwagner

I talked with Simone and I think expressing this as an Index projection similar to LinearIndicies and CartesianIndices is the right direction.

vchuravy avatar Apr 18 '23 21:04 vchuravy

In WaterLily we could also benefit from this as we are currently passing index offsets manually too.

b-fg avatar May 01 '23 18:05 b-fg