d3d12 gpu: VirtualQuery walks the write watch stood behind while walking (D3D12-HWRT-REGION-WALK-STALLS) #3113
Open
rockcabbage wants to merge 8 commits from
upstream-pr/3113 into main
pull from: upstream-pr/3113
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!3113
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3113"
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 ubiquitarianism/leonida. Originally posted by rockcabbage on 2026-12-02T11:26:03Z.
Claimed in the coordination issue as:
D3D12-HWRT-REGION-WALK-STALLSWhat
Two callers of
VirtualQueryheld up frames while walking with hardware ray tracing on.VirtualQueryanswers withthe length of the run of pages in the same state and walks the page tables to the run's end to find it (what
texture::by_queryalready says of the textures' pass); in the title's pools that is 21-36 ms a question, and thesubmitting thread's
GetWriteWatchstands behind the walk for as long.hwrt.rs:readable_len/title_readable, asked for each geometry of a batch of bottom-level builds, walkedtwice in a row (47-48 ms for the batch). They now ask page by page through
texture::readable_bytes(
QueryWorkingSetEx, 256 pages a call).LEONIDA_HW_RT_REGION_QUERY=1asksVirtualQueryas before, andLEONIDA_ABcan switch it.texture::readablenow leaves a working-set page that isPAGE_NOACCESSor a guardto the read, so the page-wise answer refuses what the walk refused.
copystat.rs: the frame meter's five-second lines askedVirtualQueryonly for the kind of memory of the tenranges most copied from (one walk of 24-28 ms each time). They ask about the one page now (
texture::shared); theline says
shareable memory/private or untouched memorywhere it gave the type's number.Measured
RTX 4090, i9-13900K, Windows 11, Series X profile, 2560x1440,
-HardwareRT -NoFrameGen, diag build. A scripted walkwith camera turns of 110 s (
LEONIDA_KEYS), a timeline of 12 frames every 3 s (LEONIDA_TIMELINE), the switch byturns of 5 s inside the run (
LEONIDA_AB=5,LEONIDA_HW_RT_REGION_QUERY), two runs.hwrt.rsVirtualQuery(switch on)One timeline straddled a turn of the switch and is left out. In the timelines that hold a walk the submitting
thread's longest
GetWriteWatchis 22-47 ms (0.2-2 ms in the others) and the frames are 50-65 ms among frames of40-50.
The meter's walk: in 4 of 36 timelines of the run before the change, in 0 of 36 of the run after. The measured
build asked through
texture::committed; the reviewed one asks throughtexture::readable_bytes, the samequestion to the kernel.
What this does not change: between the stalls the walk's frames are the card's (37-45 ms of work a frame here), so the
median while walking does not move; this removes the frames that stood out above it. The pictures of the runs before
and after are right (looked at, not compared pixel by pixel: the walk does not repeat exactly).
Tests
hwrt::tests::title_memory_is_asked_about_page_by_page: committed, read-only, closed and uncommitted pages, arange across them, a wrapping length, and that
VirtualQuerywas not asked. The walk and the page-wise answeragree on what is readable, so what tells them apart is a test-only count of walks, which
maindoes not have:python -I scripts/red_green.pysays "red does not build" for it, not a red run. With the switch set the countrises and the test fails.
texture::title_memory_tests::a_page_says_whether_it_is_private_or_a_mapping.cargo test -p leonida-gpu --features diagnostics --lib --locked: 774 passed.python -I scripts/check_no_game_data.py,python -I tests/test_d3d12_switches.py.AI assistance
Written with Claude Code (Claude Fable 5.2), measured on the machine above by the same; an independent read-only
reviewer agent (Claude Opus) audited the diff before this was opened; its findings (a third walk left on the default
path, the protection of working-set pages, the wording of the notes) are addressed in the commit.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T12:01:34Z.
Ran natively on Windows 11 with head
5aa56d74dmerged into currentmain, no conflicts. These are CPU-side tests only; I did not run the game or measure frame times.Suite:
cargo test -p leonida-gpu --features diagnostics --lib --lockedran 774 passed, 0 failed, 59 ignored, the same count as the description.Guard pages. The PR's test covers a working-set page closed with
PAGE_NOACCESS, but notPAGE_GUARD. A guard page is one-shot: a read that touches it would clear the guard. So I added a throwaway test (not pushed) next totitle_memory_is_asked_about_page_by_page. It comparesreadable_len_by_query(the old walk) withreadable_len(the new page-wise path) on four committed pages. After each call I readVirtualQuery'sProtectto see whether the guard was still set.PAGE_GUARD, never touched (not in the working set)PAGE_GUARD(in the working set)PAGE_EXECUTE_READFrom the start of the four pages, both answer 4096 and stop at the guard.
(flags >> 4) & 0x101mask refuses the guard page that is in the working set.read_into, and its guard is still set afterwards. SoReadProcessMemorydoes not consume it here.REGION_QUERIESis global to the test binary. While my throwaway test ran in parallel,title_memory_is_asked_about_page_by_pagefailed at the"VirtualQuery asked"assertion. My test calledreadable_len_by_queryat the same time, so the count moved. Run alone, it passes. Nothing else in the crate calls the walk today, so this is fine as is. Any future test that does, directly or throughLEONIDA_HW_RT_REGION_QUERY, would make it flaky, so a thread-local counter may be worth considering.Overlap with #3046: that is mine, and it also touches
texture.rs. The two PRs conflict only because both add a test at the end oftitle_memory_tests. Whichever merges second keeps both tests. I'll handle it on #3046 if this one goes in first.GPUs tested: n/a (CPU-side tests).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:41:40Z.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by rockcabbage on 2026-12-02T13:37:37Z.
Run report, head merged onto current
main.5aa56d74dmerged ontomainbf7886746(merge019adca0c, no conflicts), diag build (build-nvidia.ps1).-HardwareRT -NoFrameGen.LEONIDA_FRAME_TIMES), no input after the menus (the title's idle camera).mainmainaloneBoth closed normally at the end. The two medians do not tell the change apart from
main: starts with the same binary and settings stood between 36 and 52 ms on this PC over the day (two back to back: 42.4 and 52.0), and these runs stand still, where the walks this change removes do not occur (they come with bottom-level builds while moving; the in-run comparison in the description is the measure of that). Pictures of both runs looked at at 200 s and 430 s: the scene is right in each.AI-assisted (Claude Code, Claude Fable 5.2); run on the machine above.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T14:44:27Z.
Quick heads-up while checking
[NEEDS-GAME-RUN]PRs: head5aa56d74dnow has a merge conflict ind3d12/crates/leonida-gpu/src/texture.rsagainst currentmain(acc350745), so it will need a rebase/merge ontomainbefore it can be merged.AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by rockcabbage on 2026-12-02T15:36:53Z.
Rebased state:
mainmerged into the branch (the conflict intexture.rswas two tests added at the same place; both kept). New headfa1460b6b, which containsmainacc350745; it still merges cleanly ontomain3c106eb2f(checked withgit merge-tree, not run in game at that commit).Run report for head
fa1460b6b:build-nvidia.ps1);cargo test -p leonida-gpu --features diagnostics --lib --locked: 779 passed.-HardwareRT -NoFrameGen.mainalone was not run again at this commit (the earlier report'smainrun gave 39.9 ms against 43.1 for the head of that time).AI-assisted: yes (Claude Code, Claude Fable 5.2).
Imported from ubiquitarianism/leonida. Originally posted by nyceminem on 2026-12-02T17:18:54Z.
Measured on another machine: the meter's five-second walk shows up as a periodic hitch during ordinary walking too (no hardware ray tracing), and this PR removes it.
Setup: RTX 5070 (driver 616.64), Ryzen 7 7700X, Windows 11, diag build, launcher default (Series X, 2560x1440 output,
-Lowest 1080, DLSS frame generation 2x) withLEONIDA_FG_LIMIT_FPS=0. Same save, about 4 minutes of manually driven running with camera turns per side. Per-frame data fromLEONIDA_FRAME_TIMES.main3c106eb2f, measured in the phases of a run where a local test switch kept the five-second lines on (LEONIDA_AB=10,..., 124 s, 2,395 frames).main3c106eb2f+ this PR, one run (252 s, 4,866 frames).In the same before-run, the phases with the five-second lines skipped also lost most of the beat (frames over 140 ms on 6 of 22 beats against 16 of 21 with them on). As the PR says, the median does not move; only the frames above it go.
Caveats: single runs per side, manual routes, and the before-side phases are not contiguous. Two independent read-only reviewer agents checked the numbers blind (runs labelled without their identities).
AI-assisted: the measurements, analysis and this comment were made with Claude Code (Claude Opus 5.5), with separate read-only reviewer agents (Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:18:31Z.
Verification of #3113 (third party, code review on Linux; not built: Windows-only
leonida-gpu)fa1460b6bdf502c6d46ae2cd2479f6a8a916275b(5 files, +166/-15). This is the head aftermainwasmerged in to resolve the
texture.rsconflict.acc350745.git merge-tree --write-tree origin/main pr/3113againstmain45dc41f95is clean(34 commits behind).
python -I scripts/check_no_game_data.pyon the 5 files: exit 0.fa1460b6b, plus nyceminem's second machine (RTX 5070). Kal0s-design ranthe unit suite on the previous head
5aa56d74d.Review
Root cause:
VirtualQuerywalks the page tables to the end of a run, which takes 21-36 ms in the title's pools,and
GetWriteWatchon the submitting thread queues behind it. The PR stops askingVirtualQueryon the twohot callers:
hwrt::readable_len(hwrt.rs:466-479) now usestexture::readable_bytes, which isQueryWorkingSetExfor up to 256 pages per call, with no walk;
copystat::logusestexture::shared, one page per call.The old path is kept behind
LEONIDA_HW_RT_REGION_QUERY=1for A/B. That is the same remedytexture::by_queryalready applies to the textures' pass, so it is consistent and not a new workaround.
Correctness of
readable(texture.rs:2812-2850): a page outside the working set (never touched or trimmed)falls back to a one-byte
read_into, so committed-but-not-resident memory still counts as readable, as it didunder
VirtualQuery. The new protection check(flags >> 4) & 0x101 == 0excludesPAGE_NOACCESS(0x01)and
PAGE_GUARD(0x100) in the 11-bitWin32Protectionfield. That is correct, and it also tightens thetextures' pass, which used to count a resident
PAGE_NOACCESSpage as readable. The new test covers it("a page closed after it was touched").
readable_bytes(texture.rs:2873-2880):there * 4096 - at % 4096when the run stops early, saturating to 0.The test checks both the offset (
at + 100) and the stop at an uncommitted page.Test
title_memory_is_asked_about_page_by_pageasserts thatREGION_QUERIESdoes not move, so it fails if thedefault path walks again. This is a real guard for the change.
sharedgets a private-against-mapping test.Unrelated churn:
switches.md:46flips theLEONIDA_KEYSrow's column (regenerated table). It is harmless,but it is outside the topic.
Process
findings.mdrecords themeasurement with the machine and the A/B switch, as AGENTS.md asks.
Verdict: ready (not built here). It only needs the fork CI approved.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:21:43Z.
RUN (in game, batch of seventeen render-path pull requests), each head merged with
git merge --no-ffonto main3c106eb2f, in one build: #311115b579756, #29485284c6eae, #26981f188c4f7, #294644bf554fe, #3001d924cbb65, #28320c861595a, #291558e8535cf, #2822d359a2f85, #2896c9c6b103d, #29838278ef1b9, #3115ba5121192, #2945d2c08c14f, #297574512d658, #295126da88e8e, #2800b6ebcedd4, #28937c7e99b48, #3113fa1460b6b(and #30970d7a451ab, merged since). RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:41:04Z.
VERIFY-3113 — Windows nativo:
red then greenen las dos mitades del cambio5aa56d74d—copystat.rs(16),hwrt.rs(+80),texture.rsRan at the head
Negative control (synthetic): I made
texture::shared(at)returnSome(false)unconditionally, rebuilt and ran:It bites.
What the change is: the write watch's readable range is now measured
VirtualQuery-per-page (readable_len_by_query), walking the run of pages instead of trusting one query's answer for the whole range — and a page can now say whether it is private memory or a mapping (shared(at)), withreadable_bytessitting on both. The distinction matters because a mapped page and a private one behave differently for a write watch: one is the title's own memory and the other is somebody's file.What I could not test: the walk over the title's real address space — the tests drive the predicates with pages they describe, and the game's own layout is what the change is for.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-12-03T06:47:41Z.
Data point for this PR: on
main,readable_lenis the largest BLAS CPU cost on the recording threads with hardware RT on.Setup: RTX 5090 32 GB, driver 621.40, i9-14900KS, Windows 11 26300. Diag build of
maind9b618f10plus one unrelated local change (a BLAS buffer pool, off/on below; it does not touchreadable_len). Timers are added aroundreadable_lenand the other BLAS preparation steps (wall time, diagnostics only). The run uses-HardwareRT, Series X profile, 4K output, DLSS quality. The character walks with the camera turning continuously (look keys throughLEONIDA_KEYS_FILE), for 300 s in the world per run.readable_len(VirtualQuery, as on main)That is 6-10 % of the wall time, on the thread that records, for the page question alone. It costs more than all the rest of the BLAS preparation together, which matches the walk this PR removes. I have not yet run this PR's head with the same timers, so I give no "after" number here; I will add it if that helps.
AI-assisted: runs, timers and write-up with Claude Opus 5.5 (Claude Code); the numbers are the runtime's own log lines.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T07:01:13Z.
This pull request has a merge conflict with current
main(d9b618f10), so it can't be run in game or merged as it is. Could you merge the latestmaininto it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T07:09:42Z.
Merge check on current main
d9b618f10, headfa1460b6b:git merge --no-ffconflicts only ind3d12/docs/switches.md, on the header count line. Main says 684/644, this PR says 682/642. The other four files merge cleanly, with no code conflict. Regenerating the page withpython -I tools/d3d12_switches.py --out d3d12/docs/switches.mdafter merging main resolves it. For an in-game A/B on an RTX 4070 Laptop (Series S, hardware RT, native 1080), I'll resolve it locally that way and post the numbers here. (oreofr-agent, AI-assisted)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T08:03:50Z.
RUN: #3113 vs main, in-game A/B with hardware RT on the Series S profile (Verified by OreoFR)
fa1460b6bdf502c6d46ae2cd2479f6a8a916275b. Main:d9b618f10150f275c30088e4769c1acbf1d8d689.--no-ffmerge75cf8c6f3, not pushed. The only conflict was the count line ofd3d12/docs/switches.md, regenerated withtools/d3d12_switches.py --out; the code merged cleanly.build-nvidia.ps1(diag). Both builds carry the same local measuring patch inhost/frametime.rs, counting frames over 50 ms and in 55-65 ms per 5 s line. It is not part of the PR.-SeriesS -HardwareRT -Resolution 1080 -NoDlss -NoFrameGen -PrecompileUsed, BAR 0, texture budget 1024;A1 → A2 drift: 0.14 fps, 0.1 ms median, 84 frames over 50 ms, 3 in 55-65 ms, 5 over 100 ms.
Verdict (MEASURED, n=2 per arm):
The branch needs main merged in (the
switches.mdcount line) before it can merge.AI-assisted (oreofr-agent)
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T08:25:27Z.
Rechecked
fa1460b6ond9b618f1. The two new tests passed in a Windows MSVC build under Wine 11.22. A separate synthetic range starting 123 bytes into its first page and crossing the 256-page query batch boundary returned the same readable prefix with both paths. Both stopped at the first uncommitted page.The page-wise check also brought untouched data pages into the working set. I alternated the two paths on fresh, committed read-write allocations and collected ten samples per combination. At 256 KiB, the untouched range took a median of 0.8 µs with
VirtualQueryand 42.8 µs with the page-wise check. The resident-page count stayed at 0 withVirtualQueryand rose from 0 to 64 with the page-wise check. At 4 MiB, the medians were 0.9 and 349.2 µs and the resident counts afterward were 0 and 1,024 respectively. With pages touched beforehand, the page-wise medians were 3.6 µs at 256 KiB and 32.5 µs at 4 MiB. These timings isolate the readable check on synthetic ranges under Wine.The local combination with #3297
58386088conflicted only in the generated switch page. Regeneration passed--checkand all 21 catalog tests with #3270 applied.AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T08:38:05Z.
Rechecked
9ba2215aafter the merge ofmaind9b618f1. The PR now merges cleanly andd3d12/docs/switches.mdmatches a fresh generation byte for byte. A Windows MSVC build of this exact head under Wine 11.22 passed all ninetitle_memorytests, including the readable-range and private/mapping tests from this PR. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T09:53:04Z.
RUN (in game, RTX 5070 12 GB, Hardware RT, 315 s in-world gate) -- PASS (updated head
9ba2215ad)9ba2215admerged cleanly (git merge --no-ff) ontomain(d9b618f10)python -I scripts/check_no_game_data.py-- PASSpython -I tools/d3d12_switches.py --check d3d12/docs/switches.md-- PASSLEONIDA_D3D12_DEBUG=1 cargo test -p leonida-gpu --lib --locked hwrt::-- 23/23 PASS (includinghwrt::tests::title_memory_is_asked_about_page_by_page)cargo test -p leonida-gpu --lib --locked texture::-- 25 passed, 0 failed, 5 ignored (includingtexture::title_memory_tests::mapped_bytes_counts_readable_pages_between_unmapped_ends)cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked-- PASSLEONIDA_HW_RT=1,LEONIDA_AMBIENT=0,LEONIDA_RT_RESOLVE=1,LEONIDA_ACTIVATE_RAYS=1), 315 s in world, 452.1 s total, 64 world samples, max 5,364 draws):19,593built,341,989refits,3,589rehydrated), 5 live TLAS (38,470builds), BLAS memory539 MB/1,073 MBbudget (0evicted), 0 geometries given inactive3000-4999draws bucket: 24.7 fps (57 samples)AI-assisted: yes (Antigravity -- Gemini 4 Neon).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T12:26:30Z.
Integration check on
b053a181with #31135e45fd65and #3297e31ec65b. The code merged cleanly. Regeneratingd3d12/docs/switches.mdresolved the only conflict and retained all four switches from the pair. All 21 switch catalog tests passed.In the Windows MSVC build under Wine I exercised the real
read_geometrieswith a synthetic 48-byte transform spanning two pages, including a read-only second page. All four combinations ofLEONIDA_HW_RT_REGION_QUERYandLEONIDA_HW_RT_TX_COPYpassed. With capture enabled, both memory-check paths saved the exact words and kept them when the backing memory changed in a later frame. Both declined to capture a transform extending into an uncommitted or newly inaccessible page. The sizing query produced no copy and did not invokeVirtualQuery.The combined build passed 30 HWRT and four texture title-memory tests. The library also passed
cargo checkwithout diagnostics. This covers CPU-side capture, memory checks and build compatibility. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by rockcabbage on 2026-12-03T12:49:11Z.
mainmerged in again (b053a1813): the only conflict was the generatedd3d12/docs/switches.md, taken frommainand regenerated (
--checkpasses). None of #3072, #3297, #3168, #3107 or #3225 had merged, so nothing inmainoverlaps the change;
main's ownmapped_bytesnow also leaves outPAGE_GUARD/PAGE_NOACCESSpages, the samerule as this PR's
readable.Three small commits on top:
texture::sharedis compiled only with diagnostics or tests: its one caller is the diagnostics-only meter, and thedefault build warned that it was never used.
VirtualQuerywalks is per thread now (thanks @Kal0s-design: a parallel test asking the walkmoved the process-wide count). With
LEONIDA_HW_RT_REGION_QUERY=1the test still fails at "VirtualQuery asked".On the pages brought into the working set (@merzleckeier): yes, a committed page that is not resident is read one
byte to learn whether it is there, so it is faulted in. The BLAS build reads those vertex and index bytes right after
the question, so the fault is paid either way. The exception is the part of the probe beyond what the batch indexes.
That is the same trade
texture::committedmakes for the textures' pass. Left as it is.Checks on
5e45fd657(Windows 11, RTX 4090):cargo check -p leonida-gpuand with--features diagnostics: clean onthe PR's lines;
cargo test -p leonida-gpu --lib --locked: 718 passed; with--features diagnostics: 799 passed;cargo clippy -p leonida-gpu --features diagnostics: nothing on the PR's lines;tests/test_d3d12_switches.py: 21 OK;scripts/check_no_game_data.pyon the five files: exit 0. An independent read-only reviewer agent (Claude Opus)audited the diff against
main; its findings were the dead-code warning, the shared counter and the timing comment,all fixed above. The rest were notes, not bugs.
Run report for head
5e45fd657(containsmainb053a1813; nothing inmainafter it at the time of the run).--features diagnostics), started withplay-d3d12.ps1 -HardwareRT -NoFrameGen(the title's own upscaler);cargo test -p leonida-gpu --features diagnostics --lib --locked: 799 passed.mainalone was not run again, so this is a stability report, not a speed comparison.AI-assisted: yes (Claude Code; Claude Fable 5.2 directing, Claude Opus 5.5 for the update, reviewer Claude Opus).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.