[removed by author] #990
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/996"
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 shortside on 2026-11-24T10:06:07Z.
[removed by author]
Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T10:13:50Z.
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@02bfd1d(baseline 727 passed, 0 failed, 41 ignored on this box):One more passing test than the baseline: the CPU-clock timestamp path on a host without GPU timestamps is covered and green.
Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Imported from ivall/xcl. Originally posted by DTsordas on 2026-11-24T10:34:47Z.
Test report for #996 at
f242ea8: Windows, AMD RDNA4. The CPU-clock path stays off on a host with GPU timestamps.This covers the first point under Not tested: whether the new path is taken on Windows.
Tested
cargo test --workspace --no-fail-fast -- --test-threads=4atf242ea8: 725 passed, 0 failed, 41 ignored, 0 SKIPPED. Among them:a_60_hz_timestamp_frequency_is_no_gpu_clock,readback_u64_lands_after_the_queueandtimestamps_outside_unified_memory_land_after_the_queue.cpu_writes/list_xtimestamp tests and--test e2e, with--nocapture: "no GPU timestamps on this host" appears 0 times in their output. It also appears 0 times in the test title's own log (target\tmp\e2e\data\XCL.TestTitle\logs\xcl.log, backend "AMD Radeon RX 9060 XT"). The title's "D3D12.X: console command list memory methods (writes, timestamp, fill, copy, KickoffX, Wait32/64)" check passes with the GPU's own timestamps.Not tested
GetTimestampFrequency/GetClockCalibrationcalls, on Windows; noxcl-smokeblocks from here.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by shortside on 2026-11-24T10:39:59Z.
@Lucasyudi I only saw your timestamp plan in #258 (04:50 and 04:59) after opening this. I had searched issues and PRs, not the comments of that thread. You said it first, so this is your call.
This PR ends up at the same detection as yours (a 60 Hz queue) and the same answers for
GetTimestampFrequency/GetClockCalibration. It differs in how the value gets written. I hit the race you describe too: my first version wrote the clock from thecpu_writesworker, and the test title read 0 at+0x10right after its own fence. Here the timestamp instead goes throughwrite, like any otherWrite64BitValue*: the clock value is taken when the timestamp is recorded and the GPU writes it in list order, so nothing waits on the worker. The cost is that it is the record time, not the time the GPU got there. It is not stacked on #317.On
mac-on-main-wip(db065d8) + #750 + this, the title's "console command list memory methods" check passes 3 of 3 here (M5 Pro, CrossOver 26.3).Whichever you prefer: take this approach into yours and I close this one, or keep this one and I add whatever your version has that this lacks (your three unit tests, the 1 MHz threshold instead of my 1 kHz). I won't take it out of draft before you answer.
Imported from ivall/xcl. Originally posted by mikebuckets171 on 2026-11-24T10:50:34Z.
Passes on a second Apple silicon host, on the
gnullvmroute - and here the trigger that fires is the second one you built in.Host: MacBook Pro M5 Pro (48 GB), macOS 27.2.1, CrossOver 26 with D3DMetal, Rosetta 2, Rust 1.100.0,
x86_64-pc-windows-gnullvmwith LLVM-MinGW 20261117 (clang 23.1.6),--release --locked, test binaries under Wine, one test per process (--exact <full test path> --nocapture --test-threads=1).hle::d3d12x::list_x::tests::timestamps_outside_unified_memory_land_after_the_queue:base
02bfd1d: FAILED -panicked at crates/xcl/src/hle/d3d12x/list_x.rs:4981: non-UMA GPU timestamp never landed (top=0, bottom=0), exit0x65, after 5.34 s of polling. Same symptom the description reports.head
f242ea8: ok. 1 passed; 0 failed in 0.44 s, exit0x0, withWhich trigger fired, and why that matters. It is the "resolved to 0 on a queue that reached its fence" one, not the frequency gate.
note_host_timestamp_frequencyis wired intocreate_command_queue_x, and a lib test that builds its own device never goes through that wrapper - so on this host the fallback is not a rare second line of defence, it is the one that actually carries the library tests. Both paths exist for a title; for these tests only the fallback can fire, and it does, reliably, on the first timestamp write.Correcting one thing I posted earlier on #258, because it changes what your fix has to cover. I wrote that this host "has no readback heap at all" and that XCL's
D3D12_HEAP_TYPE_READBACKbuffer cannot be created here. That was wrong: the heap type is refused only in the initial states I first tried (GENERIC_READ,RESOLVE_DEST). InCOPY_DESTit is created fine, at 64 bytes and at 32768 bytes (TIMESTAMP_SLOTS * 8, the sizelist_x.rs:2118asks for),Mapwith no range andMapwith a read range both S_OK - which is exactly the shaperunner.rs:1442andlist_x.rs:2127ask for. So on this host the readback plumbing of the timestamp path works, and what fails is the content:EndQuery/ClearRenderTargetView/EndQuery,ResolveQueryDatainto that READBACK +COPY_DESTbuffer, fence signalled,Map(0, 0..16)S_OK → stamps 0 and 0. That makes your change the right one rather than a workaround for a missing buffer type: the query heap and the readback buffer are both there, they just never get a number in them.One number that argues for your
real.rshalf specifically. A plain D3D12 program on this host (no XCL) getsGetTimestampFrequencyS_OK = 60, andGetClockCalibrationS_OK with its GPU value equal to the CPU value (or 41-42 ticks below it) and advancing with wall time at ~10^6-10^7 ticks per run - i.e. the "GPU" clock it reports is already the host QPC at ~1 GHz. A title that reads both is given 60 ticks/second and a ~1 GHz-scaled value at the same time, so the error before this change is a factor of ~16.7 million, not just a zero. Making both answer from the clock is what removes that.What this change does not reach, as far as I can read the diff (not tested against a title).
timestamp()returns early with the clock whencpu_clock()is set, andreal.rsanswersGetTimestampFrequency/GetClockCalibrationfrom the clock, so XCL's ownWrite64BitValue*OfPipeXtimestamps and the port's frequency answers are covered. A title that callsBeginQuery/EndQuery/ResolveQueryData/Mapitself through the real queue is not intercepted by this change, and on this host such a query resolves to 0 - the test title makes neither call, so nothing here shows whether a real title does that. Flagging it because it is the remaining route to a 0, not because the PR should necessarily cover it.Host: macOS 27.2.1 (Apple silicon, M5 Pro), CrossOver 26, D3DMetal; local inference unloaded and the bottle's wineserver stopped for each run; the plain-D3D12 probe is a ~250-line PE with no XCL in it and reads no files. AI use: GPT-6 Luna built both trees, ran the test and the probe, and drafted this comment; the codes and timings are from those runs.
Imported from ivall/xcl. Originally posted by shortside on 2026-11-24T11:06:00Z.
@mikebuckets171 your reading is right, thanks. In unified memory the value is written by the GPU in list order; outside it, it goes through the
cpu_writesworker like every other value there, so the ordering gap @Lucasyudi described is untouched by this PR. My note above ("nothing waits on the worker") and the description said that too broadly. I have corrected the description and added both of your points under Not tested (the ordering outside unified memory, and a title's own timestamp queries).@Lucasyudi so the picture for your decision: this PR supplies the value and the frequency / calibration answers; your
q.Waitidea forcpu_writes::afteris a separate fix that both approaches would need.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T11:36:39Z.
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
cargo test -p xcl --lib timestamp: 2 passed, 0 failed —a_60_hz_timestamp_frequency_is_no_gpu_clockcovers the new CPU-clock fallback path, andtimestamps_outside_unified_memory_land_after_the_queuestill passes with the list_x changes.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:31:42Z.
Empirical test report (
f242ea82)Hardware / environment
rustc 1.100.0 (0ef1bc386 2026-11-09). DXC reporteddxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47). Cargo used the unoptimized test profile with incremental compilation and debug info disabled.Commands and results
cargo test --workspace --no-runexited 0 and built the workspace test executables.cargo test -p xcl --lib hle::d3d12x::cpu_writes::tests::a_60_hz_timestamp_frequency_is_no_gpu_clock -- --exactexited 0 with 1 passed, 0 failed, 0 ignored, 0 skipped, and 704 filtered out. Ran outsideInvoke-ArcTest.ps1withXCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1.f242ea8285368db7aba158f0966a0ece9376cc6c.Observed behavior
The fixture classified 0 and 60 Hz as unavailable GPU timestamp frequencies and classified 1 MHz, 25 MHz, and 1 GHz as GPU clock frequencies. On this Windows host the reported performance-counter frequency cleared the fallback threshold, and consecutive counter reads were nonzero and nondecreasing.
Not tested
The full GPU workspace suite and game smoke runs on main and the PR head were omitted. The focused fixture leaves D3D12 queue integration untested, including zero GPU timestamp readback, ordered timestamp writes, clock calibration, and behavior on D3DMetal under CrossOver.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr996-focused.logand published.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:32:06Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T17:00:51Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 4989Could a focused test exercise the queue's
GetTimestampFrequencyandGetClockCalibrationdispatch whencpu_clock()is enabled? The new threshold test covers detection, but it does not cover these vtable slots writing QPC frequency/current ticks to the title's output pointers. A regression through the queue hook would verify the reported clock matches the timestamps written by the fallback. AI-assisted review: I inspected the diff and existing tests; I did not run tests.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:36:47Z.
Triage (#1607) – head
f242ea8No open or merged PR falls back to the CPU clock for timestamps on a host without GPU timestamps; main has no such path. #317 touches the same functions, but for the console's OS-clock timestamp flags, as the description says.
The queue slots it overrides (16 = GetTimestampFrequency, 17 = GetClockCalibration) match main's
queue_dispatch. No problems found in the diff. The limits the description lists (the clock is read when the list is recorded, and writes outside unified memory still happen on the worker thread) are real, but they do not change the result on a Windows host. The branch conflicts with main.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Pull request closed