[Chapel Merge] Ensure bulk transfers work correctly in the presence of sublocales

Branch: refs/heads/main
Revision: f7e9db2750c315aea1feab1bacfe23777509f14e
Author: DanilaFe
Link: Ensure bulk transfers work correctly in the presence of sublocales by DanilaFe · Pull Request #25632 · chapel-lang/chapel · GitHub
Log Message:
Ensure bulk transfers work correctly in the presence of sublocales (#25632)

Closes Bulk transfer between two remote-declared GPU arrays segfaults · Issue #25431 · chapel-lang/chapel · GitHub.

When checking if an on statement is necessary, simple block transfer
checks if one of the arrays (either destination or source) is on the
current locale. In that case, it can use either get or a put from the
current locale. Otherwise, it switches to the destinaton locale, and
performs a get.

On main, the logic for determining whether this switching behavior is
necessary is faulty. Specifically, it uses only the locale IDs for
comparison; however, the parent locale and its GPU sublocales all have
the same ID. Thus, when executing on the host, one can mistakenly think
that one is executing on the device, and try to perform a get that way.
This causes a crash.

The solution is to check for equaity on sublocale IDs when they are
present. This commit / PR implements this.

Reviewed by @e-kayrakli -- thanks!

Testing

  • GPU testing
  • GASNet testing

Compare: Comparing ef8817f63e4da2748f9cb20c0aa194f667f2c154...00be8712d1bce1c545f1958843425ab81bf00cf5 · chapel-lang/chapel · GitHub

Diff:
M modules/internal/DefaultRectangular.chpl
A test/gpu/native/remote-to-remote-transfer-from-host.chpl
A test/gpu/native/remote-to-remote-transfer-from-host.good
A test/gpu/native/transfer-to-remote-from-host.chpl
A test/gpu/native/transfer-to-remote-from-host.good
https://github.com/chapel-lang/chapel/pull/25632.diff