Repository navigation
Conversation
|
@eizispark, thanks again for the #761 pair. If you have time for more, these four of ours also only need the
I'll copy the blocks into each Regression run with credit. No pressure if you're busy. |
|
Test run of Tested
Review: ABS / NEG are applied on the bits (clear / flip the sign bit at the operand's width), which keeps NaN payloads and matches how the hardware applies float modifiers to moves and selects. I found nothing to change. Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Independent native Windows NVIDIA RTX 5080 (wave32) + D3D12 debug layer build/test run and code review at head Code Review
Tested
Not tested
AI use: Antigravity (Gemini 4 Neon reviewed the diff; Gemini 4 Hydrogen ran the RTX 5080 workspace tests) drafted this report. |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
Thanks @eizispark: both blocks are now in Regression run, credited. |
|
2| |
The VOP3, SDWA and DPP16 forms of v_mov_b32, v_cndmask_b32, v_cvt_f32_f16 and v_cvt_f64_f32 carry the ABS / NEG source modifiers, but these four arms used the raw source and dropped them, so `v_cndmask_b32_e64 v5, -v1, |v2|, vcc` selected v1 / v2 unchanged. The RDNA 2 ISA says of V_CNDMASK_B32 and V_MOV_B32 that floating-point modifiers are valid and the instruction "is suitable for negating or taking the absolute value of a floating-point value"; LLVM folds fneg / fabs of select operands into V_CNDMASK_B32_e64 (VOPSelectModsPat) and its MC tests encode these forms (gfx10_asm_vop2.s, gfx10_asm_vop1.s). The modifiers are applied on the sign bit (abs clears it, then neg flips it), as valu64 already does for f64 sources: the move and select stay untyped, so NaN payloads, -0 and denormals pass bit-exact. For v_cvt_f32_f16 they act on bit 15 of the f16 input, for v_cvt_f64_f32 on the f32 input. New GPU test gpu_abs_neg_on_move_select_and_conversions covers all four with NaN, -0 and denormal inputs; it fails on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The direct translator dropped the same modifiers as the HLSL path did. They act on the sign bit (Lw::sign_mod), on bit 15 of the f16 input of v_cvt_f32_f16 and on the f32 input of v_cvt_f64_f32. gpu_abs_neg_on_move_select_and_conversions failed with XCL_DIRECT_DXIL=1 at its first assertion and passes now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
228f8e9 to
fed16e7
Compare
The VOP3 (and SDWA / DPP16) forms of
v_mov_b32,v_cndmask_b32,v_cvt_f32_f16andv_cvt_f64_f32take the ABS / NEG source modifiers, and XCL dropped them on both backends: the four arms used the raw source, while every other float source goes throughfsrc/fh/f64v.v_cndmask_b32_e64 v5, -v1, |v2|, vccwith v1 = 1.0, v2 = -2.0 gave 1.0 / -2.0 where -1.0 / 2.0 is right.References: the RDNA 2 ISA says of
V_CNDMASK_B32andV_MOV_B32that floating-point modifiers are valid and the instruction "is suitable for negating or taking the absolute value of a floating-point value" (VOP2 opcode 1, VOP1 opcode 1, with the examplev_mov_b32 v0, -v1). LLVM foldsfneg/fabsof select operands intoV_CNDMASK_B32_e64(VOPSelectModsPat,SIInstructions.td), and its MC tests encodev_cndmask_b32_e64 v5, -v1, |v2|, vcc(gfx10_asm_vop2.s),v_cvt_f32_f16_e64 v5, -v1andv_cvt_f64_f32_e64 v[5:6], -v1(gfx10_asm_vop1.s). LLVM itself never puts modifiers onv_mov_b32(VOPProfile_MOVhas none); the ISA text is the only source for that one.The modifiers are applied on the sign bit, as
valu64already does for f64 sources (abs clears it, then neg flips it). The move and the select stay untyped, so a NaN keeps its payload and -0 and denormals pass bit-exact. Forv_cvt_f32_f16they act on bit 15 of the f16 input, forv_cvt_f64_f32on the f32 input.What is in it
crates/xcl/src/gpu/recomp/emit.rs: helpersign_mods, used by thev_mov_b32/v_mov_fed_b32,v_cndmask_b32andv_cvt_f32_f16arms ofvaluand thev_cvt_f64_f32arm ofvalu64.crates/xcl/src/gpu/dxil/lower_valu.rs,lower_wide.rs(second commit): the same on the direct translator.Lw::sign_modapplies abs / neg on the sign bit; it is used by thev_mov_b32/v_mov_fed_b32,v_cndmask_b32andv_cvt_f32_f16arms and byv_cvt_f64_f32invalu64.crates/xcl/src/gpu/recomp/tests.rs: GPU testgpu_abs_neg_on_move_select_and_conversions.v_cndmask_b32_e64 -v1, |v2|with VCC alternating per lane, on (1.0, -2.0), a quiet NaN with a payload against a negative signalling NaN, (-0, -0) and denormals;v_mov_b32_e64 -v1and-|v2|on the same inputs;v_cvt_f32_f16_e64 -vand|v|on 1.0, -0, -2.0, 0.5;v_cvt_f64_f32_e64 -vand|v|on 1.0, -0, -3.5, 0.25. All results compared as bits.Tested
maincbc296a(one conflict:mainchangedv_rcp_f64torcp_d; kept that). Atfed16e7: the new test passes withXCL_DIRECT_DXIL=0and1;gpu_tests 135 passed withXCL_DIRECT_DXIL=0, 134 passed and 1 failed with1. The failure isgpu_image_get_resinfo_1d_array, which fails onmaintoo (Direct DXIL: image_get_resinfo of a 1D array gives the layers in y #2046 fixes it).dxilunits: 151 passed.XCL_DIRECT_DXIL=1at its first assertion (lane 0v_cndmask_b32 -v1, |v2|gave0xC0000000, expected0x40000000).cargo test --workspace --no-fail-fast -- --test-threads=4on 228f8e9: 705 passed, 0 failed, 41 ignoredgpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64)main(d5442d2) without theemit.rschange, at its first assertion: lane 0v_cndmask_b32 -v1, |v2|gave0xC0000000(-2.0), expected0x40000000(2.0). It passes with the change.Regression run
On the first version (228f8e9, HLSL change only; the direct-path commit is newer). Run by @eizispark on an AMD Radeon RX 9070 XT (posted in this PR's comments; we have no retail title here).
main:
PR:
Not tested
v_mov_b32: the ISA says so, but no compiler I could check emits it.Modsand now the same path, but the test uses VOP3 only.AI use
🤖 Generated with Claude Code