[Chapel Merge] Produce compile time error if we generate a "launc

Branch: refs/heads/main
Revision: 3c76f94
Author: stonea
Link: Produce compile time error if we generate a "launch kernel" call inside a kernel by stonea · Pull Request #20189 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20189 from stonea/error_gpu_multidim_loop

Produce compile time error if we generate a "launch kernel" call inside a kernel

Currently (with GPU support) we don't support having loops over multi-dimensional domains like the following:

on here.gpus[0] {
  var A: [1..10, 1..10] real;
  forall (i,j) in {1..10, 1..10} do
    A(i,j) = i + j;
  writeln(A);
}

Part of this PR is the "quick fix" mentioned here: Cray/chapel-private#3481 which gets us "further along" to supporting these kind of loops but we run into other issues. Specifically, we'll produce a kernel launch inside a kernel and we don't know how to handle that.

As a convenience in this PR I detect when this situation occurs and produce a compile time error.
One concern is due to the nature of GPU support we will try and generate kernels for all eligible loops even if they won't actually launch on a GPU at runtime.

Maybe this should be a runtime error or warning instead? All of our GPU tests pass and in the absence of this PR you'd still hit a compile time error (just one with an even worse error message: foo.chpl:2: internal error: assertion error [codegen/cg-expr.cpp:2787]

[Reviewed by @e-kayrakli]

Modified Files:
A test/gpu/native/limitations/iterateOverMultidimDomain.chpl

A test/gpu/native/limitations/iterateOverMultidimDomain.good
M compiler/optimizations/gpuTransforms.cpp

Compare: https://github.com/chapel-lang/chapel/compare/02ba4561e365...3c76f94cf2c5