Skip to content

feat(ep/v2): gfx1250-strict support - #874

Merged
jhchouuu merged 6 commits into
mainfrom
jiahzhou/gfx1250-strict
Nov 6, 2026
Merged

jhchouuu merged 6 commits into
mainfrom
jiahzhou/gfx1250-strict

Conversation

@jhchouuu

Copy link
Copy Markdown
Collaborator

No description provided.

- Device code keys gfx125x paths on MORI_GFX125X / CCO_GFX125X, which include gfx1250-strict
- Arch detection, build lists and AsyncLL defaults accept gfx1250-strict; arch lists defer to the arch the GPU reports
- Tuning rows for gfx1250 ASIC revision 0, picked by revision; tuned grids capped at the CU count
- A code object built for another arch fails to load with both archs named
- Torch-free EPv2 smoke test; the no-GPU arch tests run in CI

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@jhchouuu
jhchouuu force-pushed the jiahzhou/gfx1250-strict branch from 59e0a1c to f45155a Compare November 2, 2026 14:13
- Table key gfx1250-rev0 is now gfx1250-strict; selection by ASIC revision is unchanged

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@kawhil-amd kawhil-amd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the gfx1250-strict change. I read the full non-test diff and searched the PR head for leftover __gfx1250__ / == "gfx1250" checks. I found none in the device or host paths. I did not review test_ep_smoke_no_torch.py. I did not run any test. My local clang does not support gfx1250-strict, so I could not compile-check the macro below.

1. Device side depends on the macro name __gfx1250_strict__ (medium, unverified)
arch.hpp, cco.hpp and utils.hpp all use it. DeviceMacroTest only greps source text and does not call the compiler. If the name is wrong, v1 intranode_entry.hpp silently takes the portable body. The host still sees the gfx125 prefix and reserves TDM LDS, so host and kernel disagree with no error. The new #error guard covers only v2 ep_intranode_1250x.hpp. Please confirm with clang --offload-arch=gfx1250-strict -dM -E, or add that check to CI.

2. Python and C++ may get the arch name from different sources (medium, unverified)
C++ uses hipGetDeviceProperties().gcnArchName. Python detect_gpu_arch() uses rocm_agent_enumerator / rocminfo. The PR says KFD reports gfx1250 for both targets. If the enumerator reports gfx1250 on a strict runtime, the v1 JIT builds a gfx1250 code object that fails to load. _module_load_note in hip_driver.py compares against the same enumerator, so it adds no hint in exactly that case. Which source reports gfx1250-strict on real hardware?

3. MORI_GPU_ARCHS change also affects gfx9 users (low)
CMake now returns the whole list, so every mori_add_device_target gets all listed archs as HIP_ARCHITECTURES. Before, it got only the first. In Python, a list of several archs no longer overrides detection. The detected GPU wins. Both are probably intended, but the PR description does not mention them.

4. gfx1251 joins the gfx125x family in cco.hpp (low)
CCO_GFX125X includes __gfx1251__. Before, cco.hpp tested only __gfx1250__. gfx1251 now gets wave32 and the SDMA scope fields there. This matches the v1 family test but is a behavior change that is not mentioned.

5. Nits

  • _fit_cus is copied word for word in hip_tuning_configs.py and tuning_configs.py. It also clamps silently, with no log.
  • The PR description is empty. The design is only in docs/MORI_JIT_V2_DESIGN.md.

The ASIC revision check (KFD capability bits 25:22, revision 0) looks correct. I cannot confirm that revision-0 parts are the ones that can run strict. That needs the author's hardware knowledge.

jhchouuu and others added 2 commits November 5, 2026 09:49
- Share the CU-count clamp as mori.ops.utils.fit_blocks_to_cus; it warns once when it caps
- v1 JIT passes MORI_HOST_GFX125X; intranode_entry.hpp fails to build if the device macros disagree
- Test the family macros with the device compiler, and that arch.hpp and cco.hpp test the same family
- Update the strict tests for main's aggReserve default and 256-block gfx1250 rows

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@jhchouuu

jhchouuu commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Re: review. Thanks for the review. I merged main and pushed the fixes below.

1. __gfx1250_strict__

  • Confirmed with the compiler. clang++ -x hip --offload-arch=gfx1250-strict --cuda-device-only -E -dM defines __gfx1250_strict__ and __GFX12__, and does not define __gfx1250__.
  • New DeviceMacroCompileTest. It preprocesses arch.hpp with the ROCm clang for gfx950, gfx1250 and gfx1250-strict, and checks MORI_GFX125X / MORI_WAVE32 for each. A target the installed clang does not know is skipped. The test runs in the existing no-GPU CI step.
  • New test that arch.hpp and cco.hpp test the same family. They are separate definitions, because cco.hpp includes no other mori header.
  • The v1 path now has the same tripwire as v2. The v1 JIT passes -DMORI_HOST_GFX125X=1 when the host takes the gfx125 path. intranode_entry.hpp then fails to compile if that is set and MORI_GFX125X is not, so a host/kernel disagreement becomes a build error instead of a silent mismatch.
  • Checked both ways. Forcing the define on a gfx950 compile hits the #error. The v1 ep_intranode JIT for gfx1250-strict gets the TDM body: its TDM load and store instructions match the gfx1250 build one for one.

2. Arch source

  • On a device running gfx1250-strict, rocm_agent_enumerator, rocminfo and hipGetDeviceProperties().gcnArchName all report gfx1250-strict. Only KFD's gfx_target_version is the same for both targets, which is why the Python side does not use it.
  • I checked this on hardware, with the device running gfx1250 and then gfx1250-strict:
    • The Python JIT (the IO kernel and v1 ep_intranode) and the C++ JIT picked the same target.
    • Both modules loaded.
    • The EPv2 kernels passed.
  • When the module and device archs differ, the C++ load error names both, using gcnArchName.

3. MORI_GPU_ARCHS
Both changes are intended:

  • CMake. Before, a list built only its first supported arch. Now it builds every listed arch, which matches what setup.py does.
  • Python JIT. A list is a build's target list, so the JIT now uses the entry that matches the detected GPU. Before, it took the first entry, so the nightly list gfx942;gfx950;gfx1250 compiled gfx942 on any machine. A single value is still an override.
  • The Python behavior is in docs/MORI_JIT_ARCHITECTURE.md.

4. gfx1251
Intended. The host already routes gfx1251 by the gfx125 prefix and v1 already counts it as gfx125x, but cco.hpp compiled the gfx9 wave64/SDMA path for it. The change removes that mismatch.

5. Nits
_fit_cus is now a single mori.ops.utils.fit_blocks_to_cus, used by both tables. It logs a warning once for each (blocks, CUs) pair it caps.

Revision 0: Yes. ASIC revision 0 parts are the ones that can run gfx1250-strict; revision 1 parts always report gfx1250. The rows are also selected whenever the runtime reports gfx1250-strict, even if the revision cannot be read.

jhchouuu and others added 2 commits November 5, 2026 11:12
- ll128() returns None when the gfx1250-strict rows apply, so these parts run the schedule's plans
- Test that revision-0 parts (either code target) get no LL128 plan and revision 1 still does

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- bf16 dispatch at topk 6/8/9 takes 64x8 for small token counts
- Gather combine at topk 6/8/9 takes 128x8 around 256 tokens
- New EP4 hidden-2048 topk-8 dispatch rows (16 warps from 512 tokens) in place of the capped gfx1250 ones

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@jhchouuu
jhchouuu merged commit bd2e243 into main Nov 6, 2026
15 checks passed
@jhchouuu
jhchouuu deleted the jiahzhou/gfx1250-strict branch November 6, 2026 03:33
zhangfei829 added a commit that referenced this pull request Nov 12, 2026
…mbine the same way on every rank


Brings in #874 and the KernelConfig schedule; the push plans are keyed by tuning.KernelConfig like the schedule's.

Review changes:
- Above LL128's max_tok a combine pulls only when it asks for the weight fold or combines a snapshot handle, which every rank of a call does alike, and pushes otherwise, whatever its token count and wherever its input lives; in_view_pull_max is gone. Before, each rank chose from its own token count and from whether its own input was in combine_in_view(), so the ranks of one call could disagree, and the pushing ranks then reduced landing rows nobody wrote.
- The push geometry still comes from the rank's own token count; ranks of one call may run different push geometries, since the landing rows and their signals do not depend on it.
- bf16_push() reads _device_keys()[0], so gfx1250-strict parts have no row and build no push plans.
- MORI_EP_BF16_PUSH=0 builds no push plans and no landing area; any value but 0 or 1 raises.
- test_bf16_push_select.py: token counts crossing max_tok and every push bucket edge, the same on every rank and different on each, with the input passed five ways (plain tensor, combine_in_view(), combine_in_view() on alternate ranks only, with weights, through a snapshot handle); under MORI_EP_BF16_PUSH=0 it checks that no push plan is built.
- README: the push plans, which combine a call runs, and the opt-out.
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.

2 participants