Skip to content

shader: add a WARP readback for src_scc - #2725

Merged
R0Y00 merged 3 commits into
R0Y00:mainfrom
tedin7:test/src-scc-warp-readback
Nov 26, 2026
Merged

R0Y00 merged 3 commits into
R0Y00:mainfrom
tedin7:test/src-scc-warp-readback

Conversation

@tedin7

@tedin7 tedin7 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1723

Follows #1821.

What this unblocks: the src_scc lowering from #1821 is now checked on a real GPU path (D3D12 UAV readback vs a CPU reference).

Changes:

  • tests/startup_gfx2hlsl_src_scc_check.py: new dispatch <dxc> <offscreen_check> <warp|hardware> mode. It lowers s_cmp_eq_u32 + s_mov_b32 s3, src_scc with the real handlers and reads the result back per case (SCC=1 and SCC=0, distinct per-case data). A copy of the lowering mutated to (scc ? 0u : 1u) must read back wrong (negative control).
  • CMakeLists.txt: startup_gfx2hlsl_src_scc_dispatch_{warp,hardware}, next to the sibling s_ff1 dispatch tests.
  • .github/workflows/windows.yml: file listed with the sibling checks.
  • docs/experiments.md: command and evidence note.

Verification (Linux only, Stage-1; the Windows WARP run is left to the independent Stage-2 gate):

  • python3 -B tests/startup_gfx2hlsl_src_scc_check.py -> PASS
  • Lowering generated with the real handlers: ['scc = s1 == s2;', 's3 = (scc ? 1u : 0u);']; the negative-control mutation matches this text.
  • python3 -B tests/docs_links_check.py -> passed
  • git diff --check -> clean
  • dispatch mode not run here: no DXC on this host.
  • Independent Windows verification by @RonLogic on head f79a17e06fc4d0436ad93f675c97305e4501894e: Python check and direct dispatch mode passed on in-box WARP (driver 10.0.26100.10068) and on a physical RTX 4070 (driver 32.0.16.2124). On both: 8/8 readback cases matched, the inverted SCC mutation gave the wrong value in 8/8, and the D3D12 debug layer reported 0 errors and 0 warnings. Credit to @RonLogic.

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Independent gate: PASS on head f79a17e (Linux checks, break-it sweep 166/166 unchanged, R0Y00-style checklist, hygiene).

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit f79a17e06fc4d0436ad93f675c97305e4501894e:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 11.53s
    • Test (ctest --preset dev -R '^startup_gfx2hlsl_src_scc' --parallel 2 --no-tests=error --output-on-failure): 6/6 passed (startup_gfx2hlsl_src_scc_dispatch_warp 0.34s, startup_gfx2hlsl_src_scc_dispatch_hardware 0.35s, startup_gfx2hlsl_src_scc 0.14s, startup_gfx2hlsl_src_scc_join 0.15s, startup_gfx2hlsl_src_scc_join_dispatch_warp 0.26s, startup_gfx2hlsl_src_scc_join_dispatch_hardware 0.27s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 5.02s
    • Test (ctest --preset release -R '^startup_gfx2hlsl_src_scc' --parallel 2 --no-tests=error --output-on-failure): 6/6 passed (0.87s)

Marking Ready. @MasterDomino @R0Y00 this is the WARP readback follow-up for #1821; please review.

AI-assisted; commands listed were executed locally.

@tedin7
tedin7 marked this pull request as ready for review November 26, 2026 04:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T04:19:40.705347Z f79a17e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Contributor

Independent Windows verification of f79a17e06fc4d0436ad93f675c97305e4501894e: the Python check and direct dispatch mode passed on in-box WARP (driver 10.0.26100.10068) and on a physical RTX 4070 (32.0.16.2124). On both, all eight readback cases matched, the inverted SCC mutation produced the wrong value in all eight, and the D3D12 debug layer reported zero errors and warnings. I used the Release offscreen_check from #2728 after verifying the runner's native sources were identical between the two heads. git diff --check also passed.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @RonLogic for the independent run on f79a17e06: 8/8 readback on WARP and on the RTX 4070, mutation caught 8/8, 0 debug layer errors. Adding this to the Verification block.

AI-assisted; commands listed were executed locally.

@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.

Reviewed the test and its registration. On Windows 11 build 26200, the Python controls passed and the exact head and its composition with main 651577a each read back 8/8 expected SCC results on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The inverted-SCC control mismatched all eight inputs on each adapter. The debug layer reported zero errors and warnings.

@R0Y00
R0Y00 merged commit a581791 into R0Y00:main Nov 26, 2026
5 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.

3 participants