Skip to content

regent: Cache projection functors

Elliott Slaughter requested to merge regent-projection-deduplicate into master

With this MR, Regent now caches projection functors that are used repeatedly in the same task. For example, the following loops will reuse the same projection functor:

__demand(__index_launch)
for i in colors do
  my_task(p[(i + 1) % 5])
end
__demand(__index_launch)
for i in colors do
  my_task(p[(i + 1) % 5]) -- reuses the same projection functor
end

This also works for projections that capture variables, like:

__demand(__index_launch)
for i in colors do
  my_task(p[(i + 1) % n])
end
__demand(__index_launch)
for i in colors do
  my_task(p[(i + 1) % n]) -- reuses the same projection functor
end

This also works with var statements inside the loop, like:

__demand(__index_launch)
for i in colors do
  var y = i + 1
  my_task(p[y % n])
end
__demand(__index_launch)
for i in colors do
  var y = i + 1
  my_task(p[y % n]) -- reuses the same projection functor
end
Edited by Elliott Slaughter

Merge request reports