[rocjitsu] Ignore VOP3P prefix neg/neg_hi bits on cdna4 V_MFMA_SCALE_F32_*_F8F6F4 #17158
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.55) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 562 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.379
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #17158"
general
weight: 0.35
kuhar
Motivation
ENC_VOP3PX2in the CDNA4 ISA XML inherits the genericVOP3PNEG(w1[31:29]) andNEG_HI(w0[10:8]) bitfields on the first 64-bit word (v_mfma_ld_scale_b32). Based on that XML definition,cdna4's generatedv_mfma_scale_f32_{16x16x128,32x32x64}_f8f6f4decoder previously rejected encodings with non-zeroneg[1:0]/neg_hi[1:0], andexecute_impldecodedwmma_c_modifier((raw_words_[1] >> 29) & 7u, (raw_words_[0] >> 8) & 7u)to negate or take the absolute value of accumulatorC(which also caused strictBitExactEmpirical*execution to reject non-zerow0[10]/w1[31]).Sweeping 16 sampled
(neg, neg_hi)pairs out of the8 × 8(64) prefix modifier space —(0,0),(4,0),(0,4),(4,4),(1,0),(0,1),(1,1),(2,0),(0,2),(2,2),(3,0),(7,0),(0,7),(7,7),(5,2), and(6,5)— across 1016x16x128and32x32x64format, scale-byte, andMODE.FP16_OVFLconfigurations (32waves =2,048lanes each) on physical MI350X (AMD Instinct MI350X OAM,gfx950, ROCm 7.2.4 / HIP 7.2.53211) establishes thatv_mfma_ld_scale_b32ignoresVOP3Pneg[2:0]andneg_hi[2:0]:(neg, neg_hi)pair executes withoutILLEGAL_INSTorTRAPSTSflags (0x00) and produces 100% bit-identical output to(0, 0)(0word differences acrossA,B,C,scale_a, andscale_b). In particular, the two cases that independently set the formerCmodifiers on16x16x128(va=v[0:7],vb=v[8:15],vd=src2=v[16:19],vsa=v32,vsb=v33) match base(0, 0)(.long 0xD3AC0000, 0x00024320, 0xD3AD0810, 0x04421100):-
(4, 0)(w1[31] = 1, formerc_neg):.long 0xD3AC0000, 0x80024320, 0xD3AD0810, 0x04421100-
(0, 4)(w0[10] = 1, formerc_abs):.long 0xD3AC0400, 0x00024320, 0xD3AD0810, 0x04421100gfx950MC layer (llvm-mc --triple=amdgcn -mcpu=gfx950) likewise rejects-src2/|src2|/neg_lo/neg_hioperands in assembly and ignoresw0[10:8]andw1[31:29]when disassemblingENC_VOP3PX2.Technical Details
lib/python/amdisa/codegen/_generator.py, regeneratedcdna4/decoder.cppandcdna4/vop3p_exec.cpp):- Remove the
(neg & 0x3u) == 0 && (neg_hi & 0x3u) == 0rejection fromisValidMfmaScaleF8f6f4while retaining scale-selector andcbsz/blgp <= 4validation.- Stop decoding
wmma_c_modifierfromraw_words_[0:1]inVMfmaScaleF32{16x16x128,32x32x64}F8f6f4Vop3px2::execute_impl, passingcontrols = inst_.cbsz | (uint64_t(inst_.blgp) << 3)across all semantics.- Keep
rj-arith's syntheticRJ_ARITH_MFMA_SCALE_NEG_C/RJ_ARITH_MFMA_SCALE_ABS_CC-API flags unchanged for library callers.Issue Tracking
Follow-up to #16887 and #13670 (
rj-arith).Test Plan
amdisagenerator tests (test_generator_profile_gates.py):- Verify
cdna4decoder.cppno longer gatesENC_VOP3PX2onneg/neg_hiandcdna4vop3p_exec.cppno longer emitswmma_c_modifier.tests/instruction_execution_harness_test.cpp):-
Cdna4BlockScaleMfmaDecodeTest.RejectsReservedFormatsAndAcceptsPrefixModifierBits: verifies reserved formats5..7still fail decode while all8 × 8(neg, neg_hi)prefix bit combinations decode as 16-bytev_mfma_scale_f32_{16x16x128,32x32x64}_f8f6f4instructions.-
Cdna4BlockScaleMfmaExecutionTest.PrefixModifierBitsAreIgnoredAcrossAllSemantics: verifies acrossCompatibility,Loose,BitExactEmpiricalNoFpStatus, andBitExactEmpirical, both16x16x128and32x32x64shapes, signed non-equalA/B(-1.0×+1.0), negative VGPR accumulator (-3.0f), and negative inline constant accumulator (-1.0ftested separately under(4, 0),(0, 4), and(4, 4)) that prefixnegandneg_hibits leave inputs and accumulators unmodified.Test Result
Verified on Linux x86-64 Zen 4 (
-fno-exceptions,-DRJ_ENABLE_EXPENSIVE_CHECKS=ON):Debugrj_arithbaseline_linkage:2 / 2passedReleaselib/arithctest:3,639 / 3,639passedReleaserocjitsuctest:19,432 / 19,432passed (includingCdna4BlockScaleMfmaDecodeTest.RejectsReservedFormatsAndAcceptsPrefixModifierBitsandCdna4BlockScaleMfmaExecutionTest.PrefixModifierBitsAreIgnoredAcrossAllSemantics)amdisapytest:6,265passed,41skippedSubmission Checklist