Skip to content

gpu: trace descriptor history and GPU-written Mesh arguments - #3321

Open
wish131400 wants to merge 1 commit into
R0Y00:mainfrom
wish131400:gpu/mesh-argument-provenance
Open

wish131400 wants to merge 1 commit into
R0Y00:mainfrom
wish131400:gpu/mesh-argument-provenance

Conversation

@wish131400

@wish131400 wish131400 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Change

Refs #3310. 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 traces a source-built 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 guest ExecuteIndirect Mesh submission whose complete 4x2 scene-color readback is checked. Missing-copy, stale-copy, wrong-SRV-offset and wrong-argument-offset controls must fail the same positive oracle. A sixth process checks the positive case with tracing disabled.

X2W_D3D12_DESCRIPTOR_HISTORY=1 records guest token bytes before publication, old/new shadow IDs, create/copy/overwrite order, guest and desktop descriptor identities, buffer SRV first element/stride and backing resource. CPU sequence numbers are explicitly separate from GPU queue/fence evidence. The switch is off by default, bounded to 8,192 events, and adds no GPU synchronization. It does not intercept arbitrary guest CPU stores.

The test reuses the existing indirect Mesh executable and shaders. The WARP variant is in the PR smoke preset. Experiment, commands and diagnostic limits are documented alongside the runtime environment switch.

Verification

Tested commit 42a18553 on base 32dc3d7c3cdc4be79afdad4cc04709e76d99a795. Windows 10 Pro build 19045; NVIDIA GeForce RTX 4070 Ti SUPER; driver 32.0.15.7270; MSVC 19.43.34810; DXC 1.9.2609; Agility SDK 620; D3D12 debug layer enabled.

For each of dev and release:

cmake --build --preset dev --target startup_indirect_draw_indexed startup_compute_binding_trace startup_view_alloc startup_view_census
ctest --preset dev --no-tests=error -j 1 -V -R '^startup_(mesh_argument_provenance_(warp|hardware)|indirect_mesh_(warp|hardware)|view_alloc_.*|view_census_.*|compute_binding_trace_warp)$'

Repeat the two commands with --preset release for Release.

Each configuration: 21 passed, 0 failed, 2 capability skips out of 23 selected tests. Both skips were local WARP Mesh support (startup_indirect_mesh_warp and startup_mesh_argument_provenance_warp). The new hardware test passed all six processes with no device removal or debug-layer ERROR/CORRUPTION messages.

Case After producer, byte 4 Before consumer Changed pixels
Positive (2,1,1) byte 4: (2,1,1) 8/8
Missing copy (0,1,1) byte 4: (0,1,1) 0/8
Stale copy (0,1,1) byte 4: (0,1,1) 0/8
Wrong SRV offset (0,1,1) byte 4: (0,1,1) 0/8
Wrong argument offset (2,1,1) byte 20: (0,1,1) 0/8

Also passed:

  • python -B tests/docs_links_check.py (154 Markdown files, 676 links).
  • python -B tests/bidi_controls_check.py.
  • Python AST syntax, CMake preset JSON and explicit PR-regex selection checks.
  • git diff origin/main --check.

GitHub Actions run 46130729442 completed successfully for this head:

  • Windows PR smoke suite: 74 selected, 71 passed, 3 unrelated XMem capability skips, 0 failed; 66.63 seconds. The new startup_mesh_argument_provenance_warp test passed on hosted WARP in 0.60 seconds.
  • Linux platform-independent Python checks: passed.
  • gfx1013 assembly/translation fixtures: passed.
  • The separate Windows /O2 job and coverage publication were skipped by PR workflow policy; local Release coverage is reported above.

Evidence and follow-up

The fixture is original source under the repository's MIT license. It publishes no external shader inputs, captures, SDK binaries, game content or private logs. Producer HLSL and submission/fences are native desktop D3D12; descriptor creation/copy and the indirect Mesh consumer use the guest wrappers.

This is the fixture/diagnostic portion of #3310, not its matched integration acceptance. The reported 48 zero records were not reproduced. A matching real integration must still identify its scalar-input write and descriptor history, prove nonzero identical records at the same resource/offset, and show a real Mesh submission changing scene color before composition. The fixture does not exercise translated gfx1013 producer code, guest queue preprocessing or XMem refresh. #3091/#3094 remain separate open integration work. Keep #3310 open.

AI-assisted implementation, review and local verification.

Checklist

  • One reviewable behavior: descriptor provenance and its GPU-written Mesh reproducer.
  • Reproduction commands and observed results included.
  • Four negative controls and trace-disabled positive included.
  • Runtime documentation and experiment note added.
  • No game files, dumps, distribution links, SDK binaries or secrets included.

@wish131400

Copy link
Copy Markdown
Contributor Author

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 #3248 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 retains scalar_window metadata but drops the bounded unplaced-window handling present in public #3094. The focused restoration and before/after evidence are reported on #3248, 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 the cs_6_6 PSO (80070057), while an EXE selecting Agility 620 reports SM 6.6 and creates the same PSO (00000000) on the same RTX 4070 Ti SUPER/driver 32.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 #3310: 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.

@wish131400
wish131400 marked this pull request as ready for review November 28, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant