[Chapel Merge] assertOnGpu do compiletime assert if not gpuizable

Branch: refs/heads/main
Revision: 83cd81d
Author: stonea
Link: Unavailable
Log Message:

Merge pull request #20593 from stonea/gpuAssertAsCompiletimeError

assertOnGpu do compiletime assert if not gpuizable

This change will cause assertOnGpu to produce a compile time error in any loop that contains it if that loop fails to GPUize. This also lets us give some better error messages to explain why a loop failed to GPUize (for example: because it had a call to a recursive function or because it accesses a global variable).
Some additional details:

  • I inline the assertOnGpu() procedure so by the time we get gpuTransforms I can just check for the presence of the primitive we use for this.
  • From an optimal performance standpoint it's probably not great that I'm introducing an extra pass over the loop body to look for the presence of this primitive. We end up doing a later pass over the loop body anyway so in theory I could try and restructure things to do the check there. In practice I wouldn't expect it makes a big perf difference though.
  • For cases where we have nested loops we won't trigger the compile time assertion if the inner loop fails to gpuize -- if the outer loop gpuizes you'll still be on the GPU, there just won't be a nested kernel launch.

[Reviewed by @DanilaFe]

Modified Files:
A test/gpu/native/assertOnFailToGpuize.1.good

A test/gpu/native/assertOnFailToGpuize.2.good
A test/gpu/native/assertOnFailToGpuize.3.good
A test/gpu/native/assertOnFailToGpuize.4.good
A test/gpu/native/assertOnFailToGpuize.5.good
A test/gpu/native/assertOnFailToGpuize.6.good
A test/gpu/native/assertOnFailToGpuize.7.good
A test/gpu/native/assertOnFailToGpuize.8.good
A test/gpu/native/assertOnFailToGpuize.chpl
A test/gpu/native/assertOnFailToGpuize.compopts
M compiler/optimizations/gpuTransforms.cpp
M modules/standard/GPU.chpl
M test/gpu/native/gpuWritelnAndAssertOnGpu.chpl
M test/gpu/native/gpuWritelnAndAssertOnGpu.good

Compare: https://github.com/chapel-lang/chapel/compare/0f220df3915c...83cd81dc5d0a