Repository navigation
Conversation
|
Tested
No game data used. |
|
Coordination note after testing the queue: this branch already lowers instructions that other open PRs cover, in
The branch passes on Linux ( No game data used. |
|
Thanks for testing, and for the coordination note. I went through the open single-opcode PRs and compared each diff with this branch. Of the 106 instructions here, 38 are also in another open PR and 68 are only here.
So this branch does cover #171 too (the note above lists it as separate). #169 and #173 are indeed untouched. One real disagreement, with #171 on the carry-out of I would rather not call any of those PRs redundant myself, since that is the maintainers' call and the small ones are easier to review. Either order works for me:
No game data used. |
|
The audit is useful. A few overlaps beyond the ones listed in the description, from PRs opened since: #165 ( Separately, #168 fixes SCC for Static review, not built or run. |
|
Follow-up on the
So the flag is bit 64 of the sum of the operands widened to 65 bits (sign-extended in the signed form), not signed overflow of the 64-bit add. For While checking the other overlaps against the same documents I also found a mistake of my own in #160 (a16 does not make derivatives 16-bit on GFX10.3) and fixed it there. Nothing else in this PR changed. No game data used. |
…d compares) into the integration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
|
@Sunkiller-qc a late answer to your second point: agreed. A trial merge ( Three more overlaps from PRs opened since, now in the description:
Trial merges only; nothing was built or run for this note. AI-assisted. |
Synthesize one compute fixture per opcode table entry and run the translation passes. Diagnose refused instructions even when their results are unused, and identify opcode panics or timeouts in an isolated test process. List the refused set and provide an opt-in report grouped by encoding and reason. An opcode that stops lowering fails the regular test; one that starts lowering only makes its line stale, so changes that lower opcodes need not touch the list. The baseline covers 1,233 entries without game data.
Add scalar bit counts, searches, field and packing operations, and vector integer multiply-adds, SADs, dot products and saturating conversions. Use IEEE bits for frexp, class and double compares so NaNs, signed zeros and denormals survive. Add synthetic compute tests with live DXIL results compared against CPU references. Validate the shaders with the Windows SDK validator and run them on the RTX 5070. The opcode audit moves 106 mnemonics from refused to lowered.
ce1f138 to
6035910
Compare
Measured on the title's shaders (by a tester)
EduAzevedo ran
victory translate --jobs 8 --listover the retail shaders (v1.0.2.1, 26,148 programs) onmaind2a4baeand on this headce1f138, compared program by program (result): 0 programs gained, 0 programs lost. The only change is the refusal reason of the 4 programs that usev_cvt_f32_f64: they now stop atfloating-point arithmetic in f64 is not implemented by the DXIL emitter.So this PR does not change what translates in this title today. It adds coverage and is tested on synthetic programs only; it can wait behind PRs that unblock programs the title uses.
Rebased onto
main7c8cecb(2026-11-24)#117 (
s_bitcmp*) and #140 (v_cmp_class_f16) merged and conflicted with this branch inemit/lower.rs. As promised under Overlap, this branch now keeps their lowering and drops its own for those six instructions (s_bitcmp{0,1}_b{32,64},v_cmp_class_f16,v_cmpx_class_f16), so it adds 100 instructions instead of 106. This branch's GPU tests for those six still run, now against the merged code, and pass on the RTX 5070. Head6035910; the measurement above was taken on the earlier head.What
One instruction the translator refuses fails its whole shader, and nobody had a list of which instructions those are. Two commits:
1. An audit. For every entry of the opcode table, a test assembles one compute fixture containing that instruction, runs it through
ir::build→resource→io→structure→lower, and records whether it lowers or which pass refuses it and why. The audit runs in a child test process with a per-case timeout, so a panic, stack overflow or hang names its opcode. It found none.cargo test -p victory-shader opcode_coverage_table -- --ignored --nocaptureprints the table grouped by encoding and reason.refused_opcodes(a regular test) compares againstopcode_refusals.txt. An opcode that stops lowering fails it. One that starts lowering only makes its line stale and prints a note, so other PRs that lower opcodes need not touch the list.2. 100 more instructions lower (the list goes from 500 to 400 entries on
main7c8cecb):s_absdiff_i32,s_bcnt0_i32_b{32,64},s_bfe_{i,u}64,s_bfm_b64,s_bitreplicate_b64_b32,s_bitset{0,1}_b64,s_brev_b64,s_ff0_i32_b{32,64},s_flbit_i32_{b64,i64},s_pack_{ll,lh,hh}_b32_b16,s_sext_i32_i{8,16}.v_mul_hi_{i32_i24,u32_u24},v_mad_{i16,u16,i32_i16,u32_u16,i64_i32,u64_u32},v_{min3,max3,med3}_{i16,u16},v_sad_{u8,hi_u8,u16,u32},v_msad_u8,v_qsad_pk_u16_u8,v_mqsad_pk_u16_u8,v_mqsad_u32_u8,v_lerp_u8.v_dot2_{i32_i16,u32_u16},v_dot4_{i32_i8,u32_u8},v_dot4c_i32_i8,v_dot8_u32_u4,v_cvt_off_f32_i4,v_cvt_pk_{i16_i32,u16_u32},v_sat_pk_u8_i16.frexpmantissa and exponent for f16/f32/f64, class compares for f64, the 16 f64 comparison predicates, and the always-false/true i64/u64 compares (v_cmpandv_cmpx), all on IEEE bits so NaNs, signed zeros and denormals survive.Left refused with a reason, because rounding, exceptional values or carries could differ from the hardware:
ldexp, the normalized conversions, half FMA and half dot products,v_mullit_f32, general f64 arithmetic.Not verified
No game files were used. Semantics are from AMD's RDNA 2 ISA reference and LLVM's AMDGPU backend; the GPU tests compare against CPU references written from the same documents, so they catch translation mistakes, not a misreading of the documents.
Overlap
s_bitcmp*,s_sext_*), Shaders: lower s_absdiff_i32, s_sext_i32_i8/i16 and s_pack_ll/lh/hh_b32_b16 #120 (s_absdiff_i32,s_sext_*,s_pack_*), Shaders: lower v_cmp_class_f16 and v_cmpx_class_f16 #140 (v_cmp_class_f16), Shaders: lower s_bcnt0_i32_b32/_b64, s_ff0_i32_b32/_b64 and s_flbit_i32_b64/_i64 #148 and Shaders: lower s_bcnt0_i32_b32/b64 and s_ff0_i32_b32/b64 #165 (s_bcnt0_*,s_ff0_*,s_flbit_*64), Shaders: lower v_mul_hi_u32_u24 and v_mul_hi_i32_i24 #156, Shaders: lower 24-bit mul_hi, saturating 16-bit packs, integer dot pr… #157 and Shaders: lower v_sad_u8, v_sad_hi_u8, v_sad_u16, v_sad_u32 and v_msad_u8 #162 (v_mul_hi_*24), Shaders: lower 24-bit mul_hi, saturating 16-bit packs, integer dot pr… #157 (v_cvt_pk_*, integer dots), Shaders: lower v_sad_u8, v_sad_hi_u8, v_sad_u16, v_sad_u32 and v_msad_u8 #162 (v_sad_*,v_msad_u8), Shaders: lower s_bitset{0,1}_b64, s_brev_b64 and s_bitreplicate_b64_b32 #166 (s_bitset*_b64,s_brev_b64,s_bitreplicate_b64_b32), Shaders: lower v_mad_u64_u32 and v_mad_i64_i32 #171 (v_mad_{u64_u32,i64_i32}). I compared each diff with this branch: the results agree except the carry-out ofv_mad_i64_i32(Shaders: lower v_mad_u64_u32 and v_mad_i64_i32 #171 computes signed overflow, this branch bit 64 of the 65-bit result); see the comment below.emit/lower.rs; Shaders: lower v_dot2_f32_f16 and v_dot2c_f32_f16 #465 lowersv_dot2_f32_f16andv_dot2c_f32_f16, which stay refused here; shader: lower v_sat_pk_u8_i16 #499 lowersv_sat_pk_u8_i16, also lowered here (not compared). Shaders: SCC of s_min, s_max and s_lshl1-4_add_u32 as the ISA sets it #168 changes the SCC ofs_min,s_maxands_lshl1-4_add_u32; it merges cleanly into this branch and its version should win.s_cmov*) and Shaders: lower v_add_nc_i32, v_sub_nc_i32, v_mul_lo_i32 and the signed 16-bit add and sub #92 (v_add_nc_i32,v_sub_nc_i32,v_mul_lo_i32, signed 16-bit add/sub) are deliberately not included and stay on the list.Tested
Windows 11, NVIDIA RTX 5070, synthetic only:
dxil.dllvalidation).cargo test -p victory-shaderat6035910: 89 passed, 3 ignored. The audit test takes about 40 s.cargo clippy -p victory-shader --all-targets: nothing new.cargo xtask policy: ok.The title was not used in these tests. AI-assisted.
🤖 Generated with Claude Code