gpu: add targeted descriptor history filtering #3774
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!3774
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3772"
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?
@Vilify-13 on GitHub · 2026-12-01 18:04 UTC · original
Vilify-13:gpu/targeted-descriptor-history→main· +2785 −31 · 25 files · 3 commits · openSummary
Refs #3312 and #3323.
Edits: Addressed SHOULDs and several NITs given by @Leyukaka and @Not-Saii
Extend descriptor history with optional heap-relative range filtering, allowing relevant descriptor operations to be captured without unrelated initialization activity consuming the diagnostic event budget.
The existing 8,192-record history limit can be exhausted during initialization or by a sufficiently large descriptor copy, preventing later operations relevant to GPU-written Mesh argument investigations from being recorded.
This contribution applies selection before event-budget consumption, validates descriptor attribution conservatively, and terminates diagnostic-only traversal after truncation.
Outstanding merge prerequisite — Not-Saii MUST 1
Coordination with #3323 remains unresolved. This follow-up addresses the technical review findings without changing the original contributor's attribution or the merge prerequisite. Publishing these improvements enables further technical review while coordination continues. This PR should not merge until either #3323 lands independently and this contribution is rebased, or an explicit agreement is found to supersede it.
The remaining application-integration acceptance criteria of #3312 and broader graphics-pipeline optimization remain separate work.
Dependency and integration status
This contribution depends on the descriptor-history implementation and Mesh argument provenance fixture introduced by @wish131400 in #3323.
The current branch contains three separately identifiable commits:
04a6c5a0390f5c1dThe original contribution is based on #3323 revision
029dfefef4c273b5d9c5565fbff1ee2acfd9a3ca.The original author was notified in #3323.
Outstanding findings specific to the original descriptor-history implementation remain separately identifiable from the filtering contribution.
Implementation
Diagnostic bounds
Selected registrations beyond the ordinary discovery limit are still reported.
The portable model reports a retained registry size of 73,856 bytes. The registry is constructed lazily and exists only in filtered mode.
The registry retains mapping metadata rather than 1,024 live COM references.
Reaching exactly 8,192 records does not itself constitute truncation. The truncation marker is emitted when an additional admissible matching record would exceed the budget.
Registration and attribution failures are handled conservatively. An incomplete trace is not represented as a complete descriptor history.
Runtime behavior
The diagnostic is disabled by default.
When the master switch is unset, the filter environment variable is not read and the filtered registry is not constructed.
The contribution adds no GPU commands or GPU synchronization requirements. Descriptor shadow publication, reference accounting and native descriptor operations retain their existing behavior.
Registry attribution is performed under
descriptor_lock. History admission and shadow publication operate under exclusivenote_lock.Registration planning precedes acquisition of
note_lock. Publication checks before and after shadow-row validation prevent stale or concurrently changed mappings from being accepted as verified lineage.Selected-row validation is bounded by the available history budget. Registration lookup is bounded by the retained registry capacity; this is not a claim of constant-time end-to-end descriptor lookup.
The disabled path retains cached configuration checks and diagnostic bookkeeping that returns early. Further reduction of this overhead is being evaluated separately in response to review feedback.
Configuration
Set both environment variables before starting the process:
Selector grammar:
TYPEview,sampler,rtv, ordsvVISIBILITYcpuorvisible; RTV and DSV must be CPU-onlyNODE_MASKCAPACITYORDINALFIRSTCOUNTOne or two selectors may be specified, separated by a semicolon.
Numeric fields use canonical unsigned 32-bit decimal values without whitespace, signs or leading zeroes. Capacity, ordinal and count must be positive. The selected interval must fit within the logical heap capacity.
Selectors must identify distinct heap keys, including their ordinals.
Mirrors are companions of their logical heaps rather than additional selector ordinals.
The filter is optional. Missing or empty input preserves legacy unfiltered recording behavior. Invalid nonempty input disables the diagnostic and reports a configuration error rather than falling back to unrestricted recording.
Configuration is cached for the lifetime of the process.
See
docs/experiments/descriptor-history-filter.mdfor the complete configuration grammar, attribution rules, capacity limits and reproduction details.Verification
Revision identity
Tested head:
390f5c1d1e1f460422fcf8ff3d78da8a8aa27877Upstream base:
158ef79422f296c48873bfe8123e1e040125dc0aThe final local regression campaigns were executed against the exact committed outgoing revision. The source checkout was verified clean before and after testing.
Historical development and mutation results are reported separately below and are not attributed to this final head.
Local test environment
The local build used the installed Windows D3D12 runtime and locally provisioned project dependencies.
OFFSCREEN_AGILITY_620_DIRandOFFSCREEN_WARP_DIRwere unset in both final build caches. No separately provisioned Agility SDK or app-local WARP package was required for this environment.Final committed revision results
The total includes overlapping tests executed under different configurations and presets; it does not represent 379 unique tests.
The three capability skips are existing Windows placeholder-fallback controls:
xmem_placeholder_split_controlxmem_placeholder_split_deployedxmem_placeholder_split_partialThe operating system exposes the placeholder bit, so the fallback paths are not exercised. These skips are not counted as passes.
Documentation-link, bidirectional-control and Git whitespace checks also passed during publication validation.
Primary regression results by adapter and configuration
startup_descriptor_history_modelstartup_descriptor_history_filter_warpstartup_descriptor_history_filter_hardwarestartup_descriptor_history_exhaustion_warpstartup_descriptor_history_exhaustion_hardwarestartup_mesh_argument_provenance_warpstartup_mesh_argument_provenance_hardwareAll seven primary regression tests passed in both configurations without capability skips.
These seven tests are included in, rather than additional to, each 59-test focused regression campaign.
Each focused campaign contains:
Every individual test in the complete focused inventory listed in the reproduction section below passed in both Debug and Release.
D3D12 debug-layer and info-queue verification
The archived verbose logs for the final committed revision were inspected for adapter debug-layer messages and the fixture's
provenance debug info_queue=observations.startup_mesh_argument_provenance_warpstartup_mesh_argument_provenance_hardwarestartup_descriptor_history_filter_warpstartup_descriptor_history_filter_hardwarestartup_descriptor_history_exhaustion_warpstartup_descriptor_history_exhaustion_hardwareAll 170 observed provenance info-queue records reported:
The corresponding adapter messages reported the debug layer enabled for all of these fixture executions.
No
info_queue=absentobservation was found in these final-head provenance campaigns.Debug-layer enablement was also reported by the following focused regression fixtures in both configurations:
startup_resource_retire_views_warp_debug1startup_resource_retire_views_hardware_debug1startup_resource_retire_views_no_mirror_control_warpstartup_mesh57_runtime_warpstartup_mesh57_runtime_hardwareThe
debug0resource-retirement cases intentionally exercise their corresponding debug-disabled configuration.Debug-layer claims here are fixture-specific rather than a blanket claim that every test in the PR preset uses the debug layer.
Expected diagnostic errors in deliberately failing upstream controls are distinguished from unexpected errors in the positive provenance fixtures.
Regression coverage
Portable model
startup_descriptor_history_modelverifies:The final-head Debug and Release model output includes:
Filtered GPU regression
Each
startup_descriptor_history_filter_{warp,hardware}test executes 19 cases.The five source-built Mesh provenance scenarios are exercised with source-only, destination-only and combined selectors. Additional positive cases cover an empty filter, disabled history, invalid configuration and an unmatched selector.
The regression checks exact descriptor-history sequences, registration selector masks, guest observations, resource backing identity, GPU argument records, fence observations and the existing pixel oracle.
History exhaustion regression
Each
startup_descriptor_history_exhaustion_{warp,hardware}test executes nine cases.The following results were verified against the archived final-head verbose logs:
The targeted case generates 10,000 unrelated descriptor events before the Mesh provenance sequence.
Legacy recording exhausts its budget during those unrelated events. Targeted recording retains the five relevant Mesh history records without truncation.
The sparse case independently exercises disjoint source and destination copy windows.
The noise-only case with 4,096 slots establishes that reaching exactly 8,192 admitted records does not prematurely emit the truncation marker.
Mesh argument provenance controls
The underlying #3323 fixture supplies the following source-built GPU oracle:
(2,1,1)recordsThe fixture checks matching resource identity, byte offsets, 12-byte argument records, completed fence observations, preserved guards and rendered pixels.
The positive scenario also runs with descriptor history disabled.
These are source-built regression fixtures. They do not establish the corresponding behavior in an actual application integration run.
Reproduction
Prerequisites and execution notes
The following workflow is adapted from the successfully executed final-head publication validation.
The build and test selections, configuration options, serial execution order and native-command error handling follow that campaign. Machine-specific paths have been parameterized for independent reproduction; the public-facing adaptation has not itself been rerun as a standalone script.
Use:
--tests-from-file.Follow the repository's
AGENTS.md,CONTRIBUTING.mdand dependency provisioning instructions.This reproduction uses offline CMake dependency configuration. Required dependencies must already be available locally.
Do not reuse build caches belonging to another checkout, another toolchain or another source revision.
Hardware without the required Mesh capabilities may produce capability skips. Such skips must be reported separately and do not constitute successful GPU validation.
If PowerShell execution policy prevents the reviewed repository scripts from running, and local policy permits it, a process-scoped setting can be used:
No system-wide execution-policy change, administrator privileges, Git ownership-check bypass or proprietary application materials are required.
Step 1 - Initialize and validate the environment
Run the following from the root of a clean checkout of the tested revision.
Replace the dependency-path values with the corresponding installations on the test machine.
The original local configuration used the Windows SDK paths shown above, MSVC x64, explicit Windows PowerShell discovery and provisioned offline dependencies.
Step 2 - Preserve existing evidence
Use a fresh report directory rather than overwriting existing validation artifacts.
Step 3 - Complete 59-test focused regression inventory
The following contains the exact test-name selection used for both final-head focused regression campaigns.
Every listed test passed in Debug and Release, with no failures or capability skips.
The original archived selection file has SHA-256:
The reproduced selection must contain the same 59 names. Its byte hash may differ due to text encoding or line-ending conventions.
Step 4 - Native-command handling
Windows PowerShell can treat redirected native stderr as PowerShell error records, including nonfatal compiler and configuration warnings.
The original successful publication validation used a checked native-command wrapper to retain diagnostic output while determining command success from the native exit code.
The following preserves that behavior and restores the caller's error-handling preference:
Step 5 - Configure, build and execute the complete validation campaign
This follows the final-head validation order:
The PR build and test presets use the Debug build directory.
Successful command completion is not, by itself, proof that all tests ran without capability skips. Inspect the JUnit reports as described below.
Step 6 - Verify individual test results
The following reporting step compares each JUnit result inventory with the corresponding pre-execution inventory and distinguishes passes, skips and failures.
The expected local results are 59/59 passes in both focused configurations and 258 passes with three existing OS-dependent capability skips in the PR smoke suite.
Other supported environments may produce different capability-skip results. Report those independently rather than treating them as successful execution.
Step 7 - Inspect debug-layer and info-queue evidence
Verbose logs retain fixture observations that may be truncated in default JUnit output.
The final local campaigns produced:
devreleaseprThe counts are specific to the observed test inventory and capability results.
An absent info queue must be reported as such and must not be represented as successful debug-layer error screening.
Step 8 - Preserve verification evidence
For independent review, retain the source revision, adapter information, configuration and build logs, exact test inventories, verbose test logs, JUnit reports and individual result summaries.
Only sanitized, source-built evidence should be shared publicly.
Minimal seven-test reproduction
For the descriptor-history and Mesh provenance test families only, the following shorter campaign may be used after the corresponding build presets have been successfully configured.
This selection contains seven tests per configuration. It is not the complete 59-test regression campaign reported above.
Historical mutation controls - prior upstream baseline
The following author-side mutation campaigns were performed during consolidated implementation validation against upstream base
959306d407e51781b8860d84b5060ab5a7113e58.These are historical development results, not mutation campaigns rerun against published head
390f5c1d.Portable mutations
Six isolated portable mutations were successfully detected by their intended semantic assertions:
The mutant executables compiled successfully using
/O2 /W4 /WXand failed their intended semantic checks with exit code 1.The accepted Debug and Release model executables passed again following the mutation campaign.
Integrated runtime mutations
Three representative runtime mutations were tested using the source-built fixture on both the physical RTX 4060 and WARP.
The integrated mutation campaign comprised 18 native fixture executions:
All 18 completed successfully at the native process level. The mutations were detected by descriptor-history assertions rather than compilation failures, crashes or unrelated GPU failures.
The positive GPU pixel result remained 8/8 throughout the campaign. Producer and consumer X dimensions remained 2, three fence observations were retained, and info queues were present.
These integrated runtime mutation tests were performed in Debug. No corresponding Release mutation campaign is claimed.
The historical results are retained as development evidence and are distinct from the final-head independent mutation results below.
Independent verification - published head
Not-Saii's independent review tested the exact published head:
390f5c1d1e1f460422fcf8ff3d78da8a8aa27877The reviewer exported the committed tree using
git archiveinto an isolated Windows Sandbox. The network probe reportedunreachable.Independent test environment
These are the reviewer's independently reported environment and results, rather than additional author-side test executions.
Independent baseline results
The reviewer reported 11 passed, zero failed and zero skipped:
startup_descriptor_history_modelstartup_descriptor_history_filter_warpstartup_descriptor_history_filter_hardwarestartup_descriptor_history_exhaustion_warpstartup_descriptor_history_exhaustion_hardwarestartup_mesh_argument_provenance_warpstartup_mesh_argument_provenance_hardwarestartup_indirect_mesh_warpstartup_indirect_mesh_hardwarestartup_indirect_draw_indexed_warpstartup_indirect_draw_indexed_hardwareThe same selection also passed the reviewer's
--repeat until-fail:5validation.A separate five-test descriptor-history selection passed without failures or skips.
The reviewer explicitly enabled
X2W_D3D12_DEBUG=1and reported that the in-box debug-interface probe returned0x00000000.All 68 provenance info-queue observations in the reviewer's head validation reported
present, with no reported debug-layer ERROR or CORRUPTION messages.Independent current-head mutation tests
The reviewer independently introduced two reverted-behavior mutations in isolated copies of the published revision.
M1 - Drop source-window selection
File:
src/startup_stubs/descriptor_history/retained_registry.hOriginal behavior:
Reviewer mutation:
The reviewer verified that both
d3d12_xs.dllandstartup_descriptor_history_check.exechanged following rebuilding.Five tests detected the regression:
startup_descriptor_history_modelstartup_descriptor_history_filter_warpstartup_descriptor_history_filter_hardwarestartup_descriptor_history_exhaustion_warpstartup_descriptor_history_exhaustion_hardwareThe remaining six tests passed.
After restoration, all 11 tests passed.
M2 - Bypass selection before budget consumption
File:
src/startup_stubs/d3d12_capture.inlOriginal condition:
Reviewer mutation:
The reviewer verified that
d3d12_xs.dllchanged following rebuilding.Four runtime tests detected the regression:
startup_descriptor_history_filter_warpstartup_descriptor_history_filter_hardwarestartup_descriptor_history_exhaustion_warpstartup_descriptor_history_exhaustion_hardwareThe portable model remained passing, as expected for a mutation confined to runtime integration.
After restoration, all five selected tests passed.
These independent results demonstrate that the published head's regression suite detects both loss of source-range selection and incorrect admission of unrelated events before budget consumption.
The reviewer's exact build commands, test selections, mutation details and environment observations are available in the linked review.
Hosted CI
Windows CI run 46710411577
As independently confirmed in the review, the hosted Windows PR smoke job reported:
xmem_placeholder_split_*capability skips.The following directly relevant tests were included and passed:
startup_mesh_argument_provenance_warpstartup_descriptor_history_modelstartup_descriptor_history_filter_warpstartup_descriptor_history_exhaustion_warpThe hosted PR preset does not select the corresponding hardware tests.
Hardware validation is reported separately from the author's physical RTX 4060 runs and the reviewer's RTX 4090 sandbox vGPU runs.
Scope and limitations
Heap-relative ordinals are not stable identifiers across executions, configurations, adapters or concurrent registrations. Attribution is deliberately conservative when mapping identity cannot be established.
The diagnostic records CPU shadow publication order and pre-token-write guest samples. It does not establish:
View IDs may be reused. Matching numeric IDs alone do not establish persistent resource identity across an entire execution.
Registration discovery ordinarily reports the first 256 registrations, with additional selected registrations reported separately. The retained registry faults attribution beyond its supported capacity.
Incomplete-history reporting currently emits the first omission reason per process. The absence of additional omission messages is not proof that no additional operations were refused.
There is no end-of-process completeness receipt. Zero records or absence of a truncation marker is not proof of a complete history.
The portable model covers incomplete admission and refusal paths. The current integrated GPU fixtures primarily exercise tracked descriptor endpoints; a GPU incomplete-path control remains a proposed refinement.
No dedicated PR test exercises
X2W_D3D12_TABLE_LOCK=1in combination with targeted history.The original provenance fixture and targeted history provide diagnostic infrastructure relevant to #3312.
This contribution does not claim to satisfy the remaining application-integration acceptance criteria of #3312 or demonstrate full rendering compatibility.
Attribution
The underlying descriptor-history implementation and Mesh argument provenance fixture originate from @wish131400's PR #3323.
The original Git author identity and author date are preserved in the dependency integration commit.
Credit to:
Follow-up review remediation —
e2609c0eAddresses technical recommendations from @Leyukaka and @Not-Saii across 14 files (506 insertions, 100 deletions), without introducing external dependencies or additional GPU synchronization requirements.
Disabled-history overhead — Leyukaka SHOULD 1
Introduced a cached
history_active()check innote_view()andnote_copy(), bypassing history-specific shadow observations, stride calculations, reservation, and token sampling when history is disabled. Ordinary descriptor operations and resource-reference accounting remain unchanged.Optimized Release microbenchmarks against
390f5c1dcomprised 72 isolated process executions, 61.2 million API calls, and 288 million descriptor operations.A secondary optimization reduced the compiled
note_copy()function size from 2,398 to 1,727 bytes. However, further benchmarking across 384 million descriptor operations failed to resolve the bulk-copy regression, so the initial optimization was retained.The SHOULD is addressed structurally, although complete performance parity with the underlying dependency has not been achieved.
Further optimization is intentionally deferred until the graphics-rendering pipeline reaches a significant, reproducible functional milestone. Representative workloads will then allow more meaningful profiling of descriptor-copy distributions, lock contention, resource streaming, and CPU/GPU utilization.
The long-term objective remains near-zero disabled-diagnostic overhead and elimination of the observed bulk-copy regression without compromising runtime correctness.
These are historical R1.1 synthetic CPU-side measurements, not application FPS or end-to-end performance measurements of
e2609c0e.Omission reporting and discovery — Leyukaka SHOULD 2 / Not-Saii NIT 3
Portable model validation:
Historical isolated mutation controls detected regressions involving first-occurrence-only reporting, shared counters, incorrect reason classification, and restoration of the previous discovery cutoff.
No end-of-process completeness guarantee is introduced.
Integrated incomplete-history controls — Leyukaka NIT
Added
startup_descriptor_history_incomplete_{warp,hardware}with three source-built runtime controls:The untracked-source control verifies five native descriptor copies, omission counts of 1, 2, and 4, unchanged guest-token state, correct
(2,1,1)argument records, and 8/8 scene-color pixels.The overflow control verifies 1,024 retained registrations and five additional successful native heap allocations, with independent registry, view-attribution, and copy-attribution omission reporting.
The GPU oracle is verified before registry overflow; subsequent operations are checked through descriptor-token observations and device status.
All controls passed on hardware and WARP in Debug and optimized Release.
Documentation — Not-Saii NIT 4
Removed the redundant
docs/experiments.mdentry and updated the dedicated experiment note with revised diagnostic bounds, omission semantics, reproduction commands, and limitations.Documentation-link, bidirectional-control, and Git whitespace checks passed.
Consolidated verification — Not-Saii SHOULD 2
Each focused configuration includes 24 hardware, 27 WARP, and 10 other tests. The smoke suite includes 54 WARP passes and 205 other passes.
The three existing capability skips remain:
xmem_placeholder_split_controlxmem_placeholder_split_deployedxmem_placeholder_split_partialThese returned code 77 because the OS exposes the placeholder bit directly.
Primary regression results
startup_descriptor_history_modelstartup_descriptor_history_filter_warpstartup_descriptor_history_filter_hardwarestartup_descriptor_history_exhaustion_warpstartup_descriptor_history_exhaustion_hardwarestartup_descriptor_history_incomplete_warpstartup_descriptor_history_incomplete_hardwarestartup_mesh_argument_provenance_warpstartup_mesh_argument_provenance_hardwareD3D12 information-queue verification
Twelve additional incomplete-history executions passed with complete decoded stdout and stderr retained separately.
Including these additional controls, all 197 provenance information-queue observations reported
present, with no absent information queues.Reproduction and evidence integrity
The original 59-test focused inventory was expanded by the two incomplete-history registrations. The updated nine-test minimal reproduction is distinct from the complete 61-test selection:
The full focused inventory, individual test results, compiler flags, binary hashes, JUnit reports, and diagnostic logs are retained locally, with SHA-256 verification covering 63 evidence artifacts.
The tested cumulative source candidate was independently verified against the committed tree of
e2609c0e.Historical mutation results against
959306d4, subsequent R1 development mutations, and Not-Saii's independent validation against390f5c1dremain attributed to their respective tested revisions.All contributed implementation and validation fixtures are source-built. No proprietary application content or SDK materials are included.
AI-assisted implementation, testing and verification.
@Leyukaka on GitHub · 2026-12-01 20:17 UTC · original · approved these changes
Reviewed
390f5c1dby reading the diff; not built or run.Verdict: approve. No MUST. Two SHOULDs and two NITs below.
Integration.
04a6c5a0combines42a18553and wish131400's merge029dfefeinto one commit, with the original author, author date and headline kept. Four of its files match029dfefebyte for byte. In the other four, the added and removed lines match029dfefeexcept wheremainchanged the same lines:CMakePresets.jsonadds onlystartup_mesh_argument_provenance_warpto the newprfilter, andtests/startup_indirect_draw_indexed.cppkeepsruntime_mesh57. GitHub reports the branch mergeable into158ef794.Earlier review points on #3323
d3d12_capture.inl:700-744,retained_registry.h:165-181). The exhaustion cases check the 4093/4094 boundary and a later heap kept after 5,000 unrelated slots.029dfefe. The fixture printsinfo_queue=present|absentand the check reads it (startup_mesh_argument_provenance_check.py:96).history_reservereturns at once (d3d12_capture.inl:705), legacy mode skipstitle_descriptor_stride(:943), and planning stops (xs_device.cpp:6265, 6501, 6541, 7717).copyevents still record shadow ids only (d3d12_capture.inl:962).:809-816).source_id=: partly addressed. In filtered mode, an untracked or opaque endpoint makes the record be refused and reported as incomplete (history_admission.h:58-63). Legacy mode still logs an untracked source asnew=0(:962).docs/startup-runtime.mdandmesh-argument-provenance.md.SHOULD
d3d12_capture.inl). WithX2W_D3D12_DESCRIPTOR_HISTORYunset,note_copynow callshistory_legacy_enabled(), then, under exclusivenote_lock, twohistory_shadow_observe()calls and ahistory_reserve()call (:943, 954-957);note_viewdoes the same (:899-902). #3323 had one cached flag check. Each call returns early and allocates nothing, but a single cached "history active" check at the call sites would restore the old cost of the hot copy path.history_runtime.inl:15-22).history_incompletelogs only the first reason per process, so later refused selected operations leave no trace, and a reader cannot tell one omission from thousands. A per-reason counter, or the first N lines, would make the history usable on a real run. Related: discovery logs only the first 256 registrations (heap_shape.h:14), so the ordinal needed to select a heap created later cannot be found from the log.NIT
Checks
descriptor_lockis taken before or outsidenote_lock(history_runtime.inl:156-161, 172-179). Undernote_lock, admission makes only shadow lookups and atomic reads.require()(exit 1) and Pythonassert.startup_descriptor_history_{model,filter_*,exhaustion_*}are registered, and CI at this head ran model, filter_warp and exhaustion_warp:Passed.@Vilify-13 on GitHub · 2026-12-01 20:35 UTC · original
Thank you for reviewing! I'm taking a look at both SHOULDs, would you rather I address these in this PR before merge or submit the changes in a follow up PR?
@Not-Saii on GitHub · 2026-12-01 20:39 UTC · original · requested changes
Review of head
390f5c1d1e1f460422fcf8ff3d78da8a8aa27877(base158ef79422f296c48873bfe8123e1e040125dc0a).The filtering code is careful, and it was tested well in an isolated build. Both reverted-behavior mutants were caught by the PR's own tests, and the restored tree passed again. One scope issue blocks approval. It concerns how the PR is put together, not the filter.
Findings
MUST
Two behaviors from two authors, one of them still an open PR. Commit
04a6c5a0is the change from #3323, rebased onto currentmain. I compared it with #3323's own diff, and only the context lines differ. #3323 is still open. That commit adds the opt-in descriptor history (d3d12_capture.inltrace_descriptor_history,note_view/note_copyhooks) and the Mesh argument provenance fixture (tests/startup_mesh_argument_provenance.inl,tests/startup_mesh_argument_provenance_check.py,tests/cmake/mesh_argument_provenance.cmake,docs/experiments/mesh-argument-provenance.md). Commit390f5c1dadds the heap-relative filter. AGENTS.md and CONTRIBUTING.md:82 ask for one reviewable behavior per pull request, and CONTRIBUTING.md asks the description to "name any PR that must land first" rather than carry it. Commit04a6c5a0also brings along review points that are still open on #3323, among them that the trace does not record whether the guest copy ran, and that typed buffer SRVs log no byte range. Those belong in that thread. As it stands, merging either PR leaves the other conflicting or duplicated, and reviewers have to review #3323's code twice. Please do one of these:390f5c1d;The PR body defers landing order to maintainer coordination. This finding asks for that coordination to happen before merge.
SHOULD
959306d4, not this head. Please rerun it at390f5c1d, or label it as historical. (For what it is worth, my two mutants below were caught at this head.)provenance debug info_queue=result, which the fixture prints._hardwareand_warpresults per test, with any 77 skips kept separate. At the moment they are only totals.NIT
src/startup_stubs/descriptor_history/history_runtime.inl:19:history_incompletelogs only the first reason in each process. The doc (docs/experiments/descriptor-history-filter.md:61-63) lists several reasons that can omit operations. A later omission with a different cause is silent. A per-reason first-call flag, or a count at the first truncation, would make the trace easier to audit.docs/experiments.md:5-7adds a new section at the top of the file that keeps the older notes. The folder guide sends new notes todocs/experiments/<topic>.md, "so two pull requests that each add a note do not edit the same lines". This PR already addsdocs/experiments/descriptor-history-filter.md, and the README row links it, so the extra section in the old file only adds a conflict point.What I checked and found sound
Opt-in and cost when off. With
X2W_D3D12_DESCRIPTOR_HISTORYunset, the filter variable is never read (descriptor_history_config_win.h), andhistory_configuration()is a cached function-local static. The off path adds these checks:d3d12_xs_device.cpp:6265,6501,6541,7717);note_view(d3d12_capture.inl:900) andnote_copyeach callhistory_reserveonce, and it returns at theplan.status == offcheck before touchingGetLastError;note_copyalso callshistory_legacy_enabled().None of these takes a lock, reads the environment or makes a syscall. The draw path reaches the change only through
shadow_slot's two new defaulted parameters (shadow_idatd3d12_capture.inl:296,389), so a draw-time lookup gains one null check.The native copy, the shadow publication and the token writes run in the same order as before.
device_create_descriptor_heapstill pushes the samedescriptor_rangesentry. The filter'soffcase and the provenance trace opt-out both assert that no history line appears.Locks. The budget (
d3d12_capture.inl:715) is used only undernote_lockexclusive, innote_view,note_copyanddrop_unrecorded_view. The registry andhistory_ownersare used only underdescriptor_lock. Thehistory_plan_*functions takedescriptor_lockshared beforenote_lockis taken, and the row lookups in admission useshadow_slotwith no second lock, so no new nesting appears. A concurrent heap registration bumpshistory_publication, and admission checks it before and after the row probes, so a race drops the record and reports it as incomplete. WithX2W_D3D12_TABLE_LOCK=1, heap table writers still takenote_lockexclusive beforetable_lock(d3d12_capture.inl:181,194), so theshadow_slotreads made while holdingnote_lockstay consistent. No PR test runs with that switch.Call sites. All 4
note_viewcallers and the onenote_copycaller pass an expectation.descriptor_rangesis append-only: there is onepush_backand no erase, which matches the registry'smapping_index == mapped_count_+1rule.Memory bounds.
history_ownersis 8 KB of static storage.retained_registry.h:104), asdescriptor-history-filter.md:50documents.In filtered mode,
attribute()scans the retained registrations linearly for each view and each copy chunk (retained_registry.h:128). That cost matches the existingdescriptor_rangeswalk, and it is diagnostic-only.Platform split.
descriptor_history_config_win.his the only new header that includes<windows.h>. The model check compiles the portable headers together withdescriptor_heap_match.h.Content. The diff names no title and contains no third-party assets.
CMakePresets.json. The change touches only theprpresets. It addsstartup_descriptor_history_checkto theprbuild targets and addsstartup_mesh_argument_provenance_warp|startup_descriptor_history_(model|(filter|exhaustion)_warp)to theprtest filter. Thedev,releaseandruntimepresets are unchanged. Nothing in the PR adds a download, a network call or a new build tool.What each test proves
startup_descriptor_history_modeltests the shared headers without D3D12:startup_descriptor_history_filter_{warp,hardware}runs 19 cases. The five provenance cases each run withboth,sourceanddestinationselectors, andpositivealso runs with an empty, off, invalid and unmatched filter. Each case checks:startup_descriptor_history_exhaustion_{warp,hardware}runs 9 cases with 4,093 to 5,000 unrelated slots. It covers:target, which keeps the 5 Mesh records after 10,000 unrelated events;mixedandsparsecopy windows.startup_mesh_argument_provenance_{warp,hardware}runs the #3323 oracle: the positive case, four negative controls, and the positive case with tracing off.Mutation results (Windows Sandbox, network off, PR tree read-only)
retained_registry.h:179, I changedfilter::merge(result, window(a), window(b))tomerge(result, {}, window(b)).d3d12_xs.dllandstartup_descriptor_history_check.exeboth changed.startup_descriptor_history_modelfailed at "source or mirror-backed destination union";filter_warpandfilter_hardwarefailed at the firstsourcecase, afterpositive bothpassed;exhaustion_warpandexhaustion_hardwarefailed at the firstnoisecase, after thelegacy,targetandoffcases passed.d3d12_capture.inl:707, I changed the condition toif (history_legacy_enabled() || history_filtered()). This reverts "select before budget consumption".d3d12_xs.dllchanged.startup_descriptor_history_modelstill passed. That is expected, because this is a runtime-only revert.filter_warpandfilter_hardwarefailed at the first case (positive both) on the history-sequence assertion;exhaustion_warpandexhaustion_hardwarefailed atslots=5000 mode=targetafter the threelegacycases passed, so unrelated events consumed the budget before the selected Mesh records.Evidence (AGENTS.md fields)
390f5c1d1e1f460422fcf8ff3d78da8a8aa27877. Both runs exported the head withgit archiveinto Windows Sandbox. The network probe reportedunreachable.X2W_D3D12_DEBUG=1cmake --preset dev -DX2W_WITH_OPUS=OFF -DINTAKE_PYTHON=<venv python> -DOFFSCREEN_AGILITY_620_DIR=<Agility 1.620 dir> -DOFFSCREEN_WARP_DIR=<WARP 1.0.22 dir>cmake --build --preset dev --target startup_descriptor_history_check startup_indirect_draw_indexedctest --preset dev --no-tests=error --output-on-failure -V -R '^startup_(descriptor_history_(model|(filter|exhaustion)_(warp|hardware))|mesh_argument_provenance_(warp|hardware)|indirect_mesh_(warp|hardware)|indirect_draw_indexed_(warp|hardware))$'. The leg ran again with--repeat until-fail:5.ctest --preset dev --no-tests=error --output-on-failure -V -R '^startup_descriptor_history_(model|(filter|exhaustion)_(warp|hardware))$'.--repeat until-fail:5leg also passed 11/11. Tests:startup_descriptor_history_model;startup_descriptor_history_filter_warp,startup_descriptor_history_filter_hardware;startup_descriptor_history_exhaustion_warp,startup_descriptor_history_exhaustion_hardware;startup_mesh_argument_provenance_warp,startup_mesh_argument_provenance_hardware;startup_indirect_mesh_warp,startup_indirect_mesh_hardware;startup_indirect_draw_indexed_warp,startup_indirect_draw_indexed_hardware.startup_descriptor_history_model,filter_warp,filter_hardware,exhaustion_warp,exhaustion_hardware.driver: 1.0.22.0(app-local WARP);driver: 32.0.16.1088.X2W_D3D12_DEBUG=1was set, and the in-box probe returnedD3D12GetDebugInterface hr=0x00000000;adapter: ..., debug layer enabled, and the shim printedx2w-d3d12 debug layer: 0x00000000 enabled;provenance debug info_queue=lines in the head leg readpresent, and no debug ERROR or CORRUPTION message was reported.CI
Run 46710411577: the Windows job ran the
prpreset, with 258 passed, 3 skipped (the existingxmem_placeholder_split_*controls) and 0 failed. It ran and passed 4 of this PR's tests:startup_mesh_argument_provenance_warp;startup_descriptor_history_model;startup_descriptor_history_filter_warp;startup_descriptor_history_exhaustion_warp.CI ran none of the
_hardwaretests. Those results come only from the sandbox runs above.Verdict: request changes. The only blocking item is MUST 1, the bundled open #3323. The filter code passed every sandbox leg, and both mutants were caught.
@Vilify-13 on GitHub · 2026-12-01 21:05 UTC · original · edited 2026-12-01 21:30 UTC
Thank you @Not-Saii for the extensive review, validation, and testing! I understand the blocking concern with #3323 regarding coordination. I intended to provide a conflict-resolved integration while preserving their original author attribution, but I agree that the landing order needs coordination before merge. I'll seek agreement with them still, but haven't gotten a hold of them yet so far since I originally reached out the other day.
I'll be updating the description to satisfy your SHOULD listed shortly.
@Not-Saii on GitHub · 2026-12-02 11:34 UTC · original · requested changes
Follow-up review of head
e2609c0eff8403e284aa026b8ef83eafa9cb829a. My earlier review was of390f5c1d.Thanks for the quick turnaround. The new commit fixes both NITs and the evidence SHOULD. It also makes the disabled path smaller, and its new
incompletefixtures catch a runtime revert of the per-reason counters. The one blocking item is still the landing order with #3323, and the branch now conflicts withmain.Status of earlier findings
info_queuecounts per fixture, and the mutation table labelled as historical.history_incomplete(history_runtime.inl:20) now keeps one saturating counter per reason and logs at powers of two. The model checks per-reason independence, saturation, and unique milestones under 4 threads. The newincompletefixture checks the logged counts at run time.docs/experiments.mdpointer): addressed. The section is removed.New in
e2609c0enote_view(d3d12_capture.inl:844) andnote_copy(:939) now read one cachedhistory_active()(history_runtime.inl:53). When it is false, they call the plainshadow_slotoverloads, the same calls as onmain. Only the callers' flag reads and the zeroing of the history structs on the stack remain. This is the structure I would expect for an opt-in diagnostic.history_runtime.inl:122). That is still bounded, and it happens only in filtered mode.startup_descriptor_history_incomplete_{warp,hardware}runs three cases:opaque-copy: five copies from a native heap outside the guest registry logselected-copy-untrackedat counts 1, 2 and 4, and the GPU oracle still passes.off: no history lines at all.discovery: 1,022 filler heaps plus the two fixture heaps fill the registry exactly, and the oracle passes on the last two. Five overflow heaps then give one fault marker,registry-faultat counts 1, 2 and 4, and oneview-attributionand onecopy-attribution, with no extra records.New findings
SHOULD
main.mainhas moved 141 commits since158ef794.git merge-treenow reports conflicts inCMakePresets.json(theprtest filter) andtests/startup_indirect_draw_indexed.cpp. Both conflicts sit in lines that commit04a6c5a0from #3323 touches, so how they are resolved depends on the landing order in MUST 1.NIT
Parts of the PR body still describe
390f5c1d.e2609c0eremoved that cutoff.e2609c0edid that work.390f5c1das the tested head.The body is now about 1,260 lines. Folding the remediation section into the current-head sections, and keeping only the head that was tested, would make it easier to check.
Disabled-path benchmark baseline. The microbenchmark compares
e2609c0ewith390f5c1d, and it reports +10% on 64-descriptor copies with history off. Other contributors pay the cost relative tomain, so the useful comparison is the base158ef794against the head, with the switch unset. Withhistory_active()now selecting the sameshadow_slotcalls asmain, I would expect any remaining difference to be in the callers ind3d12_xs_device.cpp, which still callhistory_planning_enabled()and build theHistoryObservation/HistoryExpectedstructs. This is not blocking.Mutation result at this head (Windows Sandbox, network off, PR tree read-only)
history_runtime.inl:20, I changedcounters.record(reason)tocounters.record(history_omissions::Reason::registry_fault). This reverts per-reason counting at run time; the model does not compile this file.d3d12_xs.dllchanged.startup_descriptor_history_incomplete_warpandstartup_descriptor_history_incomplete_hardwarefailed. That is the predicted point:opaque-copyandoffpassed, thendiscoverylogged onlyregistry-fault1, 2 and 4, and theview-attributionandcopy-attributionlines were missing.startup_descriptor_history_model, as expected.My M1 (copy plan drops the source window) and M2 (filtered mode uses the unfiltered plan) were caught at
390f5c1d, as reported in my earlier review. I did not rerun them here.Evidence (AGENTS.md fields)
Commit:
e2609c0eff8403e284aa026b8ef83eafa9cb829a, exported withgit archiveinto Windows Sandbox. The network probe reportedunreachable.Commands (Debug):
X2W_D3D12_DEBUG=1cmake --preset dev -DX2W_WITH_OPUS=OFF -DINTAKE_PYTHON=<venv python> -DOFFSCREEN_AGILITY_620_DIR=<Agility 1.620 dir> -DOFFSCREEN_WARP_DIR=<WARP 1.0.22 dir>cmake --build --preset dev --target startup_descriptor_history_check startup_indirect_draw_indexedctest --preset dev --no-tests=error --output-on-failure -V -R '^startup_(descriptor_history_(model|(filter|exhaustion|incomplete)_(warp|hardware))|mesh_argument_provenance_(warp|hardware)|indirect_mesh_(warp|hardware)|indirect_draw_indexed_(warp|hardware))$', then the same with--repeat until-fail:5.Results at the head: 13 passed, 0 failed, 0 skipped (77). The repeat-5 leg also passed 13/13. Tests:
startup_descriptor_history_model;startup_descriptor_history_filter_warp,startup_descriptor_history_filter_hardware;startup_descriptor_history_exhaustion_warp,startup_descriptor_history_exhaustion_hardware;startup_descriptor_history_incomplete_warp,startup_descriptor_history_incomplete_hardware;startup_mesh_argument_provenance_warp,startup_mesh_argument_provenance_hardware;startup_indirect_mesh_warp,startup_indirect_mesh_hardware;startup_indirect_draw_indexed_warp,startup_indirect_draw_indexed_hardware.The model printed all five PASS lines, including
PASS omission counters reasons=9 occurrences_per_reason=10000 lines_per_reason=14 concurrent=10000andPASS full heap discovery retained=1024 discovered=1024 late_selectors=257,1024 fault=1025.Adapters, as the fixtures print them:
driver: 1.0.22.0(app-local WARP);driver: 32.0.16.1088.OS: Windows 11 Enterprise 10.0.26100, build 26100.
Debug layer:
D3D12GetDebugInterface hr=0x00000000;debug layer enabled;provenance debug info_queue=lines in the head leg readpresent, and no debug ERROR or CORRUPTION line appeared.CI
Run 46781043746 on
e2609c0e: the Windowsprpreset ran 262 tests, with 259 passed, 3 skipped (the existingxmem_placeholder_split_*controls) and 0 failed. It ran and passed 5 of this PR's tests:startup_mesh_argument_provenance_warp;startup_descriptor_history_model;startup_descriptor_history_filter_warp;startup_descriptor_history_exhaustion_warp;startup_descriptor_history_incomplete_warp.CI ran none of the
_hardwaretests. Those results come only from the sandbox run above.Verdict: changes still requested. MUST 1 (landing order with #3323) and SHOULD 5 (the rebase) remain. The technical findings are resolved, and the new code passed every sandbox leg with the mutant caught. Once #3323's landing is settled and the branch is rebased, I expect to approve after a quick recheck.
@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.View 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.Merge
Merge the changes and update on Forgejo.