fix(conv): gate ASM-GTC fwd NHWC solver off int32-overflow tensors#9768
Open
SreecharanGundaboluAMD wants to merge 1 commit into
Open
fix(conv): gate ASM-GTC fwd NHWC solver off int32-overflow tensors#9768SreecharanGundaboluAMD wants to merge 1 commit into
SreecharanGundaboluAMD wants to merge 1 commit into
Conversation
JonathanLichtnerAMD
approved these changes
Jul 23, 2026
JonathanLichtnerAMD
left a comment
Contributor
There was a problem hiding this comment.
I made a small tweak to the PR message, but LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
ConvAsmImplicitGemmGTCDynamicFwdXdlopsNHWC, the ASM-GTC forward solver from theunmaintained MISA project, indexes global tensor memory with 32-bit element indices
and has no large-tensor support. On any problem whose flattened element count exceeds
INT_MAXit overflows that index and silently returns wrong results (forwardverification error ~0.37 on gfx942/gfx950; no crash, it runs, reports a time, and
produces incorrect output).
Because find selects a solver by timing alone and does not verify numerics, this
fast-but-wrong solver gets auto-selected over correct ones, and it currently breaks
developin more than one configuration:FIND_MODE=1/ENFORCE=4): MISA out-times CK on the 1024→1024shapes and is selected → wrong.
Neither a version bump nor a find-mode choice reliably avoids it. Since MISA is
does not implement large-tensor support, it must be gated
during the applicability checks so it can never be selected for shapes it computes
incorrectly.
Technical Details
ConvAsmImplicitGemmGTCDynamicFwdXdlopsNHWC::IsApplicable():returns not-applicable when
GetIn()/GetOut()/GetWeights().GetElementSize() > INT_MAX.AllTensorsDimsFitIntoInt()check only validates that each individuallength/stride fits in int32, it does not bound the flattened element count. For a
packed NHWC tensor the largest stride ≈ elements/N, so a shape can have every stride fit
int32 while the element count overflows; the new predicate is what catches these.
identical code path, zero functional change outside the overflow regime.
!AllTensorsDimsFitIntoInt()(stride regime) and does not touch MISA; this gate coversthe element-count regime and removes the silently-wrong MISA candidate.
CHANGELOG.mdupdated. Related to ROCM-27526.Files:
src/solver/conv/conv_asm_implicit_gemm_gtc_fwd_nhwc.cpp,test/gtest/unit_conv_solver_ConvAsmImplicitGemmGTCDynamicFwdXdlopsNHWC_LargeTensor.cpp,CHANGELOG.md.Test Plan
CPU_UnitTestConvSolver...DevApplicability): abatch-size boundary pair with identical geometry so the element count crosses
INT_MAX,asserting the solver stays applicable just below the limit (N=140, 2.14e9 elements) and
is gated off just above (N=141, 2.15e9). MockHandle-based, runs host-side, no allocation.
and gfx950/MI355X, ROCm 7.0.2.1 and 7.14, MIOpenDriver
-t 1verify.Test Result
stacks (verify error ~0.37, some NaN), confirming it is the solver, not the stack.
on gfx942 and gfx950; natural find selects grouped CK xdlops and verifies OK on all
previously-failing shapes; int32-safe shapes are unchanged.
not-applicable), so CK is the correct target the gate steers find toward.
toolchain available; the gate code itself compiles, having been built identically in the
from-source validation images.)
Submission Checklist