gpu: trace descriptor history and GPU-written Mesh arguments #3323
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3323
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3321"
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?
@wish131400 on GitHub · 2026-11-28 09:29 UTC · original
wish131400:gpu/mesh-argument-provenance→main· +685 −2 · 8 files · 2 commits · closed without mergingChange
Refs #3312. A zero indirect Mesh count can come from a missing or stale descriptor copy, an SRV pointing at the wrong scalar, or the consumer using a different argument offset. Add a source-built fixture that distinguishes these cases and an opt-in runtime descriptor-history diagnostic.
The fixture follows a Compute write of scalar
2, an SRV-driven updater writing(2,1,1), fenced post-write and pre-consume snapshots of the same 12-byte interval, and a guestExecuteIndirectMesh submission. It checks every pixel of the 4x2 scene-color target. Missing-copy, stale-copy, wrong-SRV-offset and wrong-argument-offset controls must fail the same positive oracle. A sixth process repeats the positive case with history disabled.X2W_D3D12_DESCRIPTOR_HISTORY=1records guest token bytes before publication, old/new shadow IDs, create/copy/overwrite order, descriptor identities, buffer SRV first element/stride and backing resources. CPU publication sequence is separate from GPU queue/fence evidence. The switch is off by default and adds no GPU commands or synchronization.The diagnostic supports this fixture and short startup reproductions only. It records the first 8,192 events and then truncates. Initialization or a large descriptor copy can exhaust that budget before a later producer runs; each copied descriptor counts separately. No filtering, delayed start or rolling history is implemented. Later integration history needs a separately targeted diagnostic. Arbitrary guest CPU stores are not intercepted. With
X2W_D3D12_VIEW_CONTENT_TOKENS=1, shadow-record IDs can be reused at different sequence points.Each fixture process explicitly prints
provenance debug info_queue=presentorinfo_queue=absent, and the driver requires this report. An absent queue leaves pixel/argument checks active but provides no evidence about debug-layer errors.Experiment, reproduction commands and limits are documented with the runtime switch. The fixture reuses the existing indirect Mesh executable and source-built shaders. Its WARP variant is in the PR smoke preset.
Verification
Tested merge commit
029dfefef4c273b5d9c5565fbff1ee2acfd9a3ca, which merges main44a3ad5aa9c679cc039b8cb8275738dd6e4405d2into the published PR head42a185536bfd5e9df81d786d55fceb48046f1b32. Conflict resolution preserves main's current smoke-test selections and native fixed-Mesh/MRT fixture alongside the provenance fixture.30 November 2026: Windows 10 Pro build 19045; NVIDIA GeForce RTX 4070 Ti SUPER; driver
32.0.15.7270; MSVC19.43.34810; DXC1.9.2609; Agility SDK 620; D3D12 debug layer enabled. GPU tests ran serially.Both builds passed. Each configuration produced:
The four skips in each configuration were
startup_indirect_mesh_warp,startup_mesh_argument_provenance_warp,native_fixed_mesh57_warpandnative_fixed_mesh57_mrt_warp: Mesh shaders are unavailable on this host's WARP adapter. Hardware tests passed. All six hardware provenance processes reportedinfo_queue=present, with no device removal or debug-layer ERROR/CORRUPTION messages.(2,1,1)(2,1,1)(0,1,1)(0,1,1)(0,1,1)(0,1,1)(0,1,1)(0,1,1)(2,1,1)(0,1,1)Mutation check: locally changed
src/startup_stubs/d3d12_capture.inl:855fromtrace_descriptor_history("copy", ...)totrace_descriptor_history("create", ...). The Debug build succeeded; the previously passingstartup_mesh_argument_provenance_hardwaretest failed its copy-history assertion, while positive pixel readback remained 8/8. Restored the mutation, rebuilt, and confirmed the hardware test passes again. The mutation is not committed.Also passed:
python -B tests/docs_links_check.py: 182 Markdown files, 728 links.python -B tests/bidi_controls_check.py: 2,695 tracked source, script and build/CI files.git diff --cached origin/main --checkbefore the merge commit.The previous head
42a18553passed Actions run 46130729442, including the provenance test on hosted WARP. Those historical CI results do not establish CI status for the new merge commit; its checks must run again.Evidence and follow-up
The fixture is original source under the repository's MIT license. Inputs are source-built or synthetic. Producer HLSL and submission/fences are native desktop D3D12; descriptor creation/copy and the indirect Mesh consumer use guest wrappers.
This supplies the fixture and diagnostic portion of #3312. Its matched integration acceptance remains outstanding: the reported 48 zero records were not reproduced. A matching integration must identify its scalar-input write and descriptor history, prove identical nonzero records at the same resource/offset, and show a Mesh submission changing scene color before composition. This fixture does not exercise translated gfx1013 producer code, guest queue preprocessing or XMem refresh. Keep #3312 open; integration work referenced in #3091/#3094 needs its own execution evidence.
AI-assisted implementation, conflict resolution and local verification.
@wish131400 on GitHub · 2026-11-28 10:50 UTC · original
Follow-up integration check, separate from the passing fixture in this PR:
I found an existing source-built scalar-input positive failing on the public #3250 head
7f97cb5b. The compiler succeeds, but the table-1/byte-64 scalar window is refused before dispatch, leaving all 288 result words at the sentinel. The integration head retainsscalar_windowmetadata but drops the bounded unplaced-window handling present in public #3094. The focused restoration and before/after evidence are reported on #3250, with source-only commit c6c7688b. Hardware: 7/7 related tests pass after restoration; local WARP: 2 passes and 1 native-wave32 capability skip. Existing negative assertions were unchanged.Two bounded local integration runs did not reach a valid Mesh argument capture. The later run reached native Compute attempts but stopped earlier in the rendering dependency chain: one PSO creation failure and two unsupported texture-UAV bindings, with zero translated draws/Mesh submissions. #3049 already supplies the relevant broader in-process texture binding work.
A separate original-source constant-store
WaveSize(32)shader confirms the local runtime prerequisite: the installed in-box Windows 10 D3D12 reports SM 6.5 and refuses thecs_6_6PSO (80070057), while an EXE selecting Agility 620 reports SM 6.6 and creates the same PSO (00000000) on the same RTX 4070 Ti SUPER/driver32.0.15.7270. Enabling Agility for the test EXEs does not select it for another startup process. This is not proof of the captured PSO's only failure cause.The generic descriptor history also reaches its 8192-event truncation limit during initialization; it must be targeted before claiming complete later producer history. This PR remains draft and does not close #3312: the actual producer, same-resource/same-offset nonzero post-write/pre-consume records, and a real Mesh scene-color change remain unverified. No title assets, shader bytes, captures or private logs are included here.
@Leyukaka on GitHub · 2026-11-28 20:19 UTC · original · requested changes
Reviewed
42a18553by its diff. Writes go through the existinglog()only, tracing off costs one cached flag check, and the GPU readbacks wait on the fence. Three points:main.mainaddednative_fixed_mesh_fixtureintests/startup_indirect_draw_indexed.cppwhere this PR adds its#include "startup_mesh_argument_provenance.inl"; a rebase is needed.CopyDescriptorscan use the whole budget. A filter (address or heap range, slot, start after N events) or a ring of the last N events would make it usable; otherwise the docs should say it is for the fixture only.ID3D12InfoQueue. The test should print whether the info queue was present, since the docs list "no debug-layer ERROR/CORRUPTION" as part of the check.The PR is not marked draft on GitHub while your comment calls it a draft; marking it would match that. Request changes for 1-2.
@JohnConnorNPC on GitHub · 2026-11-29 13:05 UTC · original
I reviewed
42a18553by reading the diff and a trial merge into mainaf1cab5c; I built and ran nothing. Leyukaka's change request still applies, and I don't repeat it here. Two additions:git merge-tree --write-tree origin/main 42a18553conflicts inCMakePresets.json,docs/startup-runtime.mdandtests/startup_indirect_draw_indexed.cpp.src/startup_stubs/d3d12_capture.inlmerges cleanly, and in the merged file bothtrace_descriptor_historycalls still run withnote_lockheld exclusive. Please rebase.startup_mesh_argument_provenance_warp ... Passedand100% tests passed out of 74. On an export of the head,tests/docs_links_check.py(Checked 154 Markdown files and 676 links.) andtests/bidi_controls_check.pypass.MUST
None beyond Leyukaka's points 1 and 2.
SHOULD
None.
NIT
X2W_D3D12_VIEW_CONTENT_TOKENS=1reuses parked view records:take_parked_record()clears a record and gives its id to the next new view. With both switches on, anold=ornew=id in the history can name different views at different points in one run. The fixture doesn't set the token switch, so it isn't affected. One sentence in the environment row or the experiment note would stop readers from treating a reused id as a single view.AI-assisted.
@lukaslw-lab on GitHub · 2026-11-30 10:21 UTC · original · approved these changes
Reviewed
029dfefeby reading the diff; not built or run.Verdict: approve. The switch is inert when unset, and the history it records reflects the order shadow slots are updated in. It conflicts with
mainagain (below). No MUST.d3d12_capture.inl:851,:809). Unset,note_copyadds one cached flag check and skips bothtitle_descriptor_stridecalls.note_viewreturns fromtrace_descriptor_historyon the same flag. When the switch is on,title_descriptor_stridetakesdescriptor_lockbeforenote_lock, not under it, so this adds no new lock order.createevent reads guest bytes before*slot_ptrand the token write. Thecopyevents run undernote_lock, and the title-memorymemmovehappens only after the lock is released (:896-901). The per-indexto[i]/from[i]reads come before the shadowmemmove, so overlapping copies log pre-copy ids.:851-857). When the destination has no shadow slot,previousandnextare both 0. When the source is untracked,nextis 0, the same as copying an empty descriptor. In both cases the event doesn't say which view was copied:sourceis only the title address. A missing or stale copy is exactly what the diagnostic should catch, so asource_id=field (from[i]when tracked) would separate "copied an untracked view" from "copied nothing". The fixture reaches none of these branches, nor the 8,192 truncation: every event it checks is a tracked slot-18 SRV (check script:64-66).git merge-tree --write-treeagainstmain903fcc85conflicts inCMakePresets.jsononly (theprtest filter).Tests: the six processes pin the positive oracle and four controls against the same pixels. The trace-off run proves no
x2w-descriptor-historyline is written when the switch is unset. CI ranstartup_mesh_argument_provenance_warpat this head (Windows job:Passed, 87/87). The red Linux job isstartup_triage_run_check.pyon base44a3ad5a;mainhas fixed that since #3544.@Jess-Doit on GitHub · 2026-11-30 18:19 UTC · original
Reviewed
029dfefeagainst mainbee9c64d. Release build, diff whitespace, Markdown links, bidi controls and the portable oracle checks pass. Both in-box WARP cases skip on Mesh capability here, and our GTX 1060 has no Mesh shaders, so I ran no GPU positive.These are separate from lukaslw-lab's
source_id=point, which covers untracked slots:d3d12_capture.inl:851-857,:896-901). Thecopyevent records shadow ids only. The guestmemmoveruns afternote_lockis released and only when both ranges are title-backed with equal strides, and nothing records whether it ran or which guest token it carried. If a CPU write changes the source's guest bytes without touching its shadow, both slots stay tracked and the history still reads as a clean copy. Logging the source guest token and whether the guest copy happened, plus one divergent-token control, would catch that. A portable probe of the checker accepts a mismatched source token in the fixture's observations.:719,:728). A raw SRV and a typed 16-bit SRV over the same buffer can log the same first element and zero stride while covering different bytes. Format, raw flag and element count, or the decoded byte range, would let the history tell them apart.:704,:851). Once the truncation marker is written, a large copy still loops over every descriptor under the exclusive lock. It could stop there.The
CMakePresets.jsonprfilter conflict lukaslw-lab mentioned is the only one I see againstbee9c64dtoo.AI-assisted.
Ready for more review
@Vilify-13 on GitHub · 2026-11-30 19:57 UTC · original · edited 2026-11-30 20:00 UTC
<html>Independent reproduction and proposed follow-up
I've independently reproduced
029dfefef4c273b5d9c5565fbff1ee2acfd9a3cain both Debug and Release configurations.Test environment
OS: Windows 11 Home 26H2, build
26300.9974GPU: NVIDIA GeForce RTX 4060
GPU driver:
32.0.16.2114WARP driver:
10.0.26100.9818MSVC:
19.44.35230DXC:
1.9.2602.17D3D12: Installed Windows runtime, without a separately provisioned Agility SDK
Debug layer: Enabled
Verification
GPU tests were executed serially using the reproduction commands documented in this PR:
The reproduction used the unmodified PR revision and source-built fixtures.
Proposed contribution
Building on the descriptor-history implementation in this PR, the event-budget limitation identified by @Leyukaka, and the post-truncation traversal observation from @Jess-Doit, I'd like to develop a focused follow-up addressing targeted descriptor-history filtering.
The proposed scope is:
Apply optional descriptor-range filtering before event-budget consumption and guest-token sampling.
Match descriptor copies against both source and destination ranges.
Calculate matching descriptor indices efficiently, avoiding unnecessary per-descriptor diagnostic traversal during large copies.
Terminate diagnostic-only traversal once the event budget is exhausted.
Add source-built regression coverage demonstrating that unrelated initialization events do not prevent relevant later descriptor history from being captured.
Measure diagnostic traversal overhead and perform mutation testing to verify the new regression coverage.
I'm currently evaluating absolute-address and heap-relative filtering, particularly how relevant descriptor ranges can be identified reliably across separate executions.
The intention is to preserve existing unfiltered behavior, descriptor-copy semantics, lock ordering and GPU synchronization.
I would keep the other diagnostic correctness findings raised during review outside this initial contribution so that each change remains independently reviewable.
This follow-up would reference #3312 and depend on #3323. It would not claim to satisfy #3312's remaining integration acceptance criteria.
Are you currently working on targeted descriptor-history filtering, or would you be comfortable with me developing this as a separate follow-up contribution?
AI-assisted architectural research, implementation planning and independent verification.
</html>@Vilify-13 on GitHub · 2026-12-01 17:25 UTC · original
Targeted descriptor history follow-up — implementation complete
@wish131400
Following the previous comment, I've finished work on the targeted descriptor-history filtering implementation, including compatibility integration of your contribution against upstream revision
959306d4.Verification results:
The implementation introduces optional heap-relative filtering, source and destination range selection, bounded history admission, conservative descriptor attribution, and early termination of diagnostic traversal following truncation.
Given the existing merge conflicts in #3323, I'm preparing an integrated upstream draft PR that incorporates your original contribution with preserved Git authorship, followed by a separate commit containing the filtering implementation, regression coverage, and documentation.
Credit will also be given to @Leyukaka and @Jess-Doit for their relevant review findings.
The contribution will reference #3312 without claiming to satisfy its remaining integration acceptance criteria.
Thank you for establishing the foundation for this work. Any feedback during the review process is welcome.
AI-assisted implementation, testing and verification.
@Vilify-13 on GitHub · 2026-12-01 21:18 UTC · original
@wish131400 Heyo, following up regarding this after the reviews on PR #3774
The remaining blocking concern is coordination between this PR and #3774. Would you prefer to land your PR independently first, after which I would rebase #3774, or would you be comfortable with #3774 superseding this PR? I'm perfectly fine with either way you'd like to handle it.
@Leyukaka on GitHub · 2026-12-02 21:03 UTC · original
#3893 carries this PR's commits rebased onto current
main, together with the other of #3323 / #3774, with the original commits, authors and messages unchanged. Are you fine with closing this PR in favour of it? If you would rather land your own, say so and I will close #3893 instead.@wish131400 on GitHub · 2026-12-03 12:22 UTC · original
我会关闭#3321,接受你的提议
Pull request closed