At the moment, the HP tradequeues (3D periodic only also right now) doesn't support symmetric pairwise operations.
We can launch these in an index launched way using colored launches. There are a few ways to do this, and for now we're going to assume we don't have to worry about variable cutoff lengths, since these will already cause issues with tracing.
1 option (for complex colourings, i.e. when neighbour cutoff >> 1 cell width) is to do the colouring explicitly:
var color_region = region(cell_space.colors, int)
-- fill in the region 0, 1, 2, 3, etc. for each color
var color_partition = partition(color_region, ispace(int1d, 4))
for color = 0, 4 do
var color_set = color_partition[color]
__demand(__index_launch)
for cell in color_set do
...
The color partition can probably be created during initialisation and just reused in the launchers.
Alternatively, for simple colourings, we can just do something simple like a checkerboard pattern without a color_partition:
var color_space = ispace(int2d, {3, 3})
for color in color_space do
task1(p[{color.x*2, color.y*2 + 1}]) -- orange
end
for color in color_space do
task2(p[{color.x*2 + 1, color.y*2 + 1}]) -- yellow
end
At the moment, the HP tradequeues (3D periodic only also right now) doesn't support symmetric pairwise operations.
We can launch these in an index launched way using colored launches. There are a few ways to do this, and for now we're going to assume we don't have to worry about variable cutoff lengths, since these will already cause issues with tracing.
1 option (for complex colourings, i.e. when neighbour cutoff >> 1 cell width) is to do the colouring explicitly:
The color partition can probably be created during initialisation and just reused in the launchers.
Alternatively, for simple colourings, we can just do something simple like a checkerboard pattern without a color_partition: