Tests: time DXC on generated RDNA2 programs and write JSON / CSV (#1269) #2090

Open
BetterJdue wants to merge 3 commits from upstream-pr/2100 into main
BetterJdue commented 2026-11-25 04:01:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BetterJdue on 2026-11-25T04:01:50Z.


Stacked on #1763; only the top commit (cc131b2) belongs here.

Times the HLSL → DXIL compile of the programs #1763 generates, so the compile-time work in #1269 gets numbers that need no game data and can run in CI. Shader and pipeline compile time is the biggest obstacle to getting past world loading (#1833). Test-only: nothing in crates/xcl/src.

Part of #1269

What is in it

  • crates/xcl/tests/compile_bench/measure.rs: each program is translated (recomp::translate) and compiled with dxc::compile, one at a time; it records the HLSL and DXIL sizes and the DXC times (a repeat must give the same HLSL and DXIL size). A small set of 6 programs runs in every test run; XCL_COMPILE_BENCH=full runs 44: five shapes at 500 to 20 000 operations, the four wave64 ones also in the split form (a GPU with only 32-lane waves) with 4 memory windows, and two controls. XCL_COMPILE_BENCH_OUT writes JSON and CSV with the commit, DXC version, build profile and CPU.
  • crates/xcl/tests/compile_bench/gen.rs: buffer, image and compute knobs. At zero they give #1763's programs unchanged (a golden-hash test).
  • crates/xcl/tests/compile_bench/main.rs: tests of the new knobs, of the JSON / CSV and the DXC run (SKIPPED without DXC).

Tested

  • AMD Radeon RX 6700 (RDNA2), driver 32.0.21045.29003; Ryzen 5 3600; 32 GB RAM; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.9.2602.17.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on cc131b2 (debug): 761 passed, 3 failed, 41 ignored. The failures are not from this PR: placed_title_textures_share_vram_and_preserve_pixels, transitions_apply_when_their_list_is_submitted, d32s8_targets_take_their_own_size_of_video_memory; the first ("3D 64x64x64 4 mips: subresource 2 mismatch") also fails alone on main b9b6ea6, and the other two fail on the lock it poisons (PoisonError). #1028 is about the same failure. SKIPPED: none.
  • cargo test -p xcl --test compile_bench: 13 passed, 0 failed.
  • Negative control: six changes to the code (a buffer, image or compute knob ignored, #1763's programs changed, the CSV separator, the knobs not flattened into a row) each make one or two of the tests fail.
  • The full set, release, 3 compiles per program, on ae43075 (this commit before its rebase onto 0f257d1, plus one that adds scripts and a README section), 44 programs; 0f257d1 only refuses loops out of the branch range, so the programs are the same (the golden-hash test passes on both). Their medians add up to 693 s; the 5 slowest programs take 70 % of it. The split form (a 32-lane GPU) against the native one, DXC median:
program ops HLSL native / split DXIL native / split DXC native / split
base 2000 407 kB / 468 kB 64 kB / 171 kB 0.7 s / 1.9 s
base 8000 1.6 MB / 1.7 MB 252 kB / 698 kB 3.3 s / 11.9 s
base 20000 3.9 MB / 4.4 MB 662 kB / 1.8 MB 10.4 s / 54.9 s
divergent 2000 1.2 MB / 1.3 MB 200 kB / 702 kB 1.9 s / 12.3 s
divergent 8000 5.0 MB / 5.3 MB 860 kB / 3.0 MB 9.1 s / 133.7 s
divergent 20000 12.6 MB / 13.1 MB 5.5 MB / 16.1 MB 24.2 s / 135.2 s
loops 2000 440 kB / 499 kB 71 kB / 175 kB 0.8 s / 2.0 s
loops 8000 1.7 MB / 1.9 MB 261 kB / 709 kB 3.8 s / 12.1 s
loops 20000 4.3 MB / 4.7 MB 673 kB / 1.8 MB 11.0 s / 55.5 s
resources 2000 522 kB / 639 kB 82 kB / 217 kB 1.1 s / 3.0 s
resources 8000 2.0 MB / 2.4 MB 325 kB / 893 kB 5.7 s / 21.0 s
resources 20000 5.1 MB / 6.1 MB 830 kB / 2.3 MB 20.4 s / 106.6 s

Sources over 1 MiB get -O1 and over 8 MiB -O0 from dxc.rs, so the 20 000-operation divergent programs are compiled at -O0.

Not tested

  • Game data and scripts/smoke.ps1: none used; the change is test-only.
  • Other CPUs and DXC versions: the times are wall-clock and only comparable on one machine.
  • NVIDIA and Intel; macOS and Linux (not built).

AI use

  • Claude Code (Claude Opus 5.5) wrote the code, the tests and this description, and ran the tests and the measurement.
<!-- greyfinch-sync:ivall/xcl:issue:5484936722 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2100). Originally posted by [BetterJdue](https://github.com/BetterJdue) on 2026-11-25T04:01:50Z. --- Stacked on #1763; only the top commit (`cc131b2`) belongs here. Times the HLSL → DXIL compile of the programs #1763 generates, so the compile-time work in #1269 gets numbers that need no game data and can run in CI. Shader and pipeline compile time is the biggest obstacle to getting past world loading (#1833). Test-only: nothing in `crates/xcl/src`. Part of #1269 **What is in it** - `crates/xcl/tests/compile_bench/measure.rs`: each program is translated (`recomp::translate`) and compiled with `dxc::compile`, one at a time; it records the HLSL and DXIL sizes and the DXC times (a repeat must give the same HLSL and DXIL size). A small set of 6 programs runs in every test run; `XCL_COMPILE_BENCH=full` runs 44: five shapes at 500 to 20 000 operations, the four wave64 ones also in the split form (a GPU with only 32-lane waves) with 4 memory windows, and two controls. `XCL_COMPILE_BENCH_OUT` writes JSON and CSV with the commit, DXC version, build profile and CPU. - `crates/xcl/tests/compile_bench/gen.rs`: buffer, image and compute knobs. At zero they give #1763's programs unchanged (a golden-hash test). - `crates/xcl/tests/compile_bench/main.rs`: tests of the new knobs, of the JSON / CSV and the DXC run (`SKIPPED` without DXC). **Tested** - AMD Radeon RX 6700 (RDNA2), driver 32.0.21045.29003; Ryzen 5 3600; 32 GB RAM; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.9.2602.17. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `cc131b2` (debug): 761 passed, 3 failed, 41 ignored. The failures are not from this PR: `placed_title_textures_share_vram_and_preserve_pixels`, `transitions_apply_when_their_list_is_submitted`, `d32s8_targets_take_their_own_size_of_video_memory`; the first ("3D 64x64x64 4 mips: subresource 2 mismatch") also fails alone on `main` `b9b6ea6`, and the other two fail on the lock it poisons (`PoisonError`). #1028 is about the same failure. SKIPPED: none. - `cargo test -p xcl --test compile_bench`: 13 passed, 0 failed. - Negative control: six changes to the code (a buffer, image or compute knob ignored, #1763's programs changed, the CSV separator, the knobs not flattened into a row) each make one or two of the tests fail. - The full set, release, 3 compiles per program, on `ae43075` (this commit before its rebase onto `0f257d1`, plus one that adds scripts and a README section), 44 programs; `0f257d1` only refuses loops out of the branch range, so the programs are the same (the golden-hash test passes on both). Their medians add up to 693 s; the 5 slowest programs take 70 % of it. The split form (a 32-lane GPU) against the native one, DXC median: | program | ops | HLSL native / split | DXIL native / split | DXC native / split | |---|---|---|---|---| | base | 2000 | 407 kB / 468 kB | 64 kB / 171 kB | 0.7 s / 1.9 s | | base | 8000 | 1.6 MB / 1.7 MB | 252 kB / 698 kB | 3.3 s / 11.9 s | | base | 20000 | 3.9 MB / 4.4 MB | 662 kB / 1.8 MB | 10.4 s / 54.9 s | | divergent | 2000 | 1.2 MB / 1.3 MB | 200 kB / 702 kB | 1.9 s / 12.3 s | | divergent | 8000 | 5.0 MB / 5.3 MB | 860 kB / 3.0 MB | 9.1 s / 133.7 s | | divergent | 20000 | 12.6 MB / 13.1 MB | 5.5 MB / 16.1 MB | 24.2 s / 135.2 s | | loops | 2000 | 440 kB / 499 kB | 71 kB / 175 kB | 0.8 s / 2.0 s | | loops | 8000 | 1.7 MB / 1.9 MB | 261 kB / 709 kB | 3.8 s / 12.1 s | | loops | 20000 | 4.3 MB / 4.7 MB | 673 kB / 1.8 MB | 11.0 s / 55.5 s | | resources | 2000 | 522 kB / 639 kB | 82 kB / 217 kB | 1.1 s / 3.0 s | | resources | 8000 | 2.0 MB / 2.4 MB | 325 kB / 893 kB | 5.7 s / 21.0 s | | resources | 20000 | 5.1 MB / 6.1 MB | 830 kB / 2.3 MB | 20.4 s / 106.6 s | Sources over 1 MiB get `-O1` and over 8 MiB `-O0` from `dxc.rs`, so the 20 000-operation divergent programs are compiled at `-O0`. **Not tested** - Game data and `scripts/smoke.ps1`: none used; the change is test-only. - Other CPUs and DXC versions: the times are wall-clock and only comparable on one machine. - NVIDIA and Intel; macOS and Linux (not built). **AI use** - Claude Code (Claude Opus 5.5) wrote the code, the tests and this description, and ran the tests and the measurement.
DavidM1911 commented 2026-11-25 06:05:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T05:43:49Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7154083300 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2100#issuecomment-7154083300). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T05:43:49Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-29 07:40:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:40:40Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252621375 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2100#issuecomment-7252621375). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:40:40Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 07:22:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:22:54Z.


Triage (#1607) – head cc131b2

Stacked on #1763 (the generator); only the top commit cc131b2 (measure.rs, the knobs and their tests) belongs here, and #2106 is stacked on this PR. The shared lines with #1763 and #2106 are the stack, not a duplicate. Nothing of compile_bench is on main yet.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303987722 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2100#issuecomment-7303987722). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:22:54Z. --- **Triage (#1607)** – head cc131b2 Stacked on #1763 (the generator); only the top commit cc131b2 (measure.rs, the knobs and their tests) belongs here, and #2106 is stacked on this PR. The shared lines with #1763 and #2106 are the stack, not a duplicate. Nothing of compile_bench is on main yet. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2100:upstream-pr/2100'
git switch 'upstream-pr/2100'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2100'
git switch 'upstream-pr/2100'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2100'
git switch 'upstream-pr/2100'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2100'
git switch 'main'
git merge --squash 'upstream-pr/2100'
git switch 'main'
git merge --ff-only 'upstream-pr/2100'
git switch 'main'
git merge 'upstream-pr/2100'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2090
No description provided.