[Chapel Merge] Add GPU module with gpuWrite and assertOnGpu

Branch: refs/heads/main
Revision: 44652a0
Author: stonea
Link: Add GPU module with gpuWrite and assertOnGpu by stonea · Pull Request #20423 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20423 from stonea/gpu_module

Add GPU module with gpuWrite and assertOnGpu

This adds a module GPU where we can stash various GPU related utility functions. It includes:

A function assertOnGpu() that will do a runtime-halt if it's detected running anywhere other than the GPU.
Functions gpuWrite and gpuWriteln functions that can be used print from within a GPU kernel without making it ineligible for GPUization (as write and writeln do today).

The gpuWrite/gpuWriteln functions should be seen as a stopgap measure until we figure out how to make write and writeln properly supported. In the meantime it's a pain to do any sort of debugging without this.
Unfortunately gpuWrite/gpuWriteln are also limited in that they only work (without knocking things off GPUization) if they're passed c_string arguments (see the comments under gpuWrite for details). I want to create a separate issue to investigate why the sort of string processing I want to do, which would make gpuWrite more generic, is throwing things off of GPUization.
This makes gpuWrite of pretty limited use "as-is" in this PR but I still think it's better that these functions be available sooner (even in limited form) rather than later.

[Reviewed by @ShreyasKhandekar and @daviditen]

Modified Files:
A modules/standard/GPU.chpl

A test/gpu/native/gpuWritelnAndAssertOnGpu.chpl
A test/gpu/native/gpuWritelnAndAssertOnGpu.good
M compiler/AST/primitive.cpp
M compiler/codegen/cg-expr.cpp
M compiler/dyno/include/chpl/uast/PragmaList.h
M compiler/dyno/include/chpl/uast/prim-ops-list.h
M compiler/dyno/lib/resolution/prims.cpp
M compiler/optimizations/gpuTransforms.cpp
M compiler/optimizations/optimizeOnClauses.cpp
M runtime/include/gpu/cuda/chpl-gpu-gen-includes.h

Compare: https://github.com/chapel-lang/chapel/compare/f540c74cb87f...44652a0bd8a7