Repository navigation
[OPUS] [JIT] Fall back to regular COs when A0 strict is unsupported by the HIP runtime - #7185
Conversation
HIP runtimes before 7.16.26385 reject gfx1250-strict code objects, which broke A0 nodes on older ROCm (e.g. ATOM CI 7.16.26315: invalid device function). On ASIC Revision 0, preflight the strict image with hipModuleLoadData and fall back to the same symbol regular gfx1250 image when the runtime rejects it, warning once per process. Missing files and wrong ELF profiles remain hard errors, and strict stays preferred on HIP >= 7.16.26385. Validate compute/wl/wlr regular COs on A0 hardware against a CPU golden and add profile/cache regression tests.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
|
The fallback approach and the A0 validation look good to me. One non-blocking concern: Could we restrict fallback to the observed compatibility error ( |
|
Thanks for adding the old-runtime compatibility path and for validating the regular COs on A0. I think this needs two adjustments before landing alongside the
I would therefore gate fallback approximately as: const bool legacy_a0 = arch == "gfx1250" && asic_revision == 0;
const bool strict_a0 = arch == "gfx1250-strict" && asic_revision == 0;Only Also, Tests should cover both runtime identities, inconsistent arch/revision pairs, exact-strict load failure without fallback, and a non-capability HIP error. This also needs to be coordinated with #6767 so both PRs use the same canonical strict artifact-directory convention ( |
|
@demonsan any update |
ROCr reports the strict ISA id on A0 by default while rocm_agent_enumerator still reports gfx1250 during the transition. Keep arch detection untouched (real id everywhere): only the OPUS BF16 GEMM CO call ignores the distinction. The CO loader accepts both ids for image selection and old-runtime regular fallback, and A16W16 launch planning resolves CO kids through the base gfx1250 family while non-CO kids keep the real id. Shared JIT probes, registry keys, GPU_ARCHS build targets and codegen are untouched.
44bfd2c to
2f723b3
Compare
The A0 images are compiled with --offload-arch=gfx1250-strict, so the profile directory, build_co default output and build metadata should use that name instead of the misleading gfx1250-a0. Rename gen_co/gfx1250-a0/ to gen_co/gfx1250-strict/, set target_profile=strict, update the CO loader, docs and tests. The loader still reads a legacy gfx1250-a0/ directory when gfx1250-strict/ is absent.
46c6f32 to
6b5ef5d
Compare
|
Given the immediate need to unblock OPUS/ATOM testing on A0 with the older ROCm runtime, I am OK with landing this as a transitional compatibility fix once the required CI is green. The regular Before merge, I strongly recommend one small safety constraint: only fall back when Please track a follow-up PR to make the final routing follow the exact ISA identity reported by ROCr:
That follow-up should remove the preflight/fallback layer once the reported-ID path is in place. The broader directory/packaging cleanup should not block this immediate old-ROCm A0 test recovery. |
zufayu
left a comment
There was a problem hiding this comment.
Approved as a transitional compatibility fix to unblock old-ROCm A0 OPUS/ATOM testing. Please track the reported-ISA routing cleanup and removal of the preflight/fallback layer in a follow-up PR.
…failure (#7505) #7185 added hip_module_accepts() as a capability probe: on an A0 node it tries hipModuleLoadData() on the gfx1250-strict (0xeb) code object and, when the HIP runtime is older than ROCm 10.1 and rejects it, falls back to the regular gfx1250 CO. The fallback works, but the failed probe leaves HIP's sticky last-error set to hipErrorNoBinaryForGpu and never clears it. A successful HIP call does not reset that record, so the stale error is inherited by the next unrelated HIP call (e.g. torch.empty during serving init) and aborts the process there, far from its real cause. Clear the recorded error with hipGetLastError() in the probe's failure branch so a failed capability probe leaves no error state behind. Validated on a real MI450 A0 node (torch HIP 7.16.26315, old runtime): without this line the DeepSeek-V4-Flash server dies at startup with hipErrorNoBinaryForGpu surfacing in torch.empty (matches the extended-test CI crash); with it the server starts, the expected "falling back to regular gfx1250 CO" warning prints once, and no HIP load error occurs. Note: this fixes only the startup crash. A separate, independent in-serving GPU memory access fault on A0 (unrelated to this sticky error) is tracked elsewhere and is out of scope for this PR. Co-authored-by: zufayu <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
…y the HIP runtime (ROCm#7185) * [OPUS] Fall back to regular COs when A0 strict is unsupported HIP runtimes before 7.16.26385 reject gfx1250-strict code objects, which broke A0 nodes on older ROCm (e.g. ATOM CI 7.16.26315: invalid device function). On ASIC Revision 0, preflight the strict image with hipModuleLoadData and fall back to the same symbol regular gfx1250 image when the runtime rejects it, warning once per process. Missing files and wrong ELF profiles remain hard errors, and strict stays preferred on HIP >= 7.16.26385. Validate compute/wl/wlr regular COs on A0 hardware against a CPU golden and add profile/cache regression tests. * [OPUS] Treat gfx1250-strict as gfx1250 at the CO call ROCr reports the strict ISA id on A0 by default while rocm_agent_enumerator still reports gfx1250 during the transition. Keep arch detection untouched (real id everywhere): only the OPUS BF16 GEMM CO call ignores the distinction. The CO loader accepts both ids for image selection and old-runtime regular fallback, and A16W16 launch planning resolves CO kids through the base gfx1250 family while non-CO kids keep the real id. Shared JIT probes, registry keys, GPU_ARCHS build targets and codegen are untouched. * [OPUS] Name the A0 strict CO profile gfx1250-strict The A0 images are compiled with --offload-arch=gfx1250-strict, so the profile directory, build_co default output and build metadata should use that name instead of the misleading gfx1250-a0. Rename gen_co/gfx1250-a0/ to gen_co/gfx1250-strict/, set target_profile=strict, update the CO loader, docs and tests. The loader still reads a legacy gfx1250-a0/ directory when gfx1250-strict/ is absent.
Problem
On gfx1250 A0 nodes, HIP runtimes older than ROCm 10.1.0 reject the
gfx1250-strict(0xeb) code objects. The loader correctly selectedgen_co/gfx1250-a0/, but registration failed, breaking OPUS BF16 GEMM anddownstream models. Reproduced on g21-10 (4x gfx1250, ASIC Revision 0, 256 CU)
with the same runtime as the failing ATOM CI job (
HIP 7.16.26315):0x490xebinvalid device function(fatbin),hipErrorNoBinaryForGpu(module API)HSA_DISABLE_GFX12_STRICT=0/1/unsetmakes no difference. The failing CI job usedaiter
b5078fc49, which already containedgfx1250-a0/and ASIC-based routing,so this is a runtime floor, not a missing image or kid mismatch.
Change
On ASIC Revision 0 the loader now:
hipModuleLoadData(no dependence onAITER_CHECKthrow mode);process to the same symbol's regular
gfx1250image, with one warning;Missing files and wrong ELF profiles are still hard errors and never silently
select another profile. A0 CI should still be upgraded to ROCm 10.1.0 release
for the A0-tuned kernels; the fallback only restores compatibility.
Validation
Regular
0x49correctness on A0 was established before enabling the fallback:tiny and ragged
M/N/K, batch 2, padded source rows - all matched the CPUgolden,
max_err=0.[opus] A0 gfx1250-strict CO not loadable ... falling back to regularthen
FALLBACK_E2E_PASS max_err=0.max_err=0(strict remains preferred).
op_tests/cpp/test_opus_co_profile.cpp(C++17) andop_tests/cpp/test_opus_co_cache.cpp(mock HIP, old/new runtime scenarios)pass;
test_opus_co_profile.py(6 tests) andtest_opus_co_builder.py(13 tests) pass; Ruff/Black clean.
The native A0 test binary needed
-std=c++20under the old image's clang 23because its libstdc++ rejects the defaulted
std::paircopy constructor for thenon-copyable module type in C++17; runtime code is unchanged by that.
Files
csrc/opus_gemm/include/gfx1250/opus_co_launch_gfx1250.cuh: preflight + fallbackcsrc/opus_gemm/include/gfx1250/opus_co_profile_gfx1250.h: regular-fallback path selectionop_tests/cpp/test_opus_co_{cache,profile}.cpp: regression coveragecsrc/opus_gemm/gen_co/{README,HYBRID_VALIDATION}.md: runtime matrix and fallback policyFollow-up:
gfx1250-strictat the OPUS BF16 GEMM CO callROCr reports
gfx1250-stricton A0 by default while rocm_agent_enumeratorstill reports
gfx1250(#14668 blocked). Arch detection is left untouched:every layer keeps the real runtime id. Only the OPUS BF16 GEMM CO call ignores
the distinction:
select_image,select_regular_fallback) accepts bothids, still picks the profile from the ASIC Revision, and still falls back to
the regular image on old runtimes;
gfx1250family when the real id is
gfx1250-strict; non-CO OPUS kids and everyother kernel keep the real id.
Shared
aiter/jit/**, registry keys,GPU_ARCHSbuild targets, tuned-CSVlookup and codegen are unchanged; keep
GPU_ARCHS=gfx1250for JIT buildsduring the transition. New
op_tests/test_gfx1250_strict_alias.pyasserts thereal arch value is preserved and only CO kid planning aliases it; C++ CO
profile cases cover both ids plus the strict-id regular fallback (pytest: 24
passed;
CO_PROFILE_CPP17_TESTS_PASS).A0 profile directory name
The A0 images are built with
--offload-arch=gfx1250-strict, so the profile isnow named
gen_co/gfx1250-strict/instead of the misleadinggfx1250-a0/. This renames the tracked profile directory (221 COs +build_info.json), thebuild_co.pydefault output, CO loader selection,docs and tests. The loader still reads a legacy
gfx1250-a0/directory whengfx1250-strict/is absent, so existing checkouts keep working.Validation: pytest CO builder/profile suites pass; C++
test_opus_co_profileandtest_opus_co_cachepass (including the legacydirectory case); A0 hardware CO launch re-run on g21-10 with the renamed
directory passes on both HIP 7.16.26315 (regular fallback) and 7.16.26385
(strict images).