Shaders: xcl shaders --heavy ranks by instruction count #1543

Open
github-bot wants to merge 1 commit from github-bot/gh-1543 into main AGit
Owner

@⁠speed-y on GitHub · 2026-11-24 17:27 UTC · original
speed-y:shaders/heavy-rank → main · +146 −9 · 3 files · 1 commits · open

Part of #1269. Campaign tooling: --heavy N ranks console programs by RDNA2 instruction count (compile-cost proxy) so measurement and DXC work can start from the heaviest shaders.

What is in it

  • xcl shaders … --heavy N in crates/xcl/src/shaders.rs (rank + distribution + JSON); help in main.rs / README.md
  • unit test heavy_ranks_programs_by_instruction_count

Tested

  • RTX 5080 (driver 621.24), Windows 10.0.26200, rustc 1.100.0, release + debug
  • .\scripts\test.ps1: 777 passed, 0 failed, 41 ignored; SKIPPED GPU: 2 (no wave64), 1 (no heap windows)
  • xcl shaders …\shaders.rpf --heavy 5 (retail pack): 26698 programs, max 88863, top50_all_cs true, ~25.5 s

Regression run
main:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 5080
title: 7cf5ae7d
seconds: 60
exit: 0x0
frames shown: 1103 (PresentX 1104)
presents per 2 s (last 3): 29 38 15
device removals: 0
crashes: 0
peak commit: 21846 MB

this PR:

xcl-smoke v1
commit: 0284ec598b923028ec8950a1d16e3a30f96bd582
gpu: NVIDIA GeForce RTX 5080
title: 7cf5ae7d
seconds: 60
exit: 0x0
frames shown: 1212 (PresentX 1212)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15672 MB

Not tested

  • AMD adapters; wave64 / heap-window GPU paths (skipped on this adapter)

AI use

  • Cursor (Composer): implemented --heavy, tests, smoke, and this PR
**@⁠speed-y** on GitHub · 2026-11-24 17:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1543) `speed-y:shaders/heavy-rank` → `main` · +146 −9 · 3 files · 1 commits · open Part of #1269. Campaign tooling: `--heavy N` ranks console programs by RDNA2 instruction count (compile-cost proxy) so measurement and DXC work can start from the heaviest shaders. **What is in it** - `xcl shaders … --heavy N` in `crates/xcl/src/shaders.rs` (rank + distribution + JSON); help in `main.rs` / `README.md` - unit test `heavy_ranks_programs_by_instruction_count` **Tested** - RTX 5080 (driver 621.24), Windows 10.0.26200, rustc 1.100.0, release + debug - `.\scripts\test.ps1`: 777 passed, 0 failed, 41 ignored; SKIPPED GPU: 2 (no wave64), 1 (no heap windows) - `xcl shaders …\shaders.rpf --heavy 5` (retail pack): 26698 programs, max 88863, top50_all_cs true, ~25.5 s **Regression run** main: ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 5080 title: 7cf5ae7d seconds: 60 exit: 0x0 frames shown: 1103 (PresentX 1104) presents per 2 s (last 3): 29 38 15 device removals: 0 crashes: 0 peak commit: 21846 MB ``` this PR: ``` xcl-smoke v1 commit: 0284ec598b923028ec8950a1d16e3a30f96bd582 gpu: NVIDIA GeForce RTX 5080 title: 7cf5ae7d seconds: 60 exit: 0x0 frames shown: 1212 (PresentX 1212) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15672 MB ``` **Not tested** - AMD adapters; wave64 / heap-window GPU paths (skipped on this adapter) **AI use** - Cursor (Composer): implemented `--heavy`, tests, smoke, and this PR
Campaign tooling: print the N heaviest programs and the instruction-count
distribution so compile-cost work can target the right shaders first.

Assisted-by: Cursor (Composer)
Co-authored-by: Cursor <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:56:59 +00:00
Author
Owner

@⁠speed-y on GitHub · 2026-11-24 17:27 UTC · original

Part of #1269 — campaign tooling: xcl shaders --heavy N.

**@⁠speed-y** on GitHub · 2026-11-24 17:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1543#issuecomment-7139233638) Part of #1269 — campaign tooling: `xcl shaders --heavy N`.
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-24 17:35 UTC · original

Independent AMD and CLI test of 0284ec598b923028ec8950a1d16e3a30f96bd582.

Tested

  • Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug.
  • cargo build --workspace --locked and cargo test --locked -p xcl --lib heavy_ranks_programs_by_instruction_count -- --test-threads=1 passed. cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 777 passed, 0 failed, 41 ignored, and one GPU skip (heap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows). The bundled title test passed.
  • I generated five synthetic CS, PS, and VS programs with known counts (20,001, 8,001, 8,001, 7, and 3) and ran six xcl shaders commands with the debug binary. --heavy 3 --json agreed for a folder and a synthetic RPF9 pack, including the name-order tie, stage labels, 8,001 largest PS, three programs above 8,000, and one above 20,000. The pack’s plain-text top three matched its JSON.
  • The single-blob path counted both programs in one container. On the folder, --heavy 0 --json preserved the summary with an empty ranking and --heavy 99 --json returned all five programs, including the nested shader.

Not tested

Retail packs, retail title runs, and compile or driver cost. The synthetic counts check ranking and output formatting.

AI use

OpenAI Codex (GPT-6 family, exact variant unavailable) generated the synthetic test inputs, ran the checks, and drafted this report.

**@⁠nnonno91** on GitHub · 2026-11-24 17:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/1543#issuecomment-7139419011) Independent AMD and CLI test of `0284ec598b923028ec8950a1d16e3a30f96bd582`. **Tested** - Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug. - `cargo build --workspace --locked` and `cargo test --locked -p xcl --lib heavy_ranks_programs_by_instruction_count -- --test-threads=1` passed. `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output` reported 777 passed, 0 failed, 41 ignored, and one GPU skip (`heap_window_out_of_memory_falls_back_to_the_switch_form`, no heap windows). The bundled title test passed. - I generated five synthetic CS, PS, and VS programs with known counts (20,001, 8,001, 8,001, 7, and 3) and ran six `xcl shaders` commands with the debug binary. `--heavy 3 --json` agreed for a folder and a synthetic RPF9 pack, including the name-order tie, stage labels, 8,001 largest PS, three programs above 8,000, and one above 20,000. The pack’s plain-text top three matched its JSON. - The single-blob path counted both programs in one container. On the folder, `--heavy 0 --json` preserved the summary with an empty ranking and `--heavy 99 --json` returned all five programs, including the nested shader. **Not tested** Retail packs, retail title runs, and compile or driver cost. The synthetic counts check ranking and output formatting. **AI use** OpenAI Codex (GPT-6 family, exact variant unavailable) generated the synthetic test inputs, ran the checks, and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 19:13 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 19:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1543#issuecomment-7141770058) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 05:20 UTC · original

Empirical test report (0284ec59)

Verified xcl-dev/xcl PR #1543, “Shaders: xcl shaders --heavy ranks by instruction count,” at commit 0284ec598b923028ec8950a1d16e3a30f96bd582.

Hardware / environment

  • Windows x64, OS build 10.0.26200, AMD Family 23 Model 113 Stepping 0. Cargo test profile with debug info and incremental compilation disabled.
  • rustc 1.100.0 (0ef1bc386 2026-11-09), Windows MSVC toolchain. DXC 1.9.2609.5 (01b62ad47), as reported by dxc.exe.
  • The focused test used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. Both Cargo commands ran outside Invoke-ArcTest.ps1 and held the Arc GPU mutex for zero time.

Commands and results

  • cargo test --workspace --no-run — exit code 0. Cargo compiled the workspace test targets.
  • cargo test -p xcl --lib shaders::tests::heavy_ranks_programs_by_instruction_count -- --exact --nocapture — exit code 0. 1 passed, 0 failed, 0 ignored, 0 skipped. Counts come from the libtest summary and lines beginning with SKIPPED, matched case-sensitively.

Observed behavior

The added unit test passed. It builds two synthetic Xbox shader containers and verifies that the ranking returns both programs, with the seven-instruction program ahead of the three-instruction program. The test exercises byte parsing and RDNA2 instruction decoding without opening a D3D12 device, compiling a shader, or loading game data.

Not tested

The full GPU workspace suite and game smoke runs were omitted. The focused test covers the ranking helper. CLI argument handling, text and JSON output, and retail shader packs were outside this run.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1543-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 05:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/1543#issuecomment-7153674844) ### Empirical test report (0284ec59) Verified xcl-dev/xcl PR #1543, “Shaders: xcl shaders --heavy ranks by instruction count,” at commit `0284ec598b923028ec8950a1d16e3a30f96bd582`. **Hardware / environment** - Windows x64, OS build 10.0.26200, AMD Family 23 Model 113 Stepping 0. Cargo test profile with debug info and incremental compilation disabled. - rustc 1.100.0 (0ef1bc386 2026-11-09), Windows MSVC toolchain. DXC 1.9.2609.5 (01b62ad47), as reported by dxc.exe. - The focused test used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. Both Cargo commands ran outside Invoke-ArcTest.ps1 and held the Arc GPU mutex for zero time. **Commands and results** - `cargo test --workspace --no-run` — exit code 0. Cargo compiled the workspace test targets. - `cargo test -p xcl --lib shaders::tests::heavy_ranks_programs_by_instruction_count -- --exact --nocapture` — exit code 0. 1 passed, 0 failed, 0 ignored, 0 skipped. Counts come from the libtest summary and lines beginning with SKIPPED, matched case-sensitively. **Observed behavior** The added unit test passed. It builds two synthetic Xbox shader containers and verifies that the ranking returns both programs, with the seven-instruction program ahead of the three-instruction program. The test exercises byte parsing and RDNA2 instruction decoding without opening a D3D12 device, compiling a shader, or loading game data. **Not tested** The full GPU workspace suite and game smoke runs were omitted. The focused test covers the ranking helper. CLI argument handling, text and JSON output, and retail shader packs were outside this run. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1543-focused.log` and published.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 09:29 UTC · original · reviewed

On 0284ec5, the descending index for p90 is computed as ((n_prog - 1) as f64 * (1.0 - 0.9)) as usize. With 11 distinct programs ranked from 11 down to 1 instructions, 10 * (1.0 - 0.9) evaluates to 0.9999999999999998, then truncates to index 0. Both text and JSON report p90 = 11 (the maximum), whereas the formula's intended index 1 gives p90 = 10. The same boundary affects p99 with 101 programs.

Could the selected percentiles use integer arithmetic for the intended descending rank, such as (n_prog - 1) * (100 - percentile) / 100, with overflow-safe types? An 11-program fixture asserting p90 = 10 and max = 11 would catch this without changing the chosen percentile convention. I checked exact-head source and reproduced the arithmetic in Python; I did not run the XCL CLI on a synthetic pack.

**@⁠luckyteagirl** on GitHub · 2026-11-26 09:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/1543#pullrequestreview-6071570500) · **reviewed** On `0284ec5`, the descending index for p90 is computed as `((n_prog - 1) as f64 * (1.0 - 0.9)) as usize`. With 11 distinct programs ranked from 11 down to 1 instructions, `10 * (1.0 - 0.9)` evaluates to `0.9999999999999998`, then truncates to index 0. Both text and JSON report p90 = 11 (the maximum), whereas the formula's intended index 1 gives p90 = 10. The same boundary affects p99 with 101 programs. Could the selected percentiles use integer arithmetic for the intended descending rank, such as `(n_prog - 1) * (100 - percentile) / 100`, with overflow-safe types? An 11-program fixture asserting p90 = 10 and max = 11 would catch this without changing the chosen percentile convention. I checked exact-head source and reproduced the arithmetic in Python; I did not run the XCL CLI on a synthetic pack.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/main.rs
  • crates/xcl/src/shaders.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1543/head:github-bot/gh-1543'
git switch 'github-bot/gh-1543'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1543'
git switch 'github-bot/gh-1543'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1543'
git switch 'github-bot/gh-1543'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1543'
git switch 'main'
git merge --squash 'github-bot/gh-1543'
git switch 'main'
git merge --ff-only 'github-bot/gh-1543'
git switch 'main'
git merge 'github-bot/gh-1543'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.