Branch: refs/heads/main
Revision: 57f2dbd
Author: stonea
Link: Fix to ensure we support `writeln` when `CHPL_GPU_MEM_STRATEGY=array_on_device` by stonea · Pull Request #20532 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #20532 from stonea/write_in_uva_mem_strategy
Fix to ensure we support writeln when CHPL_GPU_MEM_STRATEGY=array_on_device
For the GPU locale model we don't want wide pointers inside kernel functions (which we consider a local block) but we still want to force wide pointers outside of it.
Implementing this just involved special casing the GPU locale model in forceWidePtrsForLocal() in util/misc.cpp.
This will ensure that when using the array_on_device strategy with a program like the following A will be a wide pointer
so that we perform the get that's necessary to copy the data for A from the GPU to the host for the write:
on here.gpus[0] {
var A : [0..10] int;
writeln(A); // Previously this would crash when
// GPU_MEM_STRATEGY=array_on_device
}
Long term we'll want to update insert wide references pass to be cognizant of the GPU locale model but that's going to be a bit of a project.
[Reviewed by @benharsh and @daviditen]
Modified Files:
M compiler/codegen/codegen.cpp
M compiler/include/misc.h
M compiler/llvm/clangUtil.cpp
M compiler/main/driver.cpp
M compiler/optimizations/gpuTransforms.cpp
M compiler/util/misc.cpp
M runtime/src/gpu/cuda/gpu-cuda.c
M test/gpu/native/page-locked-mem/jacobi.chpl
Compare: https://github.com/chapel-lang/chapel/compare/c37e54482980...57f2dbd3e97e