xcl run: scripted XCL_PRESS_* times count from guest entry, not host start #2933
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2933"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by 3L1A5-1 on 2026-11-27T00:49:52Z.
XCL_PRESS_AT/XCL_PRESS_A_ATcompared their schedule with the host's uptime (log::uptime(), the log's clock). The startup shader preparation runs before the guest is entered (host.rs,preparation::before_guest) and can take longer than the whole script, so on a cold preparation (about 38 minutes on the machine below) every scheduled press was already in the past when the title first polled its input: the title then stayed on its first screen for the whole run.The schedule now counts from the moment the title's entry point is called (after preparation and loading); before that nothing is pressed. The log's times are unchanged.
What is in it
crates/xcl/src/log.rs:mark_guest_entry()records the instant,guest_uptime()returns the seconds since it (Nonebefore).crates/xcl/src/loader.rs: one call tomark_guest_entry()inmain_thread, immediately before the mapped entry point is called (moved there fromhost_mainafter review: ettehn measured that the earlier marker still lost ~0.4 s of the schedule to runtime init and loading).crates/xcl/src/hle/gameinput.rs:scripted()usesguest_uptime()through a purepress_held(at, t); the doc comments forXCL_PRESS_*now say the schedule counts from the title's entry point. New unit testscripted_presses_count_from_guest_entry. (README does not mentionXCL_PRESS_*;HANDOFF.mdline aboutXCL_PRESS_A_AT=s1,s2…("at those seconds") is still right if read as "of the run", not edited.)Tested
cargo check -p xcl: ok.cargo test --workspace --no-fail-fast -- --test-threads=4on this head2a318283(aftercargo build --workspace): 1446 passed, 1 failed, 47 ignored. SKIPPED lines: 29 (21 no wave64, 3 no D3D12 debug layer, 3 f16 per-lane form refused (#1426), 1 cannot disable the driver cache, 1 no heap windows). The one failure ishle::d3d12x::list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submit(segment count 199 vs 421). It passes when run alone, 2 of 2 on this head and 2 of 2 on main8b957bec, so it looks like a parallel-run flake in code this PR doesn't touch. The first commit1286ef91had 1447 passed, 0 failed.press_heldtreating "guest not entered" as a time inside the schedule (the old behaviour: the preparation time counts) it fails withleft: 4, right: 0(an A press fires during preparation); with the fix it passes.nvidia-deveff3bcab(same code ingameinput.rs) after a 38.5-minute cold preparation. AllXCL_PRESS_A_ATpresses had fired before guest entry, and the title stayed on its first screen (0 DirectStorage reads, flat draw count). The same script with a warm cache (preparation ~1 min) reached the world. That run was not repeated with this fix.Regression run
Two 60 s
scripts/smoke.ps1runs on the same title, back to back, warm shader cache, on the machine under Tested (RTX 2060 SUPER 8 GB). Both runs had the same environment set in the calling shell (our usual 8 GB recipe; it keeps the shader cache warm on this PC):main
8b957bec:This PR's head
2a318283:Head: 0 device removals, 0 crashes, 102 % of main's frames, 99 % of main's peak commit.
XCL_PRESS_A_ATis in that environment. In the main run its early presses fired during the preparation, and in the head run they land after the title starts (the change itself). So the frame counts are a pass/fail check, not a measurement of the fix.Not tested
XCL_PRESS_A_ATset across a long cold preparation; the mechanism follows from the code and the unit test.scripts/smoke.ps1sets no press schedule, so the smoke runs only show that nothing else changed.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T00:56:46Z.
Paired native Windows test of actual guest-visible GameInput readings after startup preparation. Clean release
8b957bec6f82495aec940944c6bf47faa02db590vs1286ef910ba0c482d3f6f7e71d4cd1a105f584f1, RTX 5070 Ti Laptop / 621.24, Windows 11 26200.9974, Rust 1.97.1 MSVC, DXC/DXIL 1.8.2502.11. A synthetic test executable polled the XCL GameInput HLE for 750 ms from its ownmain; each launch built 1,120 PSOs from 160 synthetic shader records with a fresh XCL cache. All exited 0.XCL_PRESS_A_AT=0.3,XCL_PRESS_AT=0.4:B: base missed A and B in all three runs; head saw both in all three. Guest entry on the host clock was 1.349–8.236 s across these runs. This verifies the preparation-time fix throughxcl run, not just the helper.XCL_PRESS_A_AT=0.01,XCL_PRESS_AT=0.55:B, three more head runs missed A every time and saw B begin 138–149 ms into guestmain(roughly 0.40 s had already elapsed on the schedule clock at guest entry). The marker precedes runtime initialization and loading. If the intended origin is the actual guest entry point, I would move the marker toloader::main_threadjust before calling the mapped entry point. If the intended origin is the end of preparation, the docs could name that directly.No retail title in this test. OpenAI Codex (6.2sol) assisted with verification.
Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T01:00:55Z.
Follow-up tested on top of
1286ef9: I moved the singlecrate::log::mark_guest_entry()call fromhost_maintoloader::main_thread, immediately before the call to the mapped PE entry point. This leaves the host log clock unchanged.Same native Windows / RTX 5070 Ti Laptop setup and synthetic GameInput guest as above, clean XCL caches,
XCL_PRESS_A_AT=0.01andXCL_PRESS_AT=0.55:B. The original head missed A 3/3 and delivered B at 138–149 ms from the fixture's Rustmain. With the marker moved, all three runs delivered A at 13.1–13.7 ms and B at 555.6–557.3 ms. Every run exited 0 and prepared 1,120 PSOs with 0 refusals. This verifies the mapped-entry origin for the two scripted input options. It does not cover input polled from TLS callbacks or a retail title. OpenAI Codex (6.2sol) assisted with the patch and verification.Imported from ivall/xcl. Originally posted by 3L1A5-1 on 2026-11-27T01:09:32Z.
Thanks @ettehn, that's a clear measurement. The entry point is the right origin. Adopted as
2a318283: the singlemark_guest_entry()call moved fromhost_maintoloader::main_thread, immediately before the mapped entry point is called. The docs now say the schedule counts from the title's entry point.cargo check -p xclpasses, and the gameinput, log and loader unit tests pass (16/0). The PR description is updated. The smoke blocks for the new head are still pending on our side, so this stays a draft until they're in.Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-27T06:03:31Z.
Heads-up on an overlap, so the two don't conflict: #2637 (frame-matched input rules) carries a fix for the same press clock in
da59a507. It addsgameinput::start_script_clock()with its ownINPUT_EPOCH, started inhost_mainjust beforeloader::run_main.@ettehn's measurement here applies to ours as well. That marker still sits before the TLS callbacks,
log::flush()and theCreateThreadofmain_thread, so it loses part of the schedule the same way. Yours, inmain_threadimmediately before the entry point, is the better origin, and keepinglog::guest_uptime()inlog.rsmakes it usable outside GameInput too.So our plan is to drop
INPUT_EPOCH/start_script_clock()from #2637 and drive both theXCL_PRESS_*schedule and the frame-rule timestamps from yourguest_uptime(), rebasing once this lands. If it helps, we can also run this head in the retail title on an RTX 5090. There, startup shader preparation takes about 60 s on a warm cache, and on main scripted presses are lost during it.AI use: Gemini (Antigravity) compared the two diffs; Claude Code (Claude Opus 5.5) checked it against
2a318283,da59a507and this thread, and wrote this comment.Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-27T19:03:13Z.
In-title check on an RTX 5090, as offered above.
2a318283againstmain8b957bec, both 200 s on a copy of the same warm cache with one exe name. Only scripted input:XCL_PRESS_ATA every 3 s from 6 to 54 s, no other presses. Both ended atXCL_RUN_SECONDSwith no removal.main8b957bec2a318283So, on the retail title, the schedule now counts from the entry point as intended. On
main, any schedule shorter than the preparation never reaches the title.Not tested: schedules that need presses during the TLS callbacks (the case @ettehn noted); AMD; a cold cache.
AI use: Claude Code (Claude Opus 5.5) ran both arms (t12) and wrote this comment.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-27T22:44:27Z.
claiming: native Windows AMD smoke on RX 7800 XT for head
2a318283, paired with main2c717a04. Queued behind the current GPU runs. ETA 00:30 UTC.AI-assisted (Codex (gpt-6.2-sol)). Aggregate results only.
Imported from ivall/xcl. Originally posted by moombathepilot on 2026-11-27T23:50:22Z.
<html>
AMD check of PR #2933 on an RX 7800 XT, driver
32.0.32029.2010, Windows build26300.9974. I built release XCL from the current PR head2a318283and its merge base8b957bec.I ran the same synthetic guest twice on each build. Its TLS callback delays entry by five seconds. After entry, it polls GameInput every 5 ms for nine seconds. Both builds used
XCL_NETWORK=0,XCL_PRESS_A_AT=2,XCL_RUN_SECONDS=20, andXCL_ACTIVITY=1, with separate data and DXIL cache directories.All four runs exited
0x0. The PR’s focused test,scripted_presses_count_from_guest_entry, passed (1 passed, 0 failed). This verifies the scripted press timing change throughxcl runand GameInput on this AMD system.Retail-title scope: On these commits, startup shader preparation could not be disabled with
XCL_PREPARE=0. A run with a deliberately small pipeline cap translated all 26,503 shader records but stopped before guest entry because 11,098 pipelines exceeded the cap. With null graphics, both builds entered the retail executable but crashed at the same game offset (+0x2478b96) before a scripted press was observed. These attempts do not establish a retail-title or world-loading improvement.AI use: OpenAI Codex (GPT-6) built both commits, wrote the synthetic guest, ran and compared the tests, and drafted this report.
</html>Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-28T00:18:09Z.
Closing out our earlier claim (#issuecomment-7229578155) and adding a second native Windows AMD data point alongside @moombathepilot's RX 7800 XT report (#issuecomment-7230446728, which already covers the synthetic GameInput PE verification on
2a318283).Tested
32.0.31035.1003, Adrenalin26.7.1), Windows 11 Pro26200.9974(25H2), Rust1.100.0MSVC, DXC/DXIL1.8.2502.11, release builds (--locked -p xcl).main2c717a043c8488938179fca81da4bb9e7913a358vs PR head2a3182839a42201d9ec4f2229c9f205b696832be.scripts/smoke.ps1 -Seconds 200 -StartupTimeoutSeconds 720, isolated matched warm DXIL/title-data copies per arm, startup shader preparation enabled (default),XCL_NETWORK=0,XCL_PRESS_ATA every 3 s from 6 s to 54 s.0frames shown,0GameInput first-press lines):main(2c717a043c8488938179fca81da4bb9e7913a358): logged a DXC memory-resource warning (0x8007000E) at139.9 sand exited with0xc0000409during shader preparation after832 s(940 swall including cache copy).2a3182839a42201d9ec4f2229c9f205b696832be): remained in startup shader preparation until the920 s(720 s + 200 s) smoke timeout (925 selapsed,1049 swall including cache copy) and was terminated before guest entry.Not tested
2a318283is covered by #issuecomment-7230446728).AI use
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-30T00:53:53Z.
NVIDIA and AMD full-suite run, to go with the reports above by moombathepilot, oni-swr, since none of them covers NVIDIA. Tested exact head
2a318283(on its base8b957be).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace --no-fail-fast -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::bridged_dpp_agrees_with_hlsl_on_the_gpu --skip hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap --skip gpu::dxil::fuzz_tests: 1435 passed, 0 failed, 45 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,dispatch_chain_native_wave64_builds_whole,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.scripted_presses_count_from_guest_entry.XCL_ADAPTER=radeon),cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 --skip two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs: 1445 passed, 0 failed, 47 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main53e85fb1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh,bridged_dpp_agrees_with_hlsl_on_the_gpu(no wave64 on this card) andtwo_pass_binds_set_the_shared_view_heap(heap windows are opt-in,XCL_HEAP_WINDOWS=1) fail the same way;gpu::dxil::fuzz_testsstays skipped as in earlier runs (seeds 70, 545, 1019 and 1507 failedCreateComputePipelineStatewithE_OUTOFMEMORYon this card; they passed on this main's baseline). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6).two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsfails on main too, since #2959 (#3441). (Edited: this line first named the wrong merge.) The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:12:08Z.
Triage (#1607) – head
2a31828No open or merged PR makes this change. On main,
gameinput::scriptedstill times presses fromlog::uptime()(host start).No problems found in the diff.
mark_guest_entryis set inloader::main_threadjust before the entry point is called, and nothing is pressed before it.Note: existing
XCL_PRESS_ATschedules (scripts/perf-run, smokeinput_schedule) now count from guest entry, so recorded schedules shift. #2984 documents these variables and may need the new wording.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T18:16:29Z.
Thanks for this. You found the same problem we kept hitting: on a cold shader preparation every scheduled press is already in the past. #3712 now covers it as an opt-in (
XCL_PRESS_BASE=frame: press times count from the first game frame). It leaves the default clock as it is, so anyone relying on host-start times sees no change, and it applies on current main, which this PR no longer does (conflict with #609'sXCL_PRESS_HOLD). So this one is superseded by #3712. If you'd rather keep the guest-entry default, say so there.AI use: Claude Code (Claude Opus 5.5) wrote this at throny's request.
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T18:18:04Z.
Closing: superseded by #3712 (opt-in
XCL_PRESS_BASE=frame), see the comment above. AI use: Claude Code (Claude Opus 5.5) at throny's request.Pull request closed