Shaders: lower RDNA2 LDS integer atomics #1278

Closed
spk-c wants to merge 4 commits from upstream-pr/1281 into main
spk-c commented 2026-11-26 10:10:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by spk-c on 2026-11-26T10:10:51Z.


AI-assisted change.

Summary

Lower ds_inc_u32, ds_dec_u32, ds_rsub_u32 and ds_mskor_b32, including their returning forms. INC and DEC use DATA0 as an unsigned limit. Reverse subtraction wraps modulo 2^32, and masked OR clears DATA0 bits before OR-ing in DATA1. The returning forms deliver the old value observed by the successful compare-exchange.

The synthetic reference cases cover unsigned boundaries, operand order, result and return values, and contention. AMD RDNA2 ISA, section 12.13.

Validation

  • Passed on this branch: shader Clippy with all targets and warnings denied, asset policy, and three synthetic lowering tests.
  • Four SM 6.6 value tests were explicitly ignored in the run on this branch: INC/DEC limits and returns, contended INC/DEC returns, reversed subtraction, and masked OR. The corresponding tests ran successfully on hardware on the audited fork with a verified app-local Agility SDK. That result is separate from validation on this PR head.

Update against upstream 06702fe

Merged upstream without rewriting history. Kept the upstream dispatch-spread regression and the seven existing LDS integer tests. Moved the integer compare-exchange helper into emit/lds_integer.rs so lower.rs stays below the existing 512 KiB asset-policy limit (522,453 bytes); no policy changes. Removed an unreachable add_f32 match alternative; existing floating-point lowering is unchanged.

Exact head c19964c29d0e0a3a8ead26c640fd9d692e70942d passed local Windows Rust 1.98.1 workspace Cargo Check, strict Clippy (ordinary and all-features), the three synthetic integer lowering tests, and asset policy (221 files). Total elapsed 12.95 seconds. The four SM 6.6 integer value tests are still ignored by default on this submission. A broader LDS-related run before the module extraction hit the existing float-atomic test's no SM 6.6 device available failure with the Windows 10 inbox runtime. No new hardware result or performance claim. AI-assisted.

Current upstream integration (52ac4ec)

Merged current upstream without rewriting history. New head 74e3ac145dfb333c2b4c37aa4dd924e0c8a9ddaa. Preserved the upstream halves and dispatch_threads modules alongside lds_integer. Clean local Windows workspace check and Clippy (all targets/all features, warnings denied), three focused INC/DEC, RSUB and MSKOR lowering regressions, and diff check passed. The four SM 6.6 value tests were not rerun. Full asset policy remains blocked by upstream's existing oversized source files (#1357); no policy bypass. AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5508039521 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1281). Originally posted by [spk-c](https://github.com/spk-c) on 2026-11-26T10:10:51Z. --- AI-assisted change. ## Summary Lower `ds_inc_u32`, `ds_dec_u32`, `ds_rsub_u32` and `ds_mskor_b32`, including their returning forms. INC and DEC use DATA0 as an unsigned limit. Reverse subtraction wraps modulo 2^32, and masked OR clears DATA0 bits before OR-ing in DATA1. The returning forms deliver the old value observed by the successful compare-exchange. The synthetic reference cases cover unsigned boundaries, operand order, result and return values, and contention. [AMD RDNA2 ISA, section 12.13](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf). ## Validation - Passed on this branch: shader Clippy with all targets and warnings denied, asset policy, and three synthetic lowering tests. - Four SM 6.6 value tests were explicitly ignored in the run on this branch: INC/DEC limits and returns, contended INC/DEC returns, reversed subtraction, and masked OR. The corresponding tests ran successfully on hardware on the audited fork with a verified app-local Agility SDK. That result is separate from validation on this PR head. ## Update against upstream `06702fe` Merged upstream without rewriting history. Kept the upstream dispatch-spread regression and the seven existing LDS integer tests. Moved the integer compare-exchange helper into `emit/lds_integer.rs` so `lower.rs` stays below the existing 512 KiB asset-policy limit (522,453 bytes); no policy changes. Removed an unreachable `add_f32` match alternative; existing floating-point lowering is unchanged. Exact head `c19964c29d0e0a3a8ead26c640fd9d692e70942d` passed local Windows Rust 1.98.1 workspace Cargo Check, strict Clippy (ordinary and all-features), the three synthetic integer lowering tests, and asset policy (221 files). Total elapsed 12.95 seconds. The four SM 6.6 integer value tests are still ignored by default on this submission. A broader LDS-related run before the module extraction hit the existing float-atomic test's `no SM 6.6 device available` failure with the Windows 10 inbox runtime. No new hardware result or performance claim. AI-assisted. ## Current upstream integration (52ac4ec) Merged current upstream without rewriting history. New head `74e3ac145dfb333c2b4c37aa4dd924e0c8a9ddaa`. Preserved the upstream halves and dispatch_threads modules alongside lds_integer. Clean local Windows workspace check and Clippy (all targets/all features, warnings denied), three focused INC/DEC, RSUB and MSKOR lowering regressions, and diff check passed. The four SM 6.6 value tests were not rerun. Full asset policy remains blocked by upstream's existing oversized source files (#1357); no policy bypass. AI-assisted.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1278
No description provided.