Skip to content

Scripts: print whether the smoke frame is black (#717) - #747

Open
Luxuryig wants to merge 1 commit into
xcl-dev:mainfrom
Luxuryig:scripts-smoke-lit-frame
Open

Luxuryig wants to merge 1 commit into
xcl-dev:mainfrom
Luxuryig:scripts-smoke-lit-frame

Conversation

@Luxuryig

Copy link
Copy Markdown
Contributor

Fixes #717.

scripts/smoke.ps1 turns on the existing frame sample (XCL_FRAME_DUMP=120) and adds lit at end to the xcl-smoke v1 block: the last sampled frame's non-black share, or n/a when nothing was sampled or the format was not decoded. scripts/pr_check.py refuses the PR when both blocks have a number, main is over 50 %, and the PR is under 1 %. A missing line or n/a is left alone, so older descriptions and short runs still pass. A main frame at 50 % or under does not fail a dark PR.

Scripts only. .github/workflows/pr-check.yml runs pr_check.py from main (pull_request_target), so the new refusal starts after this merges. The line is in the block immediately.

scripts/smoke.ps1 will conflict with #704 and #689. Those change the title line; this adds the lit line and sets XCL_FRAME_DUMP.

What is in it

  • scripts/smoke.ps1: set XCL_FRAME_DUMP=120 for the child (the caller's previous value is restored) and print lit at end.
  • scripts/smoke_lit.ps1: read d3d12.last_frame_dump from report.json. The percentage uses a dot, not the locale's decimal mark.
  • scripts/pr_check.py: refuse a dark last frame against a lit main.
  • scripts/test_pr_check.py and scripts/test-smoke-lit.tests.ps1: the threshold and the percentage line.

Tested

  • NVIDIA GeForce RTX 4060 Ti, driver 32.0.16.1664, 7949 MiB VRAM (as XCL logged it). AMD Ryzen 5 5500. Windows NT 10.0.26200.0. rustc 1.99.1 (58cf8f9c3 2026-10-13), cargo 1.99.1 (5f94df478 2026-08-27). Debug. DXC dxcompiler/dxil 1.8.2502.11 (23992152), from C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64.
  • .\scripts\test.ps1 on 63cdc25 plus these script files, before the rebase onto 64b3f35: exit 0. 692 passed, 0 failed, 41 ignored. GPU tests skipped: 2 (no wave64). Unset, so their tests skipped: XCL_SAMPLE_RPF, XCL_SAMPLE_DLLS, XCL_SAMPLE_TTPF, XCL_SAMPLE_BK2, XCL_SAMPLE_BVH4, XCL_SAMPLE_AWC, XCL_SAMPLE_XG, XCL_SAMPLE_DXC. tests/e2e.rs: 3 passed. Wall time 138.98 s. Not re-run after rebasing onto 64b3f35 (origin/main at the time of the push). Another cargo build was already using the machine, and this diff does not change Rust.
  • python scripts/test_pr_check.py: Ran 7 tests, OK. The new cases: 0 % against main 80 % is refused, 0.4 % against 60 % is refused, 90 % against 80 % passes, and a missing line, n/a, and main at 40 % are left alone.
  • powershell.exe -NoProfile -File scripts/test-smoke-lit.tests.ps1: smoke lit tests passed (100 %, 0 %, 0.4 %, undecoded, no samples, no dump, missing file).

Regression run

  • Not a runtime change. crates/xcl/src is untouched, so there are no xcl-smoke blocks.

Not tested

  • No retail title, and smoke.ps1 was not launched. The in-tree test title exits in about 2 seconds after about one present, so a sample every 120 frames (presents % 120 == 20) would not fire and lit at end would be n/a. The percentage is checked against a written report.json, not a captured frame.
  • Not run on AMD. The two wave64 hardware tests do not run on this adapter.
  • CI will not enforce the new refusal until this copy of pr_check.py is on main.

AI use

  • Grok Build (Grok 4.7) wrote the change, the tests, and this description. The commands above were run on this machine. The counts are from those runs.

smoke.ps1 sets XCL_FRAME_DUMP=120 and adds `lit at end` from the last
sampled frame. pr_check refuses a dark frame when main's is lit.

Fixes xcl-dev#717

Assisted-by: Grok Build (Grok 4.7)
@futurepro62

Copy link
Copy Markdown

Tested exact head fd323c0.

Tested

  • Windows 11 Home 26300, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here), Python 3.14.3.
  • powershell -NoProfile -File scripts/test-smoke-lit.tests.ps1: smoke lit tests passed.
  • cd scripts; python -m unittest test_pr_check: Ran 7 tests, OK. The same test file against main f4ce27c's pr_check.py: FAILED (failures=2).
  • End to end with a temporary game folder My Game Folder and a fake xcl.cmd that prints a log path (the same kind of fixture smoke-environment.tests.ps1 uses), smoke.ps1 -Game <folder> -Seconds 1 -Xcl <fake> and a report.json with d3d12.last_frame_dump = {"sampled_pixels": 1000, "non_dark_samples": 375}: the block ends with lit at end: 37.5 %. With XCL_FRAME_DUMP=7 set in the calling shell, it is 7 again after the run.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and the fixture runs and wrote this report. I checked it before posting.

@anes66

anes66 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The new frame-dump setting leaks into the caller when process startup fails on fd323c0f37d56683de1c792a3620e28505b4026b.

With the caller's XCL_FRAME_DUMP=37, passing an existing but invalid executable through -Xcl throws from startup and leaves the caller at 120. Restoration is after the process wait, so it is not reached.

52de2df sets ProcessStartInfo.EnvironmentVariables["XCL_FRAME_DUMP"] instead. The child gets 120 without changing the parent. It also adds the failed-start regression to your PowerShell test. This is scoped to the newly added frame setting; the older network/run/activity settings are left to #521.

Tested
Windows 10 Pro 19045, Windows PowerShell 5.1.19041.7844 and PowerShell 7.6.9.

  • The new regression failed before the fix: got '120' wanted '37'.
  • scripts/test-smoke-lit.tests.ps1 passed in both shells after the fix; PowerShell 5.1 used a process-only execution-policy override.
  • Seven Python checker tests passed.
  • I also ran the complete smoke.ps1 with a locally compiled synthetic stand-in in both shells. Its log/report produced 100 %, 0 %, 0.4 % and n/a in the final block. The stand-in required the child's value to be 120. The caller retained 37, and an initially unset caller variable stayed unset. These are synthetic fixture checks, not title regression runs.

Workspace result
Rust 1.100.0 MSVC, RTX 3060 12 GB / 32.0.16.2114, Ryzen 7 9800X3D, DXC 1.9.2602.17, Agility SDK 1.620.2, debug:

  • Workspace build passed.
  • Four-thread workspace suite on the patched tree: 700 passed, 1 failed, 41 ignored, exit 101; two native-wave64 SKIPPED. Samples were unset.
  • Failure: d32s8_targets_take_their_own_size_of_video_memory, vram.rs:889, D32S8 target at 0x4000000000.
  • A subsequent isolated run of that exact test passed 1/1. Its cause is not established. The patch changes only the two PowerShell files; I am not reporting the workspace suite as green.

Not tested
Real-title frame capture/smoke runs, other GPUs or release builds. No runtime source changed.

AI use
Codex (GPT-6; exact variant unavailable) wrote the fix/regression and synthetic stand-in, ran validation, and drafted this report.

Current-main integration follow-up

Integration head a62d547 combines main fc0462b with this PR's unchanged fd323c0, then reapplies the child-only frame-dump fix as its own commit. The merge resolves both Python conflicts by retaining main's field validation, model/template/test-only checks and this PR's lit-frame checks. No Rust files changed.

Tested

  • python -B -m unittest discover -s scripts -p 'test_pr_check*.py' -v: 17 tests passed.
  • scripts/test-smoke-lit.tests.ps1: passed on Windows PowerShell 5.1 and PowerShell 7, including the failed-start environment regression.
  • On each shell, five external synthetic smoke-script scenarios passed: 100 %, 0 %, 0.4 %, n/a, and an unset caller value. The stand-in child checks that it receives XCL_FRAME_DUMP=120; the caller's 37 stays 37, and unset stays unset.

These are script checks with our own small C fixture, not title runs. No proprietary files or new smoke blocks. Rust/GPU tests were not rerun for this scripts-only integration. The separate rounding concern raised by @136084599 is unchanged.

AI use: Codex (GPT-6; exact variant unavailable) resolved the integration, reapplied the existing fix, ran the checks and prepared this update.

@136084599

136084599 commented Nov 24, 2026 •

Copy link
Copy Markdown

Independent Windows check of fd323c0 (Windows 11 26200, PowerShell 7.6.9, CPython 3.12.10). All 7 checker tests passed. I also fed synthetic report.json files through Get-XclSmokeLit and passed the emitted lines to pr_check.check.

The one-decimal formatting can round a measurement onto either strict cutoff. With 518,400 samples per report:

PR count Main count Emitted lit at end Observed
5,132 (~0.990%) 414,720 (80%) 1 % vs 80 % Accepted
2,074 (~0.400%) 259,252 (~50.010%) 0.4 % vs 50 % Accepted

Both would be rejected by the stated <1% / >50% rule on the original counts. With only the format changed locally from 0.# to 0.########, both were rejected, the 0.4% / 80% control still rejected, and the exact 1% and 50% boundary controls still passed. Keeping more precision in the report line would let those cases match the rule.

AI-assisted. Synthetic reports only, no XCL or retail run.

Follow-up: patch and two boundary tests

The added sub-1% fixture fails on fd323c0 before the formatter change. With the patch below, all nine PowerShell fixtures pass on PowerShell 7.6.9, and all seven Python checker tests still pass. Git also accepts the patch against the pinned files. This only uses synthetic reports.

diff --git a/scripts/smoke_lit.ps1 b/scripts/smoke_lit.ps1
index 4c6c5a8..9172bb0 100644
--- a/scripts/smoke_lit.ps1
+++ b/scripts/smoke_lit.ps1
@@ -12,5 +12,5 @@ function Get-XclSmokeLit([string]$Report) {
     if ($pixels -le 0) { return 'n/a' }
     $pct = 100.0 * [int64]$dump.non_dark_samples / $pixels
     # A comma decimal would not parse in pr_check.py, so the line is always dotted.
-    return ([string]::Format([Globalization.CultureInfo]::InvariantCulture, '{0:0.#} %', [double]$pct))
+    return ([string]::Format([Globalization.CultureInfo]::InvariantCulture, '{0:0.########} %', [double]$pct))
 }
diff --git a/scripts/test-smoke-lit.tests.ps1 b/scripts/test-smoke-lit.tests.ps1
index 82673e3..269a04d 100644
--- a/scripts/test-smoke-lit.tests.ps1
+++ b/scripts/test-smoke-lit.tests.ps1
@@ -22,6 +22,10 @@ try {
     Assert-Eq 'black' (Get-XclSmokeLit $report) '0 %'
     Write-Report 1000 4
     Assert-Eq 'fraction' (Get-XclSmokeLit $report) '0.4 %'
+    Write-Report 518400 5132
+    Assert-Eq 'just below one percent' (Get-XclSmokeLit $report) '0.98996914 %'
+    Write-Report 518400 259252
+    Assert-Eq 'just above fifty percent' (Get-XclSmokeLit $report) '50.01003086 %'
     Write-Report 1000 $null
     Assert-Eq 'undecoded' (Get-XclSmokeLit $report) 'n/a'
     Write-Report 0 0

@Chrysana

Copy link
Copy Markdown

Thanks for picking up #717. This is the retail check I offered there: fd323c0 against a title that really is black, on AMD.

Tested

  • AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008, Ryzen 7 9800X3D, Windows 11 build 26200.9974, rustc 1.100.0 MSVC, release. PowerShell 7.6.10 and Windows PowerShell 5.1.26100.9818, Python 3.14.3.
  • fd323c0 merged onto main 47efa2e (local merge db2d4fc, not pushed). One conflict, in scripts/test_pr_check.py, where both sides add test classes; I kept both.
  • python -m unittest test_pr_check: 7 tests OK on fd323c0, 13 OK on the merge. test-smoke-lit.tests.ps1: passed in both shells, on both trees.
  • The PR's scripts/smoke.ps1, 60 s runs of a retail title, with -Xcl set to each build:
build run frames shown lit at end
main 47efa2e (from the merge tree) 1 1152 99.9 %
2 1170 99.9 %
3 (Windows PowerShell 5.1) 1190 99.9 %
#541 at 24635db (black on this card, see #717) 1 1587 0 %
2 1616 0 %

The black build shows more frames than main, the same 60 60 60, and no crashes or device removals. Its block looks healthier than main's on every line except the new one.

  • pr_check.check() on these real blocks, simulating a runtime change and changing only the commit: values to main/head ones. Main against D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541 is refused in both rounds: the PR's last sampled frame is dark (0 %) while main's is lit (99.9 %). Main against main passes both ways. The same blocks through main's current pr_check.py pass, which is the gap this PR closes.
  • lit at end matches report.json's last_frame_dump (517959 / 518400 and 0 / 518400, frame 1100 / 1580, format 28, 3840×2160). The values are nowhere near 1 % or 50 %, so the rounding point raised above doesn't affect real runs like these.
  • Cost of XCL_FRAME_DUMP=120: main's own smoke.ps1 on the same build gave 1193 frames, against 1152–1190 with sampling. That's within run-to-run spread; an earlier pair on 91f9a5e gave 1176 without sampling and 1171 with.

Worth knowing

  • On this title, the sample at frame 20 is always 0 % (loading screen), and some runs are still dark at frame 140. Working runs are lit from about frame 140–260 on. A 60 s run ends around frame 1100, so this is fine at the default length. But a PR run that never gets past about 260 presents (a much shorter -Seconds, or a PR that stalls in loading) would end on a dark sample and be refused against a lit main. That may well be the right call for a stall, but the message would say "dark" rather than "slow".
  • The block's commit: is the script tree's HEAD, not the -Xcl build's (this was already true before this PR). My D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541 blocks say db2d4fc because I ran them from the merge tree with -Xcl pointed at the D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541 build.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) did the merge, builds and runs, fed the blocks to pr_check.check(), and drafted this comment. I checked it before posting.

@sds-228 sds-228 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed head fd323c0. Locally: python scripts/test_pr_check.py → 7 passed, 0 failed; powershell.exe -NoProfile -File scripts/test-smoke-lit.tests.ps1 → passed. The JSON fields read by smoke_lit.ps1 (sampled_pixels, non_dark_samples) exist in present.rs.

Blocking: mergeable: false, mergeable_state: dirty. A dry-run merge of current main into this head conflicts in scripts/test_pr_check.py. Please rebase and re-run the script tests.

Question: smoke.ps1 now sets XCL_FRAME_DUMP=120, which adds a quarter-resolution readback every 120 presents. The description says smoke.ps1 was not launched. Is there evidence this does not move the smoke counters used by PR-check thresholds?

Also note #1229 changes the same test file; recheck that interaction after both land.

AI-assisted (OpenCode).

@Chrysana

Copy link
Copy Markdown

@sds-228 On the XCL_FRAME_DUMP=120 question: I measured that in my report above, on an RX 9070 XT with a retail title, 60 s runs.

  • main's own smoke.ps1 (no sampling) on the same build: 1193 frames.
  • This PR's smoke.ps1 (sampling every 120 presents): 1152, 1170 and 1190 frames.
  • An earlier pair on 91f9a5e: 1176 without sampling, 1171 with.

So on this card the cost is within run-to-run spread. That's one GPU and a handful of runs, so it doesn't rule out a cost on slower cards, where the readback takes a bigger share of each frame.

(Claude Code, Claude Opus 5.5)

not-rex added a commit to not-rex/xcl that referenced this pull request Nov 25, 2026
All console view heaps share one shader-visible PC heap, a page of 256
slots (512 descriptors) at a time. On NVIDIA it holds 1 000 000
descriptors, and the only line about its fill was the warning when it is
completely full, so a log could not show how close a title gets.

The newer retail title makes a view heap of 1 245 184 slots. Another
project (VIctory xcl-dev#747, RTX 4070 Ti) measured about 1.1M of its slots
written and its descriptor tables reaching the top of the heap. Whether
that costs XCL pages depends on how the slots are written (device calls
or memory copies), which no log shows today.

The shared heap now counts the descriptors and pages it gives out and
logs once, the first time each of 25 / 50 / 75 / 90 % is reached:

  console descriptor heaps: the shared heap is 25 % full – 250368 of
  1000000 view descriptors given out, 489 pages placed, high-water mark
  250388

The levels are of the descriptors given out to view heaps' pages. The
line also gives the high-water mark, because the full warning comes from
that: it counts the 20 descriptors below the pages (null views and the
memory windows' views), and released ranges, though merged, can leave
gaps too short for a page, so the heap can be full before every
descriptor is given out.

The check runs only when a page is placed, not per slot. The
XCL_TRACE_FRAME view-heap census line also says how many of each heap's
pages are placed in the shared heap. No behaviour change.

Assisted-by: Claude Code (Claude Opus 5.5)
@throny throny added off-goal Does not bear on the current goal (world loading); waits until it is reached and removed off-goal Does not bear on the current goal (world loading); waits until it is reached labels Nov 25, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

@RavenCurseBurg

RavenCurseBurg commented Nov 25, 2026 •

Copy link
Copy Markdown

I reproduced the conflicts in scripts/pr_check.py and scripts/test_pr_check.py. The tested merge commit keeps the sampled-frame comparison together with main's required smoke-field checks and template tests. Its parents are the PR head fd323c0 and main at 3f2777019544. The PR branch can fast-forward to it.

  • python -B -m unittest discover -s scripts -p "test_*.py" passed all 29 tests. test-smoke-lit.tests.ps1, smoke-title.tests.ps1 and test-smoke-artifacts.tests.ps1 each passed on Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9.
  • In each shell I drove smoke.ps1 -Xcl <stub.cmd> -OutDir <fixture> with six synthetic frame reports under a German locale. The child saw XCL_FRAME_DUMP=120, the caller recovered its previous value, the report copy matched the input and the manifest retained the title and frame count.
  • I paired the generated blocks for five local checker invocations per shell, labeling the baseline block with the tested main SHA. A PR at 0.4% failed against 50.1% or 80%, and passed against exactly 50%. Both 1% and an unsampled frame passed against 80%.

Windows 11 build 26100.9711, i7-13700, Python 3.14.3. Synthetic reports only. No captured retail frames, runtime build or GPU suite. OpenAI Codex (GPT-6) resolved the conflicts and ran the tests.

@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 30, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head fd323c0

No other open PR adds a lit/black-frame line to smoke.ps1 or a check of it to pr_check.py. The last_frame_dump fields it reads (sampled_pixels, non_dark_samples) are on main.
Two points: smoke.ps1 now always sets XCL_FRAME_DUMP=120, so every smoke run also does a readback and writes a BMP every 120 frames. A main block made with the old script has no lit at end line, so the check is skipped for it. The branch conflicts with the current smoke.ps1 / pr_check.py.
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

off-goal Does not bear on the current goal (world loading); waits until it is reached stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scripts: the smoke block can't tell a black screen from a working title

10 participants