[Chapel Merge] dlopen: Adjust the implementation of "broadcasting global variables"

Branch: refs/heads/main
Revision: 657c51090180871a277ebe6575ce39633255d722
Author: dlongnecke-cray
Link: dlopen: Adjust the implementation of "broadcasting global variables" by dlongnecke-cray · Pull Request #28896 · chapel-lang/chapel · GitHub
Log Message:
dlopen: Adjust the implementation of "broadcasting global variables" (#28896)

This PR adjusts the implementation of "broadcasting global variables" in
the runtime to be sensitive to multiple Chapel programs. It focuses on
the gasnet comm layer.

It renames the runtime function to chpl_rt_broadcast_global_vars
(adding the _rt_ prefix). It renames the per-comm-layer implementation
to have the _rt_ prefix and the suffix _impl to establish a
convention. It adds a module-code shim called chpl_broadcastGlobalVars
which the compiler uses during codegen. I've dropped the numGlobals
argument of the function since it was never used. I've also adjusted
codegen for the primitive the compiler uses to properly pass along
line/file info.

Future work for the gasnet comm layer will need to adjust the memory
segment that is used to communicate the L0 globals. Right now, we hard
crash by calling chpl_internal_error if the space required by a new
program is greater than the root program. A better strategy might be to
use some fixed segment size and adjust the caller algorithm to work in
batches if needed, or to just reallocate and re-register the segment.

TESTING

  • standard
  • COMM=gasnet
  • COMM=gasnet, COMPILER=gnu
  • Build with COMM=ofi
  • Build with gasnet-asan and run fastAndIncremental.chpl

Reviewed by @jabraham17. Thanks!

Compare: Comparing 76a5b0169e4dbbe35a51f1732b94228c9d210f3e...1432f56f4beead779b1c90eaf536037ae40e5e6e · chapel-lang/chapel · GitHub

Diff:
M compiler/AST/primitive.cpp
M compiler/codegen/cg-expr.cpp
M compiler/passes/insertWideReferences.cpp
M modules/internal/ChapelRuntimeInterface.chpl
M runtime/include/chpl-comm-internal.h
M runtime/include/chpl-comm.h
M runtime/src/chpl-comm.c
M runtime/src/comm/gasnet/comm-gasnet-ex.c
M runtime/src/comm/none/comm-none.c
M runtime/src/comm/ofi/comm-ofi.c
M runtime/src/comm/ugni/comm-ugni.c
https://github.com/chapel-lang/chapel/pull/28896.diff