Repository navigation
compute: classify remaining scalar ops in direct SCC liveness - #3609
Merged
Merged
Conversation
Refs R0Y00#3224, R0Y00#2935 uses_scc_after() treated every SOPK op except s_movk_i32 as uncertain and missed SCC writers (s_bfe_i32, s_addk_i32, all twelve s_cmpk_*) and readers (s_addc_u32, s_subb_u32), so programs that kill or preserve SCC through those ops were refused as if SCC were still live at a symbolic descriptor field. The overwrite list now names the three writers, a new preserves_sopk list names s_mulk_i32, the four counter waits and the mode writes, and the readers join reads_scc. Unimplemented scalar ops stay uncertain and SOPP ops keep their fallthrough behavior. tests/native_scc_liveness_check.py pins the classification without Windows: its no-arg mode checks all 199 scalar ops in the ISA tables against the census, runs a Python replica of the backward walk over 53 straight-line and branching programs, and kills 25 of 25 single-condition mutants. controls and hardware modes compile and replay the pass, refusal and boundary programs on Windows.
Windows dev verification of c60704b compiled the C++ cleanly but caught three fixture bugs in tests/native_scc_liveness_check.py: - The field was extracted in prologue(), before group_base(), whose s_lshl_b32 overwrites SCC, so all 15 SCC refusals returned rc=0. The field now comes after the group base and the SGPR initializations (new base_words() helper), so the field's SCC is the one the tested instruction sees. - s24 and s27 were read unbound in several controls programs. The base now initializes them (movk(24, 1) + movk(27, 0); movk(24, 6) for the one-arm-overwrite diamond), and the stride-bound positive control uses the same base. - hardware_program() stored s25 numerically, but the stride field value is symbolic. Slot 15 now re-extracts the field and proves the mode writes (s_round_mode 0, s_denorm_mode 0xf, s_setreg_imm32_b32) preserve its SCC into s_cselect_b32. The no-arg audit now also pins the base initializations and the pass/refusal split itself: between the field and the first SCC reader, every pass program has an overwriter (except the branch-over-reader, which passes by skipping the reader) and every SCC refusal program has none (except the diamond that refuses on its preserving arm, and the three mode refusals, which refuse on the mode op). Linux: no-arg audit passes (199 scalar ops, 53 CFG programs, 25/25 mutants killed), run_checks_parallel 277/277, form/docs/bidi pass (187 files/738 links, 2728 files), py_compile and diff --check clean, merge-tree exits 0. Refs R0Y00#3224, R0Y00#2935
Ammmae0x
marked this pull request as ready for review
November 30, 2026 14:00
R0Y00
approved these changes
Nov 30, 2026
R0Y00
left a comment
Owner
There was a problem hiding this comment.
Independent Release retest of f4d347b1: built compile_dxil and native_store_replay; ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_scc_liveness_.*|native_direct_container)$' passed 3/3 with zero skips, including the RTX hardware replay. The liveness scan still prioritizes real consumers and only stops on unconditional writes. The fixture keeps carry/borrow reads, the one-arm branch negative and mode-preservation checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3224, #2935
Issue #3224's census still lists the "numeric SCC from a symbolic descriptor field" refusal (2 shaders / 203,617 dispatches in 8ecd30f) after #3227 and #3301.
Change
uses_scc_after()(src/gfx1013_direct_compute.inl) treated every SOPK op excepts_movk_i32as uncertain and missed SCC writers and readers, so programs that kill or preserve SCC through those ops were refused as if SCC were still live at a symbolic descriptor field:s_bfe_i32,s_addk_i32, all twelves_cmpk_*(they write SCC from the extracted value, the signed overflow, or the comparison result, without reading incoming SCC).s_mulk_i32, the four counter waits (s_waitcnt_vscnt/vmcnt/expcnt/lgkmcnt),s_setreg_b32,s_setreg_imm32_b32(newpreserves_sopklist; the Sopk uncertain clause now excludes overwriters and preservers).s_addc_u32,s_subb_u32(they consume SCC throughread(128)).Unimplemented scalar ops stay uncertain. SOPP ops are not listed: the uncertain test never matches them, so lowered ones fall through and preserve SCC.
s_setreg_b32is classified as a preserver althoughconsume_half_mode()never accepts it in compute, so any program containing it still refuses at lowering.s_wqm_b32/s_wqm_b64stay inmask_sccalthougharithmetic()does not lower them.WIN-VERIFY fix (f4d347b)
Windows dev verification of
c60704bfcompiled the C++ cleanly and caught three fixture bugs intests/native_scc_liveness_check.py(the translator change itself is untouched):prologue(), beforegroup_base(), whoses_lshl_b32overwrites SCC, so all 15 SCC refusals returnedrc=0instead of refusing. The field now comes after the group base and the SGPR initializations (newbase_words()helper), so the field's SCC is the one the tested instruction sees.s24ands27were read unbound in several controls programs (pass-mode,pass-nop,pass-branch-over-reader,refuse-cbranch-scc1,refuse-diamond-one-overwrite). The base now initializes them (movk(24, 1)+movk(27, 0);movk(24, 6)for the one-arm-overwrite diamond), and the stride-bound positive control uses the same base.hardware_program()storeds25numerically, but the stride field value is symbolic. Slot 15 now re-extracts the field and proves the mode writes (s_round_mode 0,s_denorm_mode 0xf,s_setreg_imm32_b32) preserve its SCC intos_cselect_b32.The no-arg audit now also pins the base initializations and the pass/refusal split itself: between the field and the first SCC reader, every pass program has an overwriter (except the branch-over-reader, which passes by skipping the reader) and every SCC refusal program has none (except the diamond that refuses on its preserving arm, and the three mode refusals, which refuse on the mode op).
Verification (Linux)
No-arg audit, run from the repository root:
Full Linux check suite (the
python-linuxjob shape):Plus
tests/form_coverage_check.py,tests/docs_links_check.py(187 files, 738 links),tests/bidi_controls_check.py(2728 files),py_compile,git diff --check— all clean;git merge-tree --write-tree origin/main HEADexits 0.controlsandhardwaremodes (native_scc_liveness_controls,native_scc_liveness_hardware) needcompile_dxilandnative_store_replayon Windows and are not covered by the Linux run above.Windows Verification (f4d347b)
AI-assisted.