Skip to content

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

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
Leyukaka:scc-sop1-preserve
Nov 27, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
Leyukaka:scc-sop1-preserve

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Fixes #3174. 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, shader: lower s_cmov_b32, s_cmov_b64 and s_cmovk_i32 in the direct compute path #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.

@KelboLive

Copy link
Copy Markdown
Contributor

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 #3192. Please coordinate with the author of #3192 to ensure these changes don't conflict on merge, or clarify if one PR supersedes the other.

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.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 #3192 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 #3190 (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 #3140'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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

direct compute: SCC liveness treats SCC-neutral SOP1 ops as SCC readers

3 participants