What: FreshLog keeps a flag, set where FreshLog::add pushes an event. FreshUnwritten::commit
returns before it takes the log's lock where the flag is clear, as it already did where no
texture is noted. A commit that logged something takes the log as before.
Why: host_ab percall's commit rows failed on gate/stack11: commit_one_dispatch 5 allocations
a call (held to 4) and commit_no_copy_dispatch 10 (held to 9). e3b963bdc0 measured 4 and 9 on
9f56956ef3, before the pattern reads moved to the commit (95d7bdf6dc). Since then, while any
noted texture is live in the process, every commit locks its command buffer's FreshLog mutex,
in these rows for the first time: their dispatches bind only buffers and log nothing. On macOS
a std Mutex makes its pthread mutex at its first lock, one allocation (Rust 1.98.1 on the M3:
4 allocations for the first locks of 4 new mutexes, 0 for the second locks). The trace put
that allocation in FreshUnwritten::commit, the fifth of the commit's sites. The other four
(Predication::end_unit, close_tail, the BatchSync list, gate::Hold::new) are the ones the rows
were measured with.
Verified:
- host_ab --only percall --rounds 1, release, Apple M3 Max (MoltenVK 1.4.2), on 4f0a1043b1
with this branch's two commits before this one, the gate made to print: commit_one_dispatch
4 and commit_no_copy_dispatch 9 allocations a call (stack11 with those two commits: 5 and
10). No row of the gate fails in that run: end_render 24, end_compute 7, end_blit 7,
heap_texture_256 17.25, the draws 0.0390625, dispatch 8.13.
- The traced commit_one_dispatch lists Predication::end_unit, close_tail, the BatchSync list
and gate::Hold::new, the four a trace of 9f56956ef3 lists, and no FreshUnwritten::commit.
- tests::fresh_unwritten (8), tests::tracker and tests::heap pass under --cfg m2v_gpu on the M3
Max (93 of 93).
- cargo clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings, plain and
under --cfg m2v_gpu: clean.
The rows already hold the counts this restores, so the gate itself is the check: it fails
without this change. No answer, announcement or submission changes (a log with no events gave
the record nothing), so RUNTIME_VERSION stays; the runtime sources' pin moves with
fresh_unwritten.rs.
(cherry picked from commit b878f5b569662b4fcf45c23ef84e619e5e212ea6)
(cherry picked from commit 6c70d5b7e01a874aa2cfde501b024cea394209d4)