Skip to content

PERF: Use plain device memory on every GPU - #36

Merged
pastewka merged 1 commit into
mainfrom
perf/plain-device-memory
Oct 28, 2026
Merged

pastewka merged 1 commit into
mainfrom
perf/plain-device-memory

Conversation

@pastewka

Copy link
Copy Markdown
Contributor

Summary

muTopOpt picked managed memory automatically for a single rank on a unified-memory APU (AMD MI300A), to get past a ~62.8 GiB limit on plain allocations. New measurements on Hunter (HLRS; 4x MI300A per node, ROCm 7.0.2, Cray MPICH 9.1 with GPU support enabled) show that plain memory is the better choice there too:

  • Capacity: plain hipMalloc reached 120 GiB of the 128 GB package (the test's cap) with XNACK on and off.
  • MPI: an all-to-all between the four GPUs of a node, 64 MiB per peer, takes 0.9 ms on plain buffers, 39 ms on managed and 35 ms on host memory. MPI moves managed buffers like host memory.

Plain device memory is now the default on every GPU. managed_memory=True or MUTOPOPT_MANAGED=1 still selects managed memory.

Changes

  • _device_memory_policy(on_device, requested=None): plain unless managed is requested. It no longer takes the GPU kind or the rank count. _device_has_unified_memory is removed, since nothing uses it any more.
  • The log line still starts with device memory: plain device memory... or device memory: managed memory..., so job scripts that grep for it keep working.
  • The device-memory notes in homogenization.py, the managed_memory docstring and the README section are rewritten around the new measurements.
  • test/test_device_memory.py is updated for the new rule.
  • CHANGELOG.md: a PERF entry under v1.5.0 (not yet released).

Testing

I couldn't run pytest locally: import muGrid hangs in my environment, before any test code runs. I checked the two policy functions on their own, extracted from the module, against the cases the updated tests cover. CI should run the real suite.

Companion docs change in muGrid: muSpectre/muGrid (doc/plain-device-memory-apu).

🤖 Generated with Claude Code

Managed memory was the default for a single rank on a unified-memory
APU (AMD MI300A), to get past a ~62.8 GiB limit on plain allocations.
Measured on Hunter (4x MI300A, ROCm 7.0.2, Cray MPICH 9.1 with GPU
support): plain hipMalloc reaches 120 GiB with XNACK on or off, and an
all-to-all between the four GPUs of a node, 64 MiB per peer, takes
0.9 ms on plain buffers, 39 ms on managed and 35 ms on host memory.
Plain device memory is now the default everywhere; managed_memory=True
or MUTOPOPT_MANAGED=1 still selects managed memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pastewka
pastewka merged commit b3d68a5 into main Oct 28, 2026
8 checks passed
@pastewka
pastewka deleted the perf/plain-device-memory branch October 28, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant