Diagnostics: encoder times count draws again; the pass log watches states by label hash

METAL2VULKAN_ENCODER_TIMES counted a render encoder's draws only where a draw
took every step: a draw drawn again as before (render/draw_again.rs) or rebound
(render/draw_again/rebound.rs) bumped the encoder's draw calls but not its
timed work, so a row named a fraction of its draws (a measured guest run: rows
of about 2300 draws/s against about 36k indexed Vulkan draws/s). Both paths now
count as the program's draws, as every step's do.

METAL2VULKAN_LOG_PASSES watched only textures by format and size, and its
256-line bound was spent before the pass of interest ran: in that run every
2768x1570 pass before the measured step printed (256 lines distinct even with
object IDs left out, 171 by attachments and states alone), so the pass the
encoder times ranked first never printed. A `state:HASH` entry now watches a
render pipeline state by the label hash the encoder times name their rows by
(encoder_trail::label_hash), so a run can name exactly the pass it needs; each
state in a line carries its hash, so a line maps encoder-time rows to states.
The hashes are worked out only where the log watches a state or prints a line.
The bound and the once-per-pass rule are as before.

Both are default-off diagnostics and change no work while off.

Tests: tests::encoder_times::an_encoder_s_draws_again_count_among_its_draws
(draws again as before and rebound, each counted, in a line of all its draws;
fails without the fix: the line names only the draws that took every step);
tests::pass_log state-entry parsing, refusals and matching.
This commit is contained in:
Anees Iqbal committed 2026-11-16 03:29:01 -08:00
1 parent 325eb61cde
commit c2aedcd64c
7 files changed
+237 -41

No files matched your search

+5 -3
View File
@@ -2226,12 +2226,14 @@ shadow, whose own line, under the call `make_twin_texture`, names the twin's byt
full; or the making's error).
With `METAL2VULKAN_LOG_PASSES` set to a comma-separated list of `FORMAT:WIDTHxHEIGHT` (the format
as the notices print it or as Metal names it, `*` for any format or any size, for example
`RGBA16Float:128x128`), a device logs a line at the end of each render pass that renders into a
texture of the list, binds one to its fragment stage or makes one resident (id name
`RGBA16Float:128x128`) and of `state:HASH` (a render pipeline state's label hash, the 16 hex
digits `METAL2VULKAN_ENCODER_TIMES` names its rows by), a device logs a line at the end of each
render pass that renders into a texture of the list, binds one to its fragment stage, makes one
resident or draws with a state of the list (id name
`metal2vulkan-passes`, `Info` severity): its render area, Vulkan render pass instances and draw
calls; each attachment's format, size, object ID, label, level, slice, load and store actions,
whether its texture took its storage form, and the stand-in it renders through with its cause;
the pipeline states its draws drew with (label and functions); the textures bound to the fragment
the pipeline states its draws drew with (label, functions and label hash); the textures bound to the fragment
stage at a draw; the watched textures among those it made resident, with their stages; and what
it watched. A pass the same as one a line was printed of before, but for its counts of draw calls
and resident textures, prints no line again, and a process prints at most 256. Empty or `0` is