runtime, d3d12: both runtimes write an import call trace, and a tool compares two (RT-CALL-TRACE, D3D12-CALL-TRACE) #2807
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2807:github-pr/2807" git switch "github-pr/2807"
Open
leonida/mandy
ubiquitarianism wants to merge 9 commits from
github-pr/2807 into main
pull from: github-pr/2807
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2807
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/2807"
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?
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
Reviewers 0 approvals
Details
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
d3d12/apps/leonida/src/run.rsView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Claimed in the coordination issue as: RT-CALL-TRACE and D3D12-CALL-TRACE (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7296419849)
What and why
When gta6rt and leonida.exe stop at different places in the boot, there is no record of which import call they first handled differently. With
LEONIDA_CALL_TRACE=<new file>set, both runtimes now record every call through the import tables of the title's image and its DLLs (normal and delay-load) in one shared v1 text format. Unset, nothing changes:wrapreturns the import's address and no thunk block is allocated.tools/call_trace_rules.def: the rules both runtimes read (gta6rt includes it, leonida-loader parses it), so the two traces are comparable. Stack walks andRtlCaptureContext2are entry-only (a wrap frame would end the title's stack walk at the stub), and__vdeclvector math is skipped (its YMM arguments are not kept by the stubs).Eline, real return address) or wrapped (CandRlines with the return class). The stubs are registered for unwinding; the entry stub's unwind range ends before its final jump.LEONIDA_CALL_TRACE_MAX_MB(default 4096). The writer lock is taken with a bound of about 10 ms; a record that cannot get it is dropped and the next one writes# dropped N.RT_CALLER(), which sees through the wrap frame.tools/call_trace_diff.pypairs the two traces' threads (main first, then by start address and common call prefix), aligns each pair's calls and reports the first divergences: calls one side never makes, different return classes, different call counts, threads on one side only and calls still open at the end. It streams its input (two synthetic 1M-call traces: 14.0 s, 336 MB peak).Not run in game.
Tested
Windows 11 (26200), Visual Studio 18 (2026) MSVC, AMD Radeon RX 6800 (driver 32.0.21030.2001), rebased on
mainat66b5d0433:cargo test --profile diag -p leonida-loader --lib -- call_trace: 29 passedctest: 205 of 205 passed, 2 disabled (gameinput,gameinput_script, no SDL3 here)python -I tests/test_call_trace_diff.py,tests/test_call_trace_rules.py: OK;python -m compileall -q tools tests: OKscripts/check_no_game_data.pyon the changed files: OKOne full
ctest -j 8run failedcall_trace(and the unrelatedwindows_crash_monitor); both passed alone and in the next full-j 8run.case_dropped_recordchecks that a dropped call takes under 100 ms of wall time, which a machine running eight test jobs can exceed. The failing run's output was not kept, so that cause is likely, not confirmed.Verified by OreoFR on macOS 27.2.1, Apple M5, head
e2572082c, mainb7a1be296. Partial check: the Python tools, plus a Windows type-check of the D3D12 side.leonida-loaderdoes not build natively on macOS (it useswindows_sysandcore::arch::x86_64, on main as well), and the runtime side (gta6rt,runtime/shims/call_trace*.h,call_trace_test.cpp) was not built here.MEASURED
git merge-treeonto main gives no conflicts.test_call_trace_diff.pyerrors at import (tools/call_trace_diff.pydoesn't exist on main), andtest_call_trace_rules.pyfails. Green (main + this PR):test_call_trace_diff.py79 passed, 42 subtests passed (10.9 s);test_call_trace_rules.py9 passed.cargo check --target x86_64-pc-windows-msvc(no MSVC; theccbuild steps are replaced with stand-ins), main vs main + this PR, exit 0 on both sides. The sorted warning lists are identical:-p leonida-loader --tests0 / 0 (this compilescall_trace.rsand its 1,474-line test module),-p leonida19 / 19 (run.rs).READ IN CODE
d3d12/apps/leonida/src/run.rs,call_trace::open_from_env()?runs only whenLEONIDA_CALL_TRACEis set, andadd_moduleis called for the image, the title DLLs and the late-loaded DLLs. With the switch unset,add_moduleis called but (per the description)wrapreturns the import's address unchanged and no thunk block is allocated. I didn't run that path, so "no change when unset" is from the code and your description, not measured here.open_from_env()?propagates an error, so aLEONIDA_CALL_TRACEpath that already exists stops the title from starting, as the comment says ("the file must be new").ASSUMED
case_dropped_recordflake you describe are from your Windows run. Not reproduced. Not run in game, as you say.AI-assisted: Claude Code
Verified in all three layers it touches, on Windows, and none of them fails.
maind920d850dplus this head:Python (the two suites it adds):
C++:
Those three error lines are the test doing its job - it drives the refusal paths and prints them - and
call_trace_test: okis the verdict.Rust (six files under
d3d12/):That failure is not this pull request's: it is
mainfailing its own asset policy on two files over 640 KiB (leonida-gpu/src/host.rs,leonida-shader/src/emit/lower.rs), which #2815 fixes, and it fails identically onmainalone. Everything else in the workspace is green with this change, including the crates it touches.What I could not test: a real import call trace from a title - that needs the game and the two runtimes the note describes, and this is a 24 GB desktop, not the 8 GB laptop the trace was written for. The diff tool and its rules are what the 88 Python tests cover, and they are green.
One thing worth saying about the size: +6,558 across 23 files is a lot to review, and the shape helps - 795 lines of C++ test, 1,189 of Python tests, 731 of tool, 236 of rules, and the rest is the runtime hooks the notes describe. The tests are two thirds of it, which is the right ratio for a diagnostic that has to be trusted.
AI-assisted: yes - DeepSeek v4.1 (flash), which ran all three layers on the machine above.
Written with an AI assistant.
A heads-up for this pull request: the page of D3D12 switches (
d3d12/docs/switches.md) is written bytools/d3d12_switches.pyfrom the sources ofd3d12/, and 3 names this pull request reads are not on the page yet:LEONIDA_CALL_TRACE,LEONIDA_CALL_TRACE_MAX_MB,LEONIDA_CT_CHILD.Nothing checks that today, so the page has drifted before (it was a name behind when this was measured). A test that checks it is waiting to be opened (DOCS-SWITCHES-PAGE-CHECK), and it would make this pull request's CI red until the page is written again. One command does that:
It writes the page with the names in it and nothing else; the diff is the new rows.
Confirmed the Rust/C++ trace-cap mismatch under Wine on
e2572082c+6c7f6b60c. The stock C++call_trace_testpassed, as did the 79 diff tests and 9 rule tests. In a separate synthetic Rust child-process regression, a cap of0returnedOk(true)instead of refusing the setting before creating the trace. A local change to validate the configured range and format before opening the file made the new test pass for0,12x,1048577and whitespace-prefixed1. All 31 Rustcall_trace::testspassed in that build, including the existing 1 MiB truncation check. I used temporary trace files only.AI-assisted with OpenAI Codex.
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).
Ran natively on Windows 11, head
e2572082cmerged into currentmain(83046a713, clean merge). This adds what the thread does not have yet: the two writers side by side on the same synthetic calls, cost per call, contention, a kill under load, and malformed input to the tool. The cap parsing and the exit codes for missing headers or differing rules are already covered above, so I left them out.Stock tests (measured)
cargo test -p leonida-loader(whole crate, dev profile)call_tracefilter (dev profile)call_trace_test.cpp, built on its own with MSVC (the CMake target's warning and define flags, plus/std:c++20 /O2)call_trace_test: ok, 3 of 3 runspython -I tests/test_call_trace_diff.py/test_call_trace_rules.py(unittest)cargo clippy -p leonida-loader -p leonida --all-targets --features leonida/diagnosticscall_trace.rs,windows.rsorrun.rs1. The two runtimes write different names for the same import (reading, then measured)
call_trace.rscapsmodule!functionat 160 bytes and a module name incaller/startat 47.call_trace.hcaps them at 172 (Site::name) and 31 (ModEntry::name). Also, for an import bound to an unimplemented stub, Rust skipsclassify(wrap:bind == Unimplgoes straight to entry-only), while C++ callsdecide()first and returns the target untraced on a skip rule.I ran the same calls through both writers with throwaway children: a 200-character import name, a title module with a 40-character name, and an unimplemented import in
api-ms-win-crt-math-l1-1-0.dll(aCT_SKIP_MODULEprefix).leonida-hlewritesgta6rtwrites!and the name cut short)callerE ... unimpllineTo see what the tool makes of each one, I built three pairs of synthetic traces. In each pair, everything is the same except that one field, written the way each runtime writes it:
So each mismatch shows up as a divergence on every call it touches. As an illustration of how long decorated names get (this is not a claim about what the title imports): the system
msvcp140.dllhas 1,515 exports. 193 of them are longer than 160 bytes asmsvcp140.dll!<name>(133 are longer than 172, max 196). Cut to 160 bytes, only 1,407 names are still distinct (1,469 at 172), so truncation also merges different imports into one name on each side. Possible fixes: give both writers one limit, or write a hash suffix when a name is cut. Then apply the skip rules to unimplemented imports in both, or in neither.2. Cost per call (measured, release build, one thread, 10^6 calls each, a trivial target)
With these short names, a wrapped call writes about 72 bytes (115.1 MB for 1.6 M calls) and an entry-only call about 51. At that rate the default 4096 MiB cap holds roughly 60 million wrapped calls.
3. Contention (measured, Rust, production 10 ms lock bound)
There were 1.6 million wrapped calls in total, split over 1 to 64 threads that do nothing but call:
In every run there were no open C records, and the file had exactly two records per call plus one T line per thread. Throughput levels off at about 1.6 M calls/s for the whole process, and no record was dropped at any thread count.
4. Kill under load (measured, Rust)
A child ran 4 threads calling a wrapped import in a loop, then called
TerminateProcesson itself after 300 ms. Over 5 runs, the file held 60-81 MB of lines (15-20 views). Each file had 1-3 open C records, one per thread caught inside a call. I looked at the tail of one of the five: it ended on a complete line, with no NUL inside the content. The tool parsed every file, and a self-diff exited 0.5. Size on disk (measured, both writers)
The file grows in whole 4 MiB views and is never cut back to its content:
MAX_MB=1(Rust 1,048,507 B, C++ 1,048,558 B)MAX_MB=5(Rust 5,242,792 B)This is harmless for the tool, which strips the NULs. But a 1 MiB cap gives a 4 MiB file, so the README could say the cap counts content, not size on disk.
6. The tool on malformed input (measured,
python -I, 16 hand-made cases + 1,000 random mutations of a real 4-thread Rust trace)got 1 TAB-separated fieldson line 1)ValueError(Python's 4,300-digit int limit), process exit 1The last row is the only crash I found. It is artificial, but it exits with 1, the code the tool documents for "divergences". A
try/except ValueErroraround theint()calls inparse_trace, or a digit-length check, would turn it into a 2.Not checked: whether the title's real module or import names reach these limits, the full CMake build and
ctest(I built onlycall_trace_teston its own),cargo test -p leonida, the gta6rt shims that useRT_CALLER(), and any run in game. The contention numbers come from threads that only call, not from a title's mix.GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
Checked the Python side on Linux against current
main. Merged with today'smain, it now fails the switches-page test, and the Rust/C++ name-cap mismatch reported twice is still in the head. The Rust and C++ were not built here (Windows-only).python -I tests/test_call_trace_diff.pypython -I tests/test_call_trace_rules.pypython -I tests/test_docs_env_vars.pypython -I tests/test_d3d12_switches.pytest_the_tracked_switches_page_matches_the_sourcespython -I scripts/check_no_game_data.pyon the 23 changed filespython -m compileall -qon the changed.pyfilesDefects
mainnow tests that.d3d12/docs/switches.mdis generated from the sources. The PR readsLEONIDA_CALL_TRACE,LEONIDA_CALL_TRACE_MAX_MBandLEONIDA_CT_CHILD, which the page lacks (Neutron-0 pointed this out on 2026-12-01). Since thenmaingained the check, so CI will go red once it runs on a merge. Fix: mergemain, thenpython -I tools/d3d12_switches.py --out d3d12/docs/switches.md.d3d12/crates/leonida-loader/src/call_trace.rscapsmodule!functionat 160 bytes and a module name at 47.runtime/shims/call_trace.hcaps them at 172 (Site::name) and 31 (ModEntry::name). An import bound to an unimplemented stub also skipsclassifyin Rust (straight to entry-only), while C++ runsdecide()first. Both were measured on this head (merzleckeier under Wine on 2026-12-01; Kal0s-design natively today, point 1). Since the whole purpose is a diff of the two traces, a long name or a long module name gives a false divergence at the very first such call. Use one cap and one order, ideally taken fromtools/call_trace_rules.def, which both already read.GPUs tested:line in the template's form (CONTRIBUTING.md, "Disclosure and verification"). The body does give the GPU in prose.Not checked here: the C++
call_trace_testandcargo test -p leonida-loader(both Windows-only). fiestorra and Kal0s-design ran them green on Windows on this head.Verdict: defects. Regenerate the switches page on current
mainand make the two writers' caps and skip order agree. Then it needs a CI run and the requested render-path run.AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
RUN (independent run on Windows, head
e2572082c02cd261c64b8275447d900a81f9eca8, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)The merge is clean (no conflict). Windows 11, release profile, one shared target directory. No game files, no GPU run, no
leonida.exerunning during the builds.What the PR is. An opt-in import call trace (
LEONIDA_CALL_TRACE) for both runtimes plus a diff tool. It touchesleonida-loader,run.rs, the C++ runtime shims andtools/. It does not touchleonida-gpuor any diagnostics-gated code in it, so the GPU lib run below is a regression check on the merge, not a test of the change.Green
cargo test -p leonida-gpu --release --locked --libpool::tests::a_texture_gives_its_piece_back_when_it_goes); the test alone passed twice; the next full run 703 passed, 0 failedcargo test -p leonida-loader --release --locked --lib call_tracepython -I tests/test_call_trace_diff.pypython -I tests/test_call_trace_rules.pypython -I tests/test_docs_env_vars.pypython -I tests/test_d3d12_switches.pytest_the_tracked_switches_page_matches_the_sourcesThe
leonida-gpufailure is a flake in a pool test in code this PR does not touch. I did not runmainalone, so I cannot say whether it also flakes there.--features diagnosticswas not run: noleonida-gpufile is changed.Red
main'slib.rs(nopub mod call_trace),leonida-loaderno longer builds, becausewindows.rsuses the module. Trivially red.tools/call_trace_diff.pyandcall_trace_rules.defabsent (they do not exist onmain),test_call_trace_diff.pyfails at import andtest_call_trace_rules.pyhas 4 errors.call_trace.rs: size-cap check inWriter::linedisabled: 2 tests fail (the_size_cap_writes_truncated_once_and_stops,a_cap_between_wrap_and_seal_leaves_callable_thunks), plus the child-process cases.call_trace.rs: the dropped-record counter not incremented inlock_bounded: 2 fail (a_held_writer_lock_costs_a_record_not_a_hang,child_drop).call_trace.rs:Bind::Unimplno longer entry-only: 1 fails (an_unimplemented_import_is_traced_at_entry_with_bind_unimpl).call_trace_diff.py: return values never compared: 15 failures and 1 error.call_trace_diff.py: the ignore list for return values dropped: 1 failure.Review
open_from_envreturnsOk(false)when the variable is unset or empty.wrapreturns the target when no common stub is installed, so no thunk block is allocated. I did not measure this in game.docs/switches.mdis stale (defect).LEONIDA_CALL_TRACE,LEONIDA_CALL_TRACE_MAX_MBandLEONIDA_CT_CHILDare missing from the page, andtest_d3d12_switches.pynow fails on the merge withmain. Fix:python -I tools/d3d12_switches.py --out d3d12/docs/switches.md.runtime/README.mddoes list the two public switches.call_trace.rs:NAME_MAX160,MODULE_NAME_MAX47. C++call_trace.h:Site::name[172], module name[31].LEONIDA_CALL_TRACE_MAX_MB: Rust (open_from_env) silently falls back to 4096 on0or a non-number (.filter(|&mb| mb > 0).unwrap_or(DEFAULT)); C++ refuses it with an error. The PR text describes the C++ behaviour as the contract.# dropped N; a mutation of that counter is caught. Thunks are made after the cap so a bind in progress stays callable; a test covers it. Stub unwinding and fences were not reviewed beyond the tests.GPUs tested:line (a prior review also said so).case_dropped_record(a 100 ms wall-time check) underctest -j 8.Not covered
call_trace_test,ctest): not built in this run.leonida.exeorgta6rtwith the switch set, and with it unset, in game.leonida-gpuwithdiagnostics, andmainalone for the pool flake.d3d12_vulkan.mdandfindings.mdwere only searched for call-trace and trace mentions, not read in full.Verdict
PARTIAL. The new tests and the diff tool pass and the mutations are caught, and the switch is off by default. But the merge with current
mainfailstest_d3d12_switches.py, and the Rust and C++ writers disagree on name caps and on the MAX_MB parsing, which defeats the comparison the PR exists for. In-game run still required (none posted on this head).AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
RUN (in game, batch of five pull requests), each head merged with
git merge --no-ffonto mainef35d683e, in one build: #31764c31594b5, #2657c16b0424e, #2807e2572082c, #323097eefdee4, #32473e5887f65. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches today. These fps are a check that nothing fell over, not a measurement of a gain.
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. #3247 has since moved to
3dc6c58b3, which only mergesmain(81efe4566) into the head above:git diff 3e5887f65 3dc6c58b3leavesd3d12/scripts/play-nvidia.ps1andtests/test_win_launchers.pyunchanged. If another 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;
-PrecompileUsedwas used becausemainnow precompiles every known pipeline by default (88,631 for a new executable, over an hour on this card). The default start was therefore not exercised, and the F1 SAVE AND RESTART path of #3247 was not exercised in game. An earlier attempt of this batch is not counted: the run script gave up waiting while that full precompile ran.AI-assisted (Claude Code).
VERIFY-2807 — el runtime entero compila con esta PR (590 objetivos) y su test de C++ pasa:
call_trace_test: okEs la PR de C++ más grande de la cola (23 ficheros, +6 558, 13 en
runtime/), y la verifiqué compilando y ejecutando, no leyendo:Y el cambio, por su título: los dos runtimes escriben un rastro de las llamadas de importación — un
.jsonlde cada función del ejecutable que se llama, contools/call_trace_diff.py(731 líneas) para comparar dos rastros ycall_trace_rules.def(236) para las reglas.Lo que aporta y por qué es de las importantes: compara el runtime C++ con el port de
d3d12/llamada a llamada, que es la única forma de saber si el port hace lo mismo sin ejecutar el juego dos veces y comparar a ojo. Es instrumentación, y la instrumentación es lo que hace verificable todo lo demás.Lo que no pude verificar: un rastro real del juego — necesita el título con
LEONIDA_CALL_TRACEpuesto, y el test de C++ lo simula (y prueba los errores del camino de creación, que es lo que el test sí puede hacer sin el juego).Y el detalle que me hizo confiar en el test: imprime
error: …tres veces y sale 0 — son los casos negativos, y que el ejecutable los imprima y siga es lo que distingue un test de unassertsuelto.