Skip to content

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

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

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

Conversation

@KOLESNiii

@KOLESNiii KOLESNiii commented Nov 26, 2026 •

Copy link
Copy Markdown

Stacked on #2887; only the top commit (Scripts: compare reproducible performance artifacts) belongs here.

Adds scripts/perf-compare.ps1, which compares two perf-run.ps1 output folders (#2887) 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): fd237b1b from #2778 by @bmjask, with the comparator part of dfcd4bbb, ported as one commit with the authorship kept.

What is in it

  • Scripts: compare reproducible performance artifacts (bmjask, fd237b1b + the perf-compare part of dfcd4bbb): scripts/perf-compare.ps1, scripts/perf-compare.tests.ps1, README. Changed from the source:
  • 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 5fefeb15 (synthetic manifests).
  • 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 -- --test-threads=4 on 5fefeb15: 1446 passed, 0 failed, 47 ignored. 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. The source commits were written with Codex (GPT-5.6-sol), per their trailers.

🤖 Generated with Claude Code

bmjask and others added 5 commits November 26, 2026 19:55
Build a clean locked release and run one workload against fresh ephemeral XCL caches, then the exact same workload against those caches warm. Preserve only logs, reports, and a versioned environment manifest while explicitly leaving the driver cache uncontrolled.

Assisted-by: Codex (GPT-5.6-sol)
(cherry picked from commit 5bdaa54)

Ported without XCL_STALL_TRACE, which comes from the stall module on xcl-dev#2778
and is not on main.
Identify a workload from a deterministic metadata inventory instead of only its folder name, verify the inventory around each paired run, and require matching identity algorithms in comparisons. Persist no paths or file names and document that the fingerprint is not a content hash.

Assisted-by: Codex (GPT-5.6-sol)
(cherry picked from commit dfcd4bb)

Only the perf-run.ps1 part is taken here: the matching checks in
perf-compare.ps1 belong to the comparator, which is not part of this change.
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>
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 and others added 3 commits November 27, 2026 10:01
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>
Validate that baseline and candidate runs describe the same workload,
environment, system, GPU, driver, and schedule. Report raw cold/warm
duration deltas without inventing percentages or statistical
significance.

Assisted-by: Codex (GPT-5.6-sol)
(cherry picked from commit fd237b1)
(cherry picked from commit dfcd4bb)

Ported to main: the stall aggregate comparison is left out, because
report.json on main has no stall summary (that comes from the stall
module on xcl-dev#2778). The workload identity algorithm/version checks are the
perf-compare part of dfcd4bb. Runs must also agree on
startup_timeout_seconds, which perf-run records on main. The fixture's
check for derived metrics matched the "ratio" inside "duration_ms" and
now matches whole words only.

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

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.

4 participants