[Chapel Merge] Modularize runtime's GPU implementation

Branch: refs/heads/main
Revision: b8defaf
Author: e-kayrakli
Link: Modularize runtime's GPU implementation by e-kayrakli · Pull Request #20358 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20358 from e-kayrakli/gpu-modular-runtime

Modularize runtime's GPU implementation

This PR refactors the GPU layer in the runtime so that it is not hard-coded to
use CUDA.

The main GPU interface of the runtime is still in runtime/includes/chpl-gpu.h
which is implemented in runtime/src/chpl-gpu.c. However, with this PR, the
functions there will call new functions that are in chpl_gpu_impl_*
"namespace". These functions implement core functionality and implemented by
different layers. Chapel-specific functions like debugging output and
diagnostics are still maintained in chpl-gpu.c, and not going to be duplicated
in different layers as much as possible.

Currently, there is only one GPU layer and it is for CUDA. This can be specified
with CHPL_GPU_RUNTIME environment variable. But, obviously CUDA is the default
and there's no actual difference whether you set this environment variable or
not. The hope is that new GPU layers can be added relatively easily once we lay
out this support.

[Reviewed by @jhh67]

Test:

  • spot checks in gpu/native

  • full gpu/native

  • standard

    Modified Files:
    A runtime/include/chpl-gpu-impl.h
    A runtime/src/gpu/Makefile
    A runtime/src/gpu/common/cuda-shared.h
    A runtime/src/gpu/common/cuda-utils.h
    A runtime/src/gpu/cuda/Makefile
    A runtime/src/gpu/cuda/Makefile.include
    A runtime/src/gpu/cuda/Makefile.share
    A runtime/src/gpu/cuda/gpu-cuda.c
    M runtime/Makefile.help
    M runtime/include/chpl-gpu-diags.h
    M runtime/include/chpl-gpu.h
    M runtime/make/Makefile.runtime.include
    M runtime/src/Makefile
    M runtime/src/chpl-gpu.c
    M test/gpu/native/launchCounter.prediff
    M util/chplenv/chpl_gpu.py
    M util/chplenv/printchplenv.py

    Compare: Comparing 1c7491ceacfb...b8defaf9debe · chapel-lang/chapel · GitHub