fix(miopen): correct CheckNumerics statistics (ALMIOPEN-3391) #16143
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.48) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 539 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.376
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #16143"
general
weight: 0.35
JonathanLichtnerAMD
JIRA ID: ALMIOPEN-3391
Tracking: ALMIOPEN-3391.
Related PR: #12733.
Motivation
CheckNumerics could silently omit statistics and report incorrect extrema for same-sign, zero, infinity, and BF16-subnormal inputs. Its excessive block cap also causes statistics-atomic contention once the global launch size is corrected.
This submits the numerics defects independently of #12733's native-BF16 migration, from
developat951ff1461d4. BF16 types, depthwise kernels, and HIPRTC disk-header include behavior remain unchanged. #12733 still contains overlapping numerics fixes.Landing order: merge #16143 first. Then refresh #12733 from
develop, remove redundant numerics changes from its diff, and retain the native-BF16 migration and related cleanup. The numerics overlap remains until that refresh; no merge or source split is claimed here.Technical Details
booltype and launchblocks 256global work-items.The host cases verify numerical results and a grid-stride tail, not exact launch geometry. Neither the direct-kernel cases nor
FiniteGridStridedistinguishes the old global-thread count fromnumBlocks threadsPerBlock; reverting that multiplier can still leave these permanent tests passing. No permanent geometry assertion is claimed. Scoped test environments restore prior settings. The fixture obtains legacy FP8/BF16 host aliases from the existing test helpers, so it does not depend on #12733's header cleanup.Empty tensors return
falsebefore allocation or GPU launch. Element counts retain the descriptor'ssize_tvalue instead of narrowing toint. The regression fixture uses the existing JSON deserializer to create an actual zero-element descriptor and calls the host input check withnullptr; that deserializer is made visible only in test-enabled builds, without changing normal-build visibility or the public C API.Risk Assessment
Risk Level: Medium — changes the shared CheckNumerics reduction and debug-check launch geometry, including FP8/BF8 consumers. No public API, tensor-storage ABI, BF16 type migration, or convolution change.
Test Plan
Repeat
test_check_numerics --gtest_filter='Smoke/'on gfx950 or gfx12 to exercise IEEE-exponent-bias FP8/BF8 encodings; gfx942 and gfx1170 exercise FNUZ. Run HIP-mode clang-tidy with a frontend matching the HIP development headers.The current branch head is
4b1d76148d2. Its numerics host/kernel, limits shim, descriptor header,environment registry, and regression fixture are unchanged from
8d63d8d744d, but the completemerged build has not been revalidated here.
Test Result
Tested revision:
8d63d8d744d. Standalone Release HIP build with isolated caches andROCM_PATHunset; optional CK/hipconv/MLIR paths were disabled.test_check_numerics --gtest_filter='Smoke/'passed 34/34 cases without skips, including the empty-tensor host case.ctest --output-on-failure --no-tests=error -R CheckNumericspassed 10/10, including all three host cases.MIOPEN_CHECK_NUMERICS=0x11returnedfalsefor zero elements. A real 4,294,967,296-element FP8 tensor reported expectedmin=1,max=1, andmean=1, showing that its count was not narrowed to an empty tensor.These are targeted gfx942 results, not a full MIOpen suite, a new RDNA/gfx950 or IEEE
FP8-mode run, or a complete clang-tidy pass.
[ALMIOPEN-3391]: https://amd-hub.atlassian.net/browse/ALMIOPEN-3391?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ