Repository navigation
startup: census of direct draws not drawn and of clears - #3482
Conversation
Both requested WARP tests passedI ran the stock tests at clean PR head
The WARP depth/stencil and census tests went past the debug-message callback check. The census assertions covered the refusal count and first-seen frame, RTV/DSV clear shape counts, and 134 calls across 128 retained shapes with one overflow call. All five D3D12 runs recorded zero debug-layer errors and device removal reason |
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 2215b108 by reading the diff; not built or run. For scale, our native-only run on main 44a3ad5a + #3506 #3516 #3464 #3521 #3097 (without this PR): 180 s, 3,499 frames, not drawn 143113, clears 41981.
Verdict: approve. Acceptance is unchanged, and the census names exactly what we had to find by hand. Our stale-layer pass in #3560 (key 05dc00b8b79c1d4b, refused natively) would show here as native_graphics_refused with its key on every frame. No MUST.
- SHOULD
per_reason_refusal_census.h:44says the scan "is the keyed sample, not the per-draw path".count_direct_draw(d3d12_draw.inl:3801-3809) now callsnote()on every undrawn direct draw: about 41 per frame (800/s) in the run above, each a mutex plus a scan of up to 128 entries withstrcmp. The cost is small at that rate, but the comment now says the opposite of what happens. Please update it, or make clear that per-draw use is intended. When the refusal has no key,known_pipeline_keyalso takesdraw_lockshared for a non-real pipeline (:1255-1256), on a lock that is already contended in native runs. - NIT With
only_if_changed, every shape that recurs each frame is reprinted every five seconds: about 12 clears per frame here, plus each recurring (key, reason). In long runs that is the bulk of the five-second report. - Checked, no finding:
- Each
note_draw_refusalsite gets a code matching its prose, andcodeis reset at entry. Draws refused before any note getunknownfromcopy_sanitized. - Clears are noted only after the desktop call, so refused clears stay out.
first_seen_frameis printed only when given, so the indirect lines are unchanged.
- Each
Tests: startup_clear_uav_warp pins the UAV shapes and value words. The census branch of startup_clear_depth_stencil pins the draw (key, reason, frame), RTV/DSV and overflow lines. CI ran none of them (not in the pr filter); Alexofbulgaria's local run at this head passed.
#3482 added the direct-draw and clear censuses to the same report block, so it is six lines where startup_memory_srv_diag_check expected four. The check failed on both backends and main is red at 077bff3. Validate the four lines the check is about, in order, and require any remaining line to be one of those censuses by prefix, so the block is still constrained rather than accepted whole. Co-authored-by: Kelbo <kelbo@users.noreply.github.com>
Refs #3477 (items 1 and 3; items 2 and 4 are in #3480).
Counting and logging only. Every early return in
draw_translatedreturns the same value, the translated and untranslated counters move as before, and the clear calls are forwarded or refused exactly as before.Direct draws not drawn, per (pipeline key, reason) (item 1)
note_draw_refusalreturned at once unlessX2W_PIPELINE_COLOURwas on, so a direct draw that drew nothing left no key and no reason. It now always records the key and a fixed reason code; the prose text is still written only with the switch on.count_direct_drawreplaces the two identical counting blocks indraw_startup_directandlist_draw_indexed. For a draw that was not drawn it notes (key, code) in a thirdPerReasonRefusalCensus,direct-draw. When the refusal carries no key, the key of the bound pipeline is used if it is known.Reason codes:
no_recording_list,no_pipeline_bound,render_targets_not_bound,topology_not_translated,pipeline_not_decoded,no_target_translation,manifest_absent,manifest_refused,native_graphics_refused,d16_view_not_ready,formatted_buffer_not_ready,fixed_vertex_stream_refused,pipeline_state_unavailable,sampler_heap_unavailable,raw_uav_shape_unsupported,resource_binding_refused.PerReasonRefusalCensus::notetakes an optional frame number, stored on insertion only.first_seen_frameis printed only when a frame was given, so the two indirect census lines are unchanged.Clear census (item 3)
clear_census.haddsClearCensus, a table of 128 distinct clear shapes with a call count each. The key is:rtv,dsv,uav_uint,uav_float;A clear is noted only after the desktop
Clear*call, so refused clears (null target, no flags, read-only view, unreadable rectangles or values) are not in it. Once the table is full, a new shape adds tooverflow callsand to the total only.Both censuses are mutex-guarded and are printed with the other censuses: changed entries in the five-second report, everything in
x2w_d3d12_census_report.frame_numberis now written withInterlockedExchangeand read withInterlockedCompareExchange. The first-4 log inlist_clear_targetis untouched.Tests
Base
c4b8a41b, presetdev:startup_clear_uav_warp(extended: total, shape count, theuav_uintanduav_floatlines with their value words),startup_per_reason_refusal_census.SKIP: no debug layer message callback):startup_draw_clear_census_warp(new,startup_clear_depth_stencil warp census) andstartup_clear_depth_stencil_warp. The D3D12 debug layer is not installed on the machine used.Mutations, each rebuilt and run:
uav_floatclears not notedstartup_clear_uav_warpstartup_clear_uav_warpMerges cleanly with #3480 and #3481 (
git merge-tree).Not covered
The new assertions for the draw census, the RTV and DSV clears, the overflow count and
first_seen_framewere not run. They are all in thecensusbranch ofstartup_clear_depth_stencil.cpp, which skipped here. Could a reviewer with the debug layer run:No mutation was run against that branch for the same reason: the
X2W_PIPELINE_COLOURguard, a census bypass at either draw entry, afirst_seen_frameoverwrite, the value words left out of the key comparison, the overflow increment.Only direct draws are counted here; the indirect paths keep their own censuses.
The reason given to draws refused after pipeline creation (views, buffer copies, index data, default scissor) is still the single
resource_binding_refused.