compute: classify SCC-neutral SOP1 ops in the direct SCC liveness #3191

Manually merged
github merged 1 commit from github-bot/gh-3189 into gh-pr/3189/base 2026-11-27 21:43:25 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-27 20:54 UTC · original
Leyukaka:scc-sop1-preserve → main · +26 −4 · 2 files · 1 commits · merged 2026-11-27 21:41 UTC

Fixes #3176. Part of #2935. Target branch main.

Change (src/gfx1013_direct_compute.inl, DirectCompute::uses_scc_after): SOP1 ops that the direct path lowers are classified by their SCC behaviour, instead of every SOP1 outside a short list being treated as an unknown SCC reader.

  • SCC-neutral, so liveness passes through: s_ff0/s_ff1 (b32, b64), s_flbit (b32, b64, i32, i64), s_brev (b32, b64), s_sext_i32_i8/_i16, s_bitset0/s_bitset1 (b32, b64) and s_bitreplicate_b64_b32.
  • SCC writers: s_abs_i32, the 32-bit s_bcnt0/s_bcnt1, and the remaining b64 saveexec forms (xor, andn2, orn2, nand, nor, xnor).
  • Unclassified ops keep the conservative rule. s_cmov is not touched; merged with main, #3071's SCC-reader entry for s_cmov_b32/_b64/s_cmovk_i32 is kept.

An SCC written by a byte-window descriptor rewrite was kept live past such ops, for example s_ff1_i32_b64. It was then refused as "numeric SCC from a symbolic descriptor field".

Tests. The setup was Windows 11 build 26300.9974 with an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and DXC from the Windows SDK 10.0.26100, on main 0f3e8248 plus this commit.

  • native_direct_container adds two compile cases:
    • the byte-window rewrite followed by s_ff1_i32_b64 and s_brev_b32 now compiles;
    • the same rewrite followed by s_cselect_b32 reading SCC is still refused.
  • native_salu* and native_bytewin* pass. native_scalar_lds_hardware fails with "native compute PSO creation failed", as it does on main without this change.
  • Mutation check, run by hand: dropping s_ff1 from the SCC-neutral set fails native_direct_container.

Measured on a local capture (counts and instruction shape only) with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests. The baseline is main 6057071b, and the change is on 0f3e8248; the commits in between do not touch the two native source files.

  • 13 of 2,689 requests stop first at "numeric SCC from a symbolic descriptor field", and 6 of them move with this change:
    • 1 compiles (403 to 404);
    • 3 stop at "direct descriptor address outside bound table";
    • 2 stop at s_ff1_i32_b64 with an EXEC source, which stays refused.
  • No request that compiled before stops compiling. The requests of one start-up run go from 416 to 417.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-27 20:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3189) `Leyukaka:scc-sop1-preserve` → `main` · +26 −4 · 2 files · 1 commits · merged 2026-11-27 21:41 UTC Fixes #3176. Part of #2935. Target branch `main`. **Change** (`src/gfx1013_direct_compute.inl`, `DirectCompute::uses_scc_after`): SOP1 ops that the direct path lowers are classified by their SCC behaviour, instead of every SOP1 outside a short list being treated as an unknown SCC reader. - **SCC-neutral**, so liveness passes through: `s_ff0`/`s_ff1` (b32, b64), `s_flbit` (b32, b64, i32, i64), `s_brev` (b32, b64), `s_sext_i32_i8`/`_i16`, `s_bitset0`/`s_bitset1` (b32, b64) and `s_bitreplicate_b64_b32`. - **SCC writers:** `s_abs_i32`, the 32-bit `s_bcnt0`/`s_bcnt1`, and the remaining b64 saveexec forms (xor, andn2, orn2, nand, nor, xnor). - Unclassified ops keep the conservative rule. `s_cmov` is not touched; merged with `main`, #3071's SCC-reader entry for `s_cmov_b32`/`_b64`/`s_cmovk_i32` is kept. An SCC written by a byte-window descriptor rewrite was kept live past such ops, for example `s_ff1_i32_b64`. It was then refused as "numeric SCC from a symbolic descriptor field". **Tests.** The setup was Windows 11 build 26300.9974 with an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and DXC from the Windows SDK 10.0.26100, on `main` `0f3e8248` plus this commit. - `native_direct_container` adds two compile cases: - the byte-window rewrite followed by `s_ff1_i32_b64` and `s_brev_b32` now compiles; - the same rewrite followed by `s_cselect_b32` reading SCC is still refused. - `native_salu*` and `native_bytewin*` pass. `native_scalar_lds_hardware` fails with "native compute PSO creation failed", as it does on `main` without this change. - Mutation check, run by hand: dropping `s_ff1` from the SCC-neutral set fails `native_direct_container`. **Measured on a local capture** (counts and instruction shape only) with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`. The baseline is `main` `6057071b`, and the change is on `0f3e8248`; the commits in between do not touch the two native source files. - 13 of 2,689 requests stop first at "numeric SCC from a symbolic descriptor field", and 6 of them move with this change: - 1 compiles (403 to 404); - 3 stop at "direct descriptor address outside bound table"; - 2 stop at `s_ff1_i32_b64` with an EXEC source, which stays refused. - No request that compiled before stops compiling. The requests of one start-up run go from 416 to 417. AI-assisted.
uses_scc_after() treated every SOP1 outside a short list as an unknown
SCC reader, so an SCC produced by a byte-window descriptor rewrite was
kept live past s_ff1_i32_b64 and refused as "numeric SCC from a symbolic
descriptor field". The scans and bit edits that neither read nor write
SCC (s_ff0/s_ff1, s_flbit, s_brev, s_sext, s_bitset0/1, s_bitreplicate)
now pass liveness through; s_abs_i32 and the 32-bit counts overwrite it,
the remaining b64 saveexec forms join the mask writers.
Unclassified ops keep the conservative rule.

native_direct_container compiles the rewrite followed by s_ff1_i32_b64
and s_brev_b32, and still refuses it when s_cselect_b32 reads SCC after
the scan.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:59:06 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-27 21:14 UTC · original

LGTM on the code quality and test coverage. The SCC liveness improvements are solid, and the re-added s_cmov* / 64-bit comparison paths look correct.\n\nNote: This PR re-adds s_cmov_b32, s_cmov_b64, s_cmovk_i32, and 64-bit scalar comparisons (s_cmp_eq_u64, etc.) which were removed in #3194. Please coordinate with the author of #3194 to ensure these changes don't conflict on merge, or clarify if one PR supersedes the other.

**@⁠KelboLive** on GitHub · 2026-11-27 21:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3189#issuecomment-7228261397) LGTM on the code quality and test coverage. The SCC liveness improvements are solid, and the re-added `s_cmov*` / 64-bit comparison paths look correct.\n\n**Note:** This PR re-adds `s_cmov_b32`, `s_cmov_b64`, `s_cmovk_i32`, and 64-bit scalar comparisons (`s_cmp_eq_u64`, etc.) which were removed in #3194. Please coordinate with the author of #3194 to ensure these changes don't conflict on merge, or clarify if one PR supersedes the other.
github-bot force-pushed github-bot/gh-3189 from 1eac9682e2 to e6e108386b 2026-11-27 21:23:43 +00:00 Compare
github-bot changed target branch from main to gh-pr/3189/base 2026-11-27 21:43:22 +00:00
github manually merged commit e6e108386b into gh-pr/3189/base 2026-11-27 21:43:25 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 21:41 UTC · original · approved these changes

Independently reviewed e6e10838. An SCC-preserving SOP1 now passes liveness through to actual readers; known writers stop propagation unless the instruction explicitly reads SCC. The paired descriptor controls verify that the unused symbolic SCC is accepted and a later SCC read through a scan still refuses. The proposed #3194 head composes cleanly and keeps #3071’s conditional moves and #3081’s scalar comparisons.

Built compile_dxil native_store_replay native_compute_ir_dump in Debug and Release over d99e0ae4 plus #3192 (tree 8afd409a70773b17d781bfe034b03dc5dd6f0ff9). ctest --test-dir <build> --no-tests=error -j 1 -V -R '^native_(direct_container$|(salu_(cmov|cmp64|bitscan64)|s_quadmask)_.*)' passed 11/11 in each configuration. Rebuilt Release over actual main afe70bd7 (tree 51db1e8c4c331c0862a4c2d979e196adaf83b52b) and the same 11 passed. I also built native_sampler_heap for #3142's adjacent suite. Its first run reported an iostream error in the temporary directory; rerunning ^native_sampler_heap_(warp|hardware)$ with a shorter temp path passed all 69 hardware assertions. WARP returned capability skip 77 because it has no wave32. Combined Release result on current main is 12 passes, 1 capability skip.

NVIDIA GeForce RTX 4060 Laptop driver 32.0.16.1656, Windows build 26200.9974, SDK/DXC 10.0.26100.0. git diff --check HEAD^1 HEAD and required hosted checks passed.

**@⁠R0Y00** on GitHub · 2026-11-27 21:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3189#pullrequestreview-6093571153) · **approved these changes** Independently reviewed `e6e10838`. An SCC-preserving SOP1 now passes liveness through to actual readers; known writers stop propagation unless the instruction explicitly reads SCC. The paired descriptor controls verify that the unused symbolic SCC is accepted and a later SCC read through a scan still refuses. The proposed #3194 head composes cleanly and keeps #3071’s conditional moves and #3081’s scalar comparisons. Built `compile_dxil native_store_replay native_compute_ir_dump` in Debug and Release over `d99e0ae4` plus #3192 (tree `8afd409a70773b17d781bfe034b03dc5dd6f0ff9`). `ctest --test-dir <build> --no-tests=error -j 1 -V -R '^native_(direct_container$|(salu_(cmov|cmp64|bitscan64)|s_quadmask)_.*)'` passed 11/11 in each configuration. Rebuilt Release over actual `main` `afe70bd7` (tree `51db1e8c4c331c0862a4c2d979e196adaf83b52b`) and the same 11 passed. I also built `native_sampler_heap` for #3142's adjacent suite. Its first run reported an iostream error in the temporary directory; rerunning `^native_sampler_heap_(warp|hardware)$` with a shorter temp path passed all 69 hardware assertions. WARP returned capability skip 77 because it has no wave32. Combined Release result on current main is 12 passes, 1 capability skip. NVIDIA GeForce RTX 4060 Laptop driver `32.0.16.1656`, Windows build `26200.9974`, SDK/DXC `10.0.26100.0`. `git diff --check HEAD^1 HEAD` and required hosted checks passed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.