Skip to content

AMR: derive amr_device_pack for every AMR case - #2412

Draft
sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:amr-device-pack-default
Draft

sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:amr-device-pack-default

Conversation

@sbryngelson

Copy link
Copy Markdown
Member

AI-assisted (Claude Code). Part of #2247.

What

The toolchain derives amr_device_pack = T (one fused pack/unpack kernel per stage for the coarse-patch exchange, instead of one kernel launch per transfer) for every AMR case that leaves it unset. Before, it did so only when amr_max_grid_size was set to 1..64, so the default amr_max_grid_size = 0 (block cap derived from the decomposition) always took the per-transfer path. An explicit amr_device_pack = F is still respected, and the derivation still goes through the validator. amr.md, case.md and the unit test are updated.

Why

Found while tracing why the tiling follow-up to #2381 was slower at 512 GPUs: the coarse-patch gather grew with the number of level-1 blocks (5.4 ms per fill at 343 blocks, 11 ms at 512, 16-29 ms at ~1000), because the few ranks under the refined region launch one pack kernel per slab per receiving block. The fused path removes that. The 64-cell limit came in with #2117 without a recorded reason, and the large blocks of the 8-GPU run below are faster fused too.

How it was checked

Frontier MI250X, OpenMP offload (amdflang), --case-optimization, AMR blast case (--gbpp 16, 40 steps), step-loop wall, one run each, amr_max_grid_size = 0:

GPUs #2381, per-transfer (today's default) #2381, fused tiling follow-up, per-transfer tiling follow-up, fused
8 3.48 s 3.38 s 3.04 s 2.96 s
64 3.91 s 3.56 s 3.90 s 3.55 s
512 5.47 s 4.59 s 6.03 s 4.68 s

At 512 GPUs the gather phase drops from 0.90 to 0.35 s (mean per rank).

This branch (master 7982f2d + this change): the AMR test group passes on Frontier, GPU (--gpu mp, 118 passed, 0 failed) and CPU (118 passed, 0 failed), against the existing goldens, now that every AMR test takes the fused path. toolchain/mfc/test_case_validator.py passes (199), and the updated test failed before the change. ./mfc.sh precheck passes.

Not checked

  • NVHPC / OpenACC timing: CI covers correctness on those lanes.
  • CPU timing (the fused path is the same loops on the host).

Made with Claude Code.

The toolchain enabled the fused coarse-patch pack/unpack only for amr_max_grid_size
in 1..64, so the default (0, block cap derived from the decomposition) always used
one kernel launch per transfer. The fused path is faster at every size measured on
Frontier MI250X: 8 GPUs 3.48 -> 3.38 s, 64 GPUs 3.91 -> 3.56 s, 512 GPUs
5.47 -> 4.59 s (AMR blast, 40 steps). An explicit amr_device_pack = F still wins.
@github-actions

Copy link
Copy Markdown

Claude Code Review

Head SHA: dd120cf

Files changed:

  • 4
  • docs/documentation/amr.md
  • docs/documentation/case.md
  • toolchain/mfc/case_validator.py
  • toolchain/mfc/test_case_validator.py

Findings:
No issues found. Checked in step 4: toolchain/mfc/case_validator.py (apply_amr_defaults, no leftover DEVICE_PACK_MAX_CAP references), toolchain/mfc/test_case_validator.py, docs/documentation/amr.md, docs/documentation/case.md.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant