diff --git a/docs/documentation/amr.md b/docs/documentation/amr.md index 58ac15cde6..faf3d441d6 100644 --- a/docs/documentation/amr.md +++ b/docs/documentation/amr.md @@ -73,7 +73,7 @@ owner and the ranks it overlaps. All exchanges are posted in a fixed order, so r On GPUs every block array is device-resident. A rank advances its blocks of equal level in batches stacked along the last dimension, one solver call per batch; this is why AMR needs a uniform Cartesian grid. The toolchain enables -`amr_device_pack` (fused exchange kernels) when `amr_max_grid_size <= 64` and sets `amr_snap = min(2, amr_buf - 2)` +`amr_device_pack` (fused exchange kernels) and sets `amr_snap = min(2, amr_buf - 2)` (regrid hysteresis) under dynamic regrid, unless they are set explicitly. `rank_time_wrt = T` prints a per-phase time budget of the AMR step, the block-balance report, and at the end of the run diff --git a/docs/documentation/case.md b/docs/documentation/case.md index e73b78fb55..6d41a83b4e 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -986,7 +986,7 @@ uniform Cartesian grid. | `amr_prolong` | Integer | Prolongation: 1 limited linear, 2 quartic with a positivity fallback (default 1) | | `amr_place_owner` | Logical | Place each block on the rank owning most of its coarse cells (default F) | | `amr_snap` | Integer | Regrid hysteresis in coarse cells, <= `amr_buf - 2` (default 0; set by the toolchain under regrid) | -| `amr_device_pack` | Logical | Fused device pack/unpack of the coarse-patch exchange (default F; set by the toolchain when `amr_max_grid_size <= 64`) | +| `amr_device_pack` | Logical | Fused device pack/unpack of the coarse-patch exchange (default F; set by the toolchain for every AMR case) | Each save writes the block hierarchy and fine solution next to the level-0 restart data; a restart reads the block geometry from it, not from `amr_block_beg`/`amr_block_end`. diff --git a/toolchain/mfc/case_validator.py b/toolchain/mfc/case_validator.py index 6c30a91962..6b904347fb 100644 --- a/toolchain/mfc/case_validator.py +++ b/toolchain/mfc/case_validator.py @@ -3906,8 +3906,6 @@ def _format_errors(self) -> str: # AMR defaults the toolchain derives for a case that leaves them unset. The Fortran defaults stay off on purpose: a # default set there bypasses every rule above, so the decision lives here, under the same prohibitions. -# The fused pack/unpack is derived only up to cap 64 (many small blocks). -DEVICE_PACK_MAX_CAP = 64 # Regrid hysteresis under dynamic regrid when the tag buffer leaves room (amr_snap <= amr_buf - 2). SNAP_DEFAULT = 2 @@ -3917,13 +3915,10 @@ def apply_amr_defaults(params: Dict[str, Any]) -> bool: simulation validation with them on. Returns True when they were applied.""" if params.get("amr", "F") != "T": return False - defaults: Dict[str, Any] = {} - if 0 < int(params.get("amr_max_grid_size", 0)) <= DEVICE_PACK_MAX_CAP: - defaults["amr_device_pack"] = "T" + # fused exchange kernels: faster at every block size measured (Frontier MI250X, 8-512 GPUs) + defaults: Dict[str, Any] = {"amr_device_pack": "T"} if int(params.get("amr_regrid_int", 0)) > 0 and int(params.get("amr_buf", 3)) - 2 >= 1: defaults["amr_snap"] = min(SNAP_DEFAULT, int(params.get("amr_buf", 3)) - 2) - if not defaults: - return False trial = dict(params) trial.update({k: params.get(k, v) for k, v in defaults.items()}) try: diff --git a/toolchain/mfc/test_case_validator.py b/toolchain/mfc/test_case_validator.py index ccb2bc9338..20dbc1d2e1 100644 --- a/toolchain/mfc/test_case_validator.py +++ b/toolchain/mfc/test_case_validator.py @@ -541,10 +541,11 @@ class TestAmrDefaults(unittest.TestCase): def test_admissible_amr_case_gets_defaults(self): p = dict(self.AMR) self.assertTrue(apply_amr_defaults(p)) - self.assertEqual(p["amr_device_pack"], "T") # cap 16 <= DEVICE_PACK_MAX_CAP - q = {**self.AMR, "amr_max_grid_size": 96} - self.assertFalse(apply_amr_defaults(q)) # static block above the cap: nothing to derive - self.assertNotIn("amr_device_pack", q) + self.assertEqual(p["amr_device_pack"], "T") + for cap in (96, 0): # large or rank-derived blocks get the fused kernels too + q = {**self.AMR, "amr_max_grid_size": cap} + self.assertTrue(apply_amr_defaults(q)) + self.assertEqual(q["amr_device_pack"], "T") r = {**self.AMR, "amr_device_pack": "F"} self.assertTrue(apply_amr_defaults(r)) self.assertEqual(r["amr_device_pack"], "F")