Skip to content

Scripts: compare two reproducible cold/warm performance runs - #2888

Open
KOLESNiii wants to merge 10 commits into
xcl-dev:mainfrom
KOLESNiii:scripts-perf-compare
Open

KOLESNiii wants to merge 10 commits into
xcl-dev:mainfrom
KOLESNiii:scripts-perf-compare

Conversation

@KOLESNiii

@KOLESNiii KOLESNiii commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2887; only the top three commits (Scripts: perf-compare requires the runs to agree on the startup timeout, Scripts: perf-compare compares recorded XCL settings case-sensitively and Scripts: perf-run's fixture checks perf-compare refuses other pipeline threads) belong here.

Fixes for scripts/perf-compare.ps1, which compares two perf-run.ps1 output folders without changing them. It refuses runs that are not comparable: a different workload fingerprint or identity algorithm/version, run order, requested duration or startup timeout, XCL_* environment, system, GPU or GPU driver. For comparable runs it reports the raw cold and warm durations, their deltas and the exit/timeout state, as console lines and one JSON document. It does not compute percentages or significance.

Part of #2787 (item 8). The comparator itself (fd237b1b from #2778 by @bmjask) is now on main, so after the rebase onto main 336fddda the port's commit is reduced to what main lacks: the startup-timeout check.

What is in it

  • Scripts: perf-compare requires the runs to agree on the startup timeout (8a331081): runs must also agree on startup_timeout_seconds, which perf-run records (Scripts: reproducible XCL-cold and XCL-warm performance runs #2887).
  • Scripts: perf-compare compares recorded XCL settings case-sensitively (64712f5e): the environment check used PowerShell's case-insensitive -ne, so XCL_DIRECT_DXIL=all and =ALL were accepted as comparable although only the lowercase value turns direct translation on. It uses -cne now, with the pair in the fixture.
  • Scripts: perf-run's fixture checks perf-compare refuses other pipeline threads (UncommonDLL, cb776d3b, from their review): perf-run.tests.ps1 makes three mock runs with XCL_PIPELINE_THREADS 1, 1 and 8; perf-compare accepts the matching pair, refuses the other with runtime environment differs, and leaves the manifests unchanged.
  • Settings outside the old fixed list (such as XCL_PIPELINE_THREADS) are now compared too: Scripts: reproducible XCL-cold and XCL-warm performance runs #2887 records every inherited XCL_* setting.
  • It does not compare log metrics (presents, first frame, peak commit). That is what Scripts: compare performance across two XCL runs #943's compare-perf.ps1 does on two logs, and it can be run on the xcl.log files a perf-run folder keeps.

Tested

  • Windows 11 build 26300, AMD Ryzen 5 3600XT, NVIDIA RTX 2070 SUPER (driver 32.0.16.2140), Rust 1.100.0 MSVC, Windows PowerShell 5.1.
  • powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\perf-compare.tests.ps1: all assertions passed on 701a7b79 (synthetic manifests). perf-run.tests.ps1 also passes there.
  • After the rebase onto main 336fddda, on cb776d3b: perf-run.tests.ps1 and perf-compare.tests.ps1: all assertions passed, Windows PowerShell 5.1 (UncommonDLL ran the new fixture on PowerShell 7.6.10 too).
  • A one-off cross-check, not committed: the comparator accepted two manifests that perf-run.ps1 from Scripts: reproducible XCL-cold and XCL-warm performance runs #2887 wrote with its mock XCL, and refused a pair from different workloads.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 on cb776d3b (debug): 2122 passed, 9 failed, 48 ignored. The 9 failures are the ones in main e429936 on NVIDIA: 3 e2e title tests and 6 split-wave64 GPU tests fail since #2959 #3093 (3 e2e title tests, 6 split / wave64 GPU tests); main 336fddda fails the same 9 tests with the same counts on this machine. This PR changes no Rust code. SKIPPED on this adapter: 21 × no wave64, 3 f16/f32 per-lane forms refused per gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426, 1 × no heap windows.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) ported the source commits, removed the stall comparison, fixed the fixture, ran the tests and drafted this description; after the rebase it reran the tests and updated Tested. The third commit's test is UncommonDLL's (OpenAI Codex assisted), with the subject reworded. The source commits were written with Codex (GPT-5.6-sol), per their trailers.

🤖 Generated with Claude Code

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…re messages)

Upstream xcl-dev#2890 (c6c14a1, single-commit on upstream/main 8b957be):
title_under_the_debug_layer prints the last TAIL=40 lines of xcl.log
in its three assertion messages and tolerates a missing log file
(unwrap_or_default), so a title that never finishes still shows why.

Verbatim port of the whole fix (1 file, +24/-4): the TAIL const +
tail() helper after the PathBuf import and the three rewritten
asserts. Applies cleanly; the only context offset is the
linux-only debug_layer_skip_line helper above the hunk.
Windows-only siblings xcl-dev#2888 (perf-compare ps1 stack), xcl-dev#2889
(tiling_parity.rs host-driver test, no cfg(windows) gate), xcl-dev#2891
(title_textures.rs write-watch tiering on the 71b8e6e dev-stack)
stay out per the step-139 sync entry.
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
@ettehn

ettehn commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Windows cross-check of 5fefeb15 and its parent runner 128ee21f: the comparator accepts a pair made with XCL_PIPELINE_THREADS=1 vs 8. I generated both cold/warm folders with the actual perf-run.ps1, real Cargo, and a tiny synthetic xcl.exe that writes the inherited setting to its log. The child saw the two distinct values, while neither manifest contained that key, so perf-compare emitted a comparison. That setting changes the number of driver PSO builds allowed in flight in shaders.rs.

I tried adding XCL_PIPELINE_THREADS, XCL_PIPELINE_MAX_KB, XCL_DIRECT_SPLIT_INSTRUCTIONS and XCL_PSO_DISK_CACHE to the producer’s existing allowlist. All four appeared in the new manifests. The unchanged comparator rejected the 1 vs 8 pair and accepted a 1 vs 1 repeat on PowerShell 5.1 and 7. The existing comparator fixture passed on both. This tests the comparison guard, with no retail title or performance claim.

OpenAI Codex (6.2sol) assisted with verification.

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The environment guard uses PowerShell's case-insensitive -ne on serialized JSON, so it accepts comparisons across case-sensitive XCL settings. Two synthetic manifests that differed only in the recorded XCL_DIRECT_DXIL value (all versus ALL) passed the exact-head comparator and produced an xcl-perf-comparison document. XCL enables direct graphics translation for lowercase all, and the uppercase spelling leaves it disabled. Can the environment comparison use -cne and cover this pair in the existing fixture? Comparator · Runtime setting

AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the exact source, ran the PowerShell fixture, and drafted this comment. No benchmark or GPU workload was run.

KOLESNiii added a commit to KOLESNiii/xcl that referenced this pull request Nov 27, 2026
The manifest recorded a fixed list of 13 XCL_* variables, while the runtime
reads about 180. Two runs that differed in an unlisted switch, such as
XCL_PIPELINE_THREADS or XCL_PREPARE_ALL, produced identical environment
records and perf-compare accepted the pair (reported on xcl-dev#2888 and xcl-dev#2887).

Record every XCL_* variable the runs inherit, sorted by name, except the
per-run XCL_DATA_ROOT / XCL_DXIL_CACHE paths the script sets itself and
its XCL_PERF_RUN_* test hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KOLESNiii
KOLESNiii force-pushed the scripts-perf-compare branch from 5fefeb1 to 65e1a20 Compare November 27, 2026 10:02
@LocranKing

Copy link
Copy Markdown

Tested PR #2888 (65e1a209) on Windows 11.

Verification

Ran powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\perf-compare.tests.ps1:

  • Output:
    xcl-cold: duration 1000 ms -> 850 ms; delta -150 ms
      exit: 0 -> 0; timeout: False -> False
    xcl-warm: duration 0 ms -> 0 ms; delta 0 ms
      exit: missing -> missing; timeout: True -> True
    xcl-cold: duration 1000 ms -> 850 ms; delta -150 ms
      exit: 0 -> 0; timeout: False -> False
    perf-compare tests: all assertions passed
    
  • Exit code: 0 (verified on Windows 11 Build 26300, covering case-sensitive XCL_* comparison via -cne).
  • Scope note: Fixture suite (perf-compare.tests.ps1) only.

@KOLESNiii
KOLESNiii force-pushed the scripts-perf-compare branch from 65e1a20 to 701a7b7 Compare November 27, 2026 15:14
@KOLESNiii

Copy link
Copy Markdown
Contributor Author

Thanks, both are fixed on the branch (head 701a7b79, rebased onto #2887's 99acc436):

@ettehn, XCL_PIPELINE_THREADS=1 vs 8 accepted: fixed on the producer side in #2887 (72d80c95). Instead of a longer allowlist, perf-run.ps1 now records every inherited XCL_* variable, except the per-run XCL_DATA_ROOT / XCL_DXIL_CACHE. perf-compare.ps1 compares the whole environment object, so any setting that differs makes the pair incomparable. The runner fixture checks that XCL_PIPELINE_THREADS and XCL_PREPARE_ALL are recorded. I did not rerun your exact 1 vs 8 pair through both scripts.

@luckyteagirl, all vs ALL: 701a7b79 uses -cne for the environment comparison, and the comparator fixture now refuses manifests that differ only in XCL_DIRECT_DXIL=all vs ALL.

Tested at 701a7b79 on Windows PowerShell 5.1: perf-compare.tests.ps1 and perf-run.tests.ps1 pass, and cargo test --workspace -- --test-threads=4 gives 1446 passed, 0 failed, 47 ignored. Not tested: PowerShell 7.

AI use: Claude Code (Claude Opus 5.5) wrote both fixes, ran the tests and wrote this comment.

@UncommonDLL

Copy link
Copy Markdown

@KOLESNiii We ran the XCL_PIPELINE_THREADS case through both scripts on Windows PowerShell 5.1 and PowerShell 7.6.10. On each shell, perf-run.ps1 generated three manifests with the same workload ID and thread settings of 1, 1 and 8. perf-compare.ps1 accepted 1 versus 1 and rejected 1 versus 8 with runtime environment differs; runs are incomparable. The manifests stayed byte-for-byte unchanged, and the test restored the caller’s thread setting.

The attached test-only commit c7fb2b1c653e96800591ca2e9233131afc9d5f46 adds this regression on 701a7b79. Both focused fixtures exited 0 on both shells. OpenAI Codex assisted with the Windows test.

Perf-environment-c7fb2b1c.patch

KOLESNiii pushed a commit to KOLESNiii/xcl that referenced this pull request Nov 28, 2026
…e threads

The runner's own mock output, not hand-written manifests: three runs with
XCL_PIPELINE_THREADS 1, 1 and 8. perf-compare accepts the matching pair,
refuses the other with "runtime environment differs", and leaves the
manifests unchanged.

Test by UncommonDLL (OpenAI Codex assisted), from xcl-dev#2888's review.
@KOLESNiii

Copy link
Copy Markdown
Contributor Author

@UncommonDLL thanks. I applied your commit to this PR with your authorship kept, as 552a1908. I only reworded the subject to the repo's Scripts: style: Scripts: perf-run's fixture checks perf-compare refuses other pipeline threads.

Here, on Windows PowerShell 5.1 (Windows 11 26300), perf-run.tests.ps1 passes, including your threads 1/1 accepted, 1/8 refused line, and so does perf-compare.tests.ps1. The description now lists the commit and your PowerShell 7.6.10 run.

AI use: Claude Code (Claude Opus 5.5) applied the commit, ran both fixtures and wrote this reply.

@KOLESNiii
KOLESNiii marked this pull request as ready for review November 28, 2026 03:22
KOLESNiii and others added 10 commits November 28, 2026 05:43
Under Windows PowerShell, when the script's output is redirected (a queued
or logged run), every stderr line of a native command becomes an error
record, and with $ErrorActionPreference = 'Stop' cargo's first
"Compiling" line ended the run before the title started. git and rustc
are called the same way. Run them with 'Continue' and check their exit
codes, as scripts/test.ps1 does. The fixture's mock cargo now writes to
stderr and the first run is redirected, which failed before this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a fresh DXIL cache, `xcl run` prepares every shader of the title
before the guest starts, and XCL_RUN_SECONDS counts only from there. On
a retail title with 26503 shaders, about 1400 were ready after 181 s on
an RTX 2070 SUPER, so the fixed 120 s allowance killed the cold run
during preparation. A killed XCL prints no `Log:` line, so the script
stopped with neither run recorded.

Take -StartupTimeoutSeconds as smoke.ps1 does (same range and default)
and record it in each run record. When XCL prints no log path, show its
exit code, the timeout state and its output, as smoke.ps1 does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the title crashes before XCL writes report.json, `xcl run` prints
"No report - see the log: <path>" instead of "Log: <path>". perf-run
found no log path, stopped, and then deleted the ephemeral data root,
so the only record of the crash went with it. This happened on a
retail title: an access violation (0xc0000005) during the XCL-cold
run's shader preparation, about 25 minutes in.

Accept either line, so the crashed run's log is kept and its exit code
recorded, as the manifest already allows. The fixture's mock XCL can now
crash this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The manifest recorded a fixed list of 13 XCL_* variables, while the runtime
reads about 180. Two runs that differed in an unlisted switch, such as
XCL_PIPELINE_THREADS or XCL_PREPARE_ALL, produced identical environment
records and perf-compare accepted the pair (reported on xcl-dev#2888 and xcl-dev#2887).

Record every XCL_* variable the runs inherit, sorted by name, except the
per-run XCL_DATA_ROOT / XCL_DXIL_CACHE paths the script sets itself and
its XCL_PERF_RUN_* test hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
perf-run quoted the game folder as "<path>". Windows argument parsing
halves backslashes that come before a quote, so a folder given as
'D:\Some Game\' reached xcl as 'D:\Some Game"' and the run failed
(reported on xcl-dev#2887). The trailing run of backslashes is now doubled.

A .cmd mock does not parse its command line that way, so the fixture
compiles a small C# shim (with the .NET Framework csc.exe in Windows)
that records the arguments it receives and then runs the mock; the old
script fails that check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a timeout perf-run killed only the launcher it started, stopped the
clock, and then waited for the output pipes to close. A child of the
launcher that inherited them (the launcher starts its host with handle
inheritance) kept running, held the read open and could still write the
run's log, which was then copied as if it belonged to the timed run
(reported on xcl-dev#2887 with a child writing 5 s into a 2 s run).

Each run's launcher is now assigned to a kill-on-close job object, which
is terminated when the launcher exits or times out, before the clock
stops. Reading the output is bounded to 30 s for a process that escaped
the job by starting before the launcher was assigned to it. The fixture
adds a mock child that writes the log 5 s after a 2 s timeout; the old
script copied that write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
XCL_PREPARE_ALL (prepare every shader record rather than only the title's
used-shader list) was the switch reported missing from the manifest on
manifest holds every inherited XCL_* setting instead of a selected list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
perf-run records startup_timeout_seconds in each run (an XCL-cold run is
given time to prepare its shaders before the guest timer starts), and
two runs given different allowances are not the same measurement. Refuse
such a pair, as the other recorded run properties are. The fixture's runs
carry the field and a case checks the refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The environment check used PowerShell's case-insensitive -ne, so runs with
XCL_DIRECT_DXIL=all and =ALL were accepted as comparable although only the
lowercase value enables direct translation. Use -cne, and cover the pair
in the fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e threads

The runner's own mock output, not hand-written manifests: three runs with
XCL_PIPELINE_THREADS 1, 1 and 8. perf-compare accepts the matching pair,
refuses the other with "runtime environment differs", and leaves the
manifests unchanged.

Test by UncommonDLL (OpenAI Codex assisted), from xcl-dev#2888's review.
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head cb776d3

Stacked on #2887: its first seven commits are #2887's. Only the top three belong here: the startup_timeout_seconds check, -cne for the environment JSON, and the combined perf-run/perf-compare fixture. This is not a duplicate.
#943's compare-perf.ps1 compares log metrics, not manifests, so it does not overlap.
I found no problems in scripts/perf-compare.ps1 or the two fixtures.
Recommendation: keep open.

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

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.

6 participants