Shaders: lower s_brev_b64; test the scalar 64-bit operations against their definitions #639
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!639
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-639"
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?
@Gruzzberry on GitHub · 2026-11-25 03:40 UTC · original
Gruzzberry:gz/scalar64-isa→main· +93 −0 · 2 files · 1 commits · openSummary
s_brev_b64has no lowering, so a program using it is refused asUnsupported { what: "s_brev_b64" }and its pipelines are dropped, whiles_brev_b32and the rest of the 64-bit scalar logic are lowered. Bit i of the pair goes to bit 63 - i: each half is reversed and the halves swap. This adds that, and a test that runs the 64-bit scalar operations against the definitions in the RDNA2 instruction set document.What is in it
crates/victory-shader/src/emit/lower.rs: a"s_brev_b64"arm in the 64-bit scalar block (about a dozen lines):unary.i32bit reverse of each half, written to the other half. It sets no SCC, as the document says.crates/victory-shader/src/emit/valu_tests.rs:scalar_64_bit_operations_match_the_rdna2_definitionsrunss_and/or/xor/andn2/orn2/nand/nor/xnor_b64,s_not_b64,s_brev_b64, the three shifts (s_lshl_b64,s_lshr_b64,s_ashr_i64: the count is the low six bits of the second operand, with counts from 0 to 65 and0xffffffc1) ands_bcnt1_i32_b64/s_ff1_i32_b64on the pairss[0:1]ands[2:3]as one-thread compute shaders over 180 cases built from the sign and carry edges of the halves, comparing both result dwords with the definition in Rust, on the hardware adapter and WARP. Everything buts_brev_b64agreed on the first run.Before the lowering the test stops at
lower: Unsupported { offset: 36, what: "s_brev_b64" }; with it all fifteen operations agree on WARP.Does the title use it?
No:
victory translateover the whole shader pack (26,148 programs, base2119b0e) refuses none for this instruction. The change is coverage, the test is the point. If you would rather have the test alone, drop thelower.rshunk and thes_brev_b64row.Left out on purpose because open PRs lower them:
s_bcnt0_i32_b64(#171),s_flbit_i32_b64ands_ff0_i32_b64(#233).Tested
c96b4f2, one commit.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean. Without--all-featuresit fails onc96b4f2itself (placed_filler_twinsinvictory-gpu/src/resource.rsis never used); this change adds no warning.cargo xtask policy: 169 files ok.cargo test --workspace --lockedon the RTX 4070 (default adapter, run directly):victory-shader213 passed, 2 failed (emit::rect::tests::the_rectangle_stage_is_a_geometry_shaderandrectangles_are_drawn_whole, the PSV0 validator issue of #61); every other crate passes.c96b4f2without this change: 212 passed, the same 2 failed.VICTORY_WARP=1 cargo test --workspace --locked(every GPU test on WARP):victory-shader209 passed, 6 failed. The same 6 fail onc96b4f2(208 passed): the twoemit::rectones, andds_min_max_f32_order_floats_and_return_the_old_value,v_permlane16_and_x16_read_the_lanes_their_selectors_pick,whole_wave_f64_sum_and_cvt_f32_f64anda_lane_mask_joined_with_a_number_is_read_as_the_number_it_is, which need a 32-lane device thatVICTORY_WARP=1takes away. No new failure.Not tested
EXEC/VCCuse goes through the mask paths).s_bfe_u64,s_bfe_i64,s_bfm_b64,s_bitset*_b64and the 64-bit compares.AI use
Claude Code (Claude Sonnet 5.5) wrote the lowering and the test and ran the checks above on my machine. The reference functions follow the RDNA2 instruction set document. Nothing is taken from the game.
🤖 Generated with Claude Code
🤖 Generated with Claude Code
@HAL9000RELOADED on GitHub · 2026-11-25 13:00 UTC · original
An AMD run of this PR's new tests.
scalar_64_bit_operations_match_the_rdna2_definitionspasses on a Radeon RX 7900 XTX (RDNA3), Windows 10 22H2, with the Agility SDK runtime from #402. They ran on the hardware device; WARP skips on this machine. Nothing else in the workspace regresses.The setup, and the same run for eight related shader PRs, are in one table on #637: #637
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.