Files
metal2vulkan/docs
Anees Iqbal 0b7d408201 Runtime and replay player: count barriers by cause, the guest's blits and buffer binds, and over-copy bytes by frame
What:
- Metrics counts every barrier in one of seven causes, whose sum Metrics::barriers now is:
  pass_start_barriers (a render pass's first), pass_home_barriers (the move of its attachments
  home at its end), blit_barriers, dispatch_hazard_barriers (a dispatch's own, at a hazard or
  paying one owed), segment_end_barriers, upload_barriers (the uploads' and Managed copy-ins'
  barriers, the over copies they carry among them) and other_barriers (inside a pass, over
  copies in a command buffer, heap moves ahead of a command or segment, releases). Metric::Barriers
  is gone: each site that records a barrier counts its cause, and the shared helpers
  (Building::barrier, alias::record, over::record_side) take the cause from their caller.
- The replay player's executed counters carry the seven, so each frame line prints them.
- The player's stream counts (the guest's, fixed by the stream) add blits, an encoder's copy,
  fill, mipmap, synchronize, reset and optimize commands, and the buffer slots the set-buffer
  calls set on render and on compute encoders, each split into buffer changes (another buffer
  than the slot held, or its first set) and offset-only changes (replay/binds.rs).
- The runtime backend's report adds an `over copies by frame` line: over-copy bytes a frame,
  mean and largest frame, by memory class (Private, Shared) and by cause (pitch, dma-buf, host
  memory, every other cause as own_image), and the number of textures in an image of their own
  the largest frame's calls named (new_runtime/over_frames.rs), from counters the runtime keeps.
- docs/REPLAY-STREAM.md and the runtime README name them; the signatures table blessed (7 fields).

Why: the planner's reading of round d9b644bae7's plays: whether pass-boundary and blit barriers
are half or more of a frame's barriers (the two pass forms), and whether over copies of Private
buffers reach 1 MB or 5% of a frame's copied bytes (the third form), needs the barrier split and
the over-copy split a frame, beside what the guest asked for; the guest's buffer binds per draw
and per dispatch size the descriptor work.

Tests: every_barrier_rt_records_is_counted adds a pass over a texture whose home is shader-read
and checks each cause's count against the barrier commands recorded (pass start 1, pass home 1,
blit 2, dispatch hazard 0, segment end 1, upload 6 or more, other 0);
every_device_places_barriers_at_hazards_only checks the dispatch-hazard and segment-end counts on
dependent, independent and concurrent encoders;
every_device_reads_its_attachment_through_a_texture_after_a_memory_barrier checks the causes on
the feedback-loop and the copy path; the player's
the_stream_fixes_its_calls_commits_encoders_draws_dispatches_blits_and_binds checks blits and
every bind count; over_copies_by_frame_give_the_mean_and_the_largest_frame checks the line.
2026-11-25 23:55:46 -08:00
..