Files
metal2vulkan/crates
Anees Iqbal 3daaca19fc Fill with vkCmdFillBuffer on MoltenVK too: drop FillCompiledPerCommandPool and the transfers form
On MoltenVK the runtime recorded every fill as transfers (a vkCmdUpdateBuffer of the first
64 KiB, then copies of what was filled past barriers), because DriverFact::FillCompiledPerCommandPool
said MoltenVK compiles its fill pipeline per command pool inside vkQueueSubmit and, behind a storm
of pipeline creations, a commit waited 250-330 ms there (MoltenVK 1.4.1 on an M4). That release
runs on no venue any more, and the tree's own 1.4.2 note recorded that the wait was not found
there: a fresh pool's first vkCmdFillBuffer took 0.022-0.038 ms in vkQueueSubmit beside one to
eight threads making 91 and 496 compute pipelines.

The transfers form has a real cost at submission: MoltenVK ends its encoder at every barrier, and
a 256 MiB fill took four. Measured on the M3 Max (MoltenVK 1.4.2), the signaller of
event-wait-behind-a-running-signal (192 fills of 256 MiB) from its commit to Scheduled:
- selection of the case, median: 4.3 ms as transfers, 0.55-0.6 ms as vkCmdFillBuffer;
- under CPU spin on every core, worst of 15: 10.2 ms against 2.7 ms;
- first row inside whole-set replays: 21.2, 15.0 and 9.5 ms against 1.8 and 0.8 ms;
which put the case at its 20 ms window and, under load (5506), past it: a divergence of ours
(Metal's own recording held in 25 of 25 runs under the same loads, 5580).

So every fill is one vkCmdFillBuffer on every driver. With no driver carrying the fact, its
variant, its row and its tests go, and so do the transfers form (word_fill's steps), its tests
and WorkCounts::fills_by_transfers; the first move's zeros fill on a discrete device without the
transfers check; the lanes that split their expectations by the fact expect one fill each.
Signatures regenerated (the count and the two DriverFact variants removed).

Every M3 cost record that fills moves (cmd_update_buffer, cmd_copy_buffer and barriers down,
cmd_fill_buffer up): the M3 cost set wants a whole-set re-bless after this lands.

(cherry picked from commit ac0310c517e62c9c490c58539f001e0ffc004a47)
2026-11-07 16:34:02 -08:00
..