Repository navigation
gpu: sample slot 62 root bindings at dispatch - #2246
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head 766ab152f05eedaba48d64e60c3c4d57c1bc1854 (comment only, no approval).
Scope read: git diff --stat origin/main...HEAD shows 6 files, +353/-1. I read d3d12_compute_binding_trace.inl, the d3d12_xs_device.cpp hunks (WrapperOwn fields, noop_slot hook, RootParameter.constants_count, Pass::compute_trace, list_compute_root) and the CMake and Python check.
Commands run locally (Linux):
python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 418 links OK.python3 tests/bidi_controls_check.py: self-test passed, 1524 files, no bidirectional controls.git diff --check origin/main...HEAD: clean, rc=0.python3 -I -m py_compile tests/startup_compute_binding_trace_check.py: OK.gh pr checks: Linux Python checks pass. Windows build/test and gfx1013 fixtures were still pending when I looked, and the /O2 job was skipped.
Not done: the C++ is Windows-only, so I could not run the new CTest or do a real logic mutation on Linux. I did not queue Win2025, because the PR body already reports a WARP and hardware run and CI is building it. The mutation check is therefore open. Suggested mutations for the Windows side: change offset >= 64 to offset > 64, drop the slot == 35 special case in compute_binding_source, or compare compute_trace_root against nullptr. The exact-line assertions in startup_compute_binding_trace_check.py look tight enough to kill all three.
Findings
- P1: none.
- P2: none.
- nit,
d3d12_compute_binding_trace.inl(compute_binding_filter): ifX2W_D3D12_COMPUTE_BINDINGSis 192 bytes or longer,GetEnvironmentVariableAreturns the required size,size < sizeof(value)fails, and the trace turns off with no message. A long hash list therefore looks like "nothing matched". Log one line when the value is truncated, or document the limit (about 11 hashes) indocs/startup-runtime.md. - nit, mask semantics:
constantsonly tracks dwords 0..63 and ignores writes atoffset >= 64. The 64-dword bound matches the D3D12 root signature limit, so this is correct, but a one-line comment on that would help later readers. - nit,
trace_compute_binding: slot 39 readsthirdas a pointer and probes it withreadable()before counting the dwords. That is safe, and values are never logged, which is the intent. A short comment saying so would stop a future change from printing them.
Checked and found fine
- The shift
(~u64{} >> (64 - count)) << offsetis only reached with0 < count <= 64andoffset < 64, so there is no undefined shift. - A filter of exactly
1or a comma list is parsed without overrun (substr(0, npos)andremove_prefixare both guarded). - The trace state is rebuilt only when the compute root signature changes, which matches D3D12 root-binding invalidation. Re-setting the same root keeps the bindings.
- The disabled path costs one static-string check per hooked list call and forwards the call unchanged.
- Title and body are neutral, and the body has the
Refsline and a Verification block.
Open item before Ready: a green Windows CI run (WARP and hardware) on this exact head.
AI-assisted; commands listed were executed locally.
Refs #1412, #1803, #1954 and #1974.
Add an opt-in trace that pairs slot 62 PSO creation with the root state observed at command-list slot 14. It reports the matching root, desktop PSO/root availability, constant write mask, and upload or placed-resource classification from the current recording. Set
X2W_D3D12_COMPUTE_BINDINGS=1with render mode, or pass a comma-separated list of lowercase container hashes. Sampling leaves dispatch behavior unchanged and logs classifications without buffer payloads, constant values, or addresses. Resource classifications describe the first byte and need separate range and state validation before use for dispatch.The source-built WARP control validates a legal compute PSO and then drives the shim through root binds, split constant setters, aligned and unaligned uploads, a placed buffer, a root switch, and a fresh recording. Disabled and unmatched-filter processes must emit no trace records.
Verification on Windows build 26200, WARP and GeForce RTX 4060 Laptop driver 616.56, with
X2W_D3D12_DEBUG=1:7 passed, zero skipped.
git diff --check, the documentation link check, and the bidirectional controls check passed.AI-assisted.