shader: lower v_div_fixup_f64 in the direct compute path (#3518) #3879
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3879
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3877"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ammmae0x on GitHub · 2026-12-02 17:34 UTC · original
Ammmae0x:shader/direct-div-fixup-f64→main· +845 −0 · 6 files · 1 commits · draftRefs #3520, #2935
Lowers
v_div_fixup_f64(VOP30x160, RDNA 2 ISA section 12.12, opcode 352) in the direct C++ compute path only (#3673coverspixel_aot; this PR does not touch it).What landed — single commit on
shader/direct-div-fixup-f64, offorigin/mainb68e954c, pushed to the fork with no force-push. 6 files, +845/-0:src/gfx1013_direct_compute.inl— pure 32-bit integer (uint2lo/hi words; no DXILdouble, noi64, nofcmp, noDoublePrecisionFloatShaderOps/Int64ShaderOps) lowering in precedence order:Quiet(S2),Quiet(S1),0/0andInf/Inf->0xfff80000_00000000,S1 == 0 || S2 == Inf-> signed Inf,S1 == Inf || S2 == 0-> signed 0,exponent(S2) - exponent(S1) < -1075-> signed 0, else(sign(S1) ^ sign(S2)) | abs(S0). Guards: direct-compute VOP3 only (!pixel_stage && !graphics_input,!i.widerefused,!i.subword,!i.dpp_control,!permuted,!i.scale,(i.a & 0x7800)refused), default binary64 rounding/denormal MODE check likev_fract_f64/v_min_f64(and the op is now in thehalf_binaryMODE-tracking list), aligned 64-bit VGPR dst, aligned 64-bit VGPR/SGPR pair sources + inline0(128) and inline binary64 constants240..247,abs/negon bit 31 ofhi,clamphandled like the f32 form (NaN or negative ->+0.0, above1.0->1.0). Everything outside the contract is refused with the exact messages the fixture pins.src/gfx1013_compute_native.cpp—clear_vector_spillstreatsv_div_fixup_f64as a 2-VGPR pair write.tests/native_div_fixup_f64_check.py(model/ir/controls/hardware) +tests/cmake/native_div_fixup_f64.cmake+tests/checks/python-linux/native_div_fixup_f64.txt— 24 boundary triples (NaN quieting and S2-over-S1 priority,0/0,Inf/Inf, signed Inf/zero rules,-0/+0, subnormals,exp(S2)-exp(S1)at-1075vs-1076, abs/neg, SGPR + VGPR + inline constants) plus a seeded sweep of 120 triples, plain and clamped; 15 refusal controls (omod, op_sel, literal/inline-129/239/248 sources, odd SGPR pair, VCC/EXEC pair, v255 source/destination, flushing and conditional MODE, spills in v10/v11) and 6 self-mutation controls (sign XOR, invalid, NaN priority, underflow, clamp, quieting).docs/experiments/native-direct-div-fixup-f64.md— semantics, fixture, and the exponent note below.Exponent semantics (flagged explicitly): "exponent" is the stored biased exponent field, as in the in-repo
v_div_fixup_f32lowering (a subnormal reads 0, not its normalized exponent). The two readings agree for every normal operand and for a subnormalS1, and differ only for a subnormalS2against anS1whose stored field is 1076 (stored diff-1076, normalized diff-1075). No case pins that one pair, so a hardware reading can arbitrate it; the fixture covers subnormalS2at stored diffs-1023and-2046(both readings agree) and the normal-operand boundary at-1075(pass-through) versus-1076(underflow). There is nopixel_aotimplementation of this op in-tree to cross-check against yet (#3673is the separate task).Linux verification (this host cannot run Windows CTest, DXC, or D3D12):
python -B tests/native_div_fixup_f64_check.py model— PASS: 144 triples x plain/clamp matched the independentfrexp-based reference on 262 non-subnormal checks (26 subnormal checks use the stored-field rule); 6 self-mutations killed.tools/disasm_rdna2.pyasv_div_fixup_f64 v[10:11], v[2:3], v[4:5], v[6:7](SGPR/inline/abs/neg/clamp forms in the e64 chunk decode as intended); all 15 refusal encodings decode as intended.python -B tests/form_coverage_check.py— PASS (with the repo venv; system Python lacksiced_x86);python -B tests/docs_links_check.py— PASS (251 files, 954 links);python -B tests/bidi_controls_check.py— PASS (2996 files);tests/run_checks_parallel_check.py— ok; the model command is registered exactly once in the Linux CI list.git diff --checkclean;git merge-tree --write-tree origin/main HEADexits 0.ir,controls, andhardwaremodes need the Windows DXIL toolchain and are not verified on Linux.WIN-VERIFY: pending | sha=9d8ff7156f8cb2347785a2202f4ed8dda5ffa23b | targets=native_compute_ir_dump compile_dxil native_store_replay | ctest=^native_div_fixup_f64_(ir|controls|hardware)$ | release=true
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.