Repository navigation
Shaders: lower s_abs_i32 through IMax - #3722
Ingenioeren wants to merge 1 commit into
Conversation
|
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
AI-assisted (Hy4 flash). |
|
I combined your exact The added regression uses All four focused tests passed on Windows WARP with Agility 1.620.2, including your instruction count and execution tests. Strict shader Clippy and the asset policy passed. @Ingenioeren, the integration test is available for merge coordination. Please retain the original Git authors when rebasing or cherry-picking. AI-assisted with OpenAI Codex. |
|
Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head
AI use: Claude Code (Claude Opus 5.5). |
s_abs_i32currently emits a signed comparison, negation and select. Emit the wrapping negation and DXILIMax(x, -x)instead: the expression falls from three instructions to two, and the dynamic-input synthetic shader falls from 17 written DXIL instructions to 16 (5.9%). This is an emitted-code reduction; no GPU-time or frame-rate gain is claimed.INT_MINremains0x80000000because its negation wraps to itself. SCC still comes from the result's nonzero test. DXIL defines IMax as signed integer maximum (opcode 37).The execution test uses a separate i64-magnitude reference and checks 32,848 inputs, both incoming SCC values, separate and overlapping scalar destinations, and the resulting SCC. Inputs cover ranges around zero, INT_MIN and INT_MAX, every single-bit/complement value, and deterministic random words. RX 6750 XT (driver 32.0.21045.29003) and WARP agree with the reference and each other before and after; DXIL validates.
Validation on fresh main
63bcca4:cargo test --locked --offline -p victory-shader scalar_abs_ -- --nocapture --test-threads=1fails the instruction-count assertion (17, expected 16); the execution test passes. With the change, both tests pass and the count is 16.cargo test --locked --offline -p victory-shader -- --test-threads=1: main 300 passed / 2 failed / 3 ignored; branch 302 passed / the same 2 failed / 3 ignored. The existing failures arerectangles_get_their_fourth_cornerandelements_sharing_a_row_keep_their_order, both local dxil.dll Pipeline State Validation mismatches.cargo test --locked --offline -p victory-shader --test resource_tracking: 3 passed, 1 ignored.cargo test --locked --offline -p victory-shader --doc: 0 tests.cargo clippy --locked --offline -p victory-shader --all-targets --all-features -- -D warnings: passes before and after.cargo run --locked --offline -p xtask -- policy --staged: passes (3 staged files).git diff --check: clean; changed files introduce no formatting deviations relative to main.No game files, extracted shaders or game execution were used. No graphics/mesh, wave64 numeric execution, frame-time measurement or RADV/vkd3d runtime validation was performed. This does not resolve or validate the separate RADV pipeline-compilation hold reported on #3027.
Searched all 1,802 open PR titles/bodies for
s_abs_i32and searched open/closed PRs for scalar abs/absolute value; no competing scalar-abs optimization found. The test-onlywritten_instructionshelper is identical to the one in #3691 and our other lowering PRs; keep one copy when integrating. Other production lowering is unchanged.AI assistance: prepared with OpenAI Codex, reviewed by Ingenioeren.