env_vars: the ten variables only the deleted runtime read go

With metal2vulkan-runtime deleted, ten accessors in crates/metal2vulkan/src/env_vars.rs have no
reader: lane_validation, log_pipelines, log_memory, log_shadows, dump_pipelines, log_passes,
pending_audit, queue_times, encoder_trail and encoder_times. A grep of the tree finds no call of
any of them and no other read of their METAL2VULKAN_* names, in metal2vulkan-rt or anywhere else.
They go with their registry rows, so `metal2vulkan --help` lists only the variables something
reads: METAL2VULKAN_REPRO_DIR and the METAL2VULKAN_<TOOL> family.

METAL2VULKAN_REPRO_DIR's row and accessor doc lose the deleted runtime's half (its bundles of
refused creations, and "unset is off (the runtime's)"); the binary's bundles are unchanged, and the
binary is the variable's one reader.

docs/API.md's paragraph describing the ten variables (section 9, under "How a notice reaches you")
goes; the heap-texture refusal line after it no longer begins "Whatever the variables". The rest of
section 9 still describes the deleted runtime and is the docs step's.

The env_vars module is hidden (not in tests/api_surface.rs or api_signatures.tsv);
scripts/api-signatures/signatures.py --check is 0 on this tree.

Verified: the gate of this commit (fmt, clippy x3, workspace doc, the metal2vulkan crate's tests).
This commit is contained in:
Anees Iqbal committed 2026-11-20 07:24:20 -08:00
1 parent 8012fff5a1
commit ca5aa90e09
2 files changed
+6 -437

No files matched your search

+1 -177
View File
@@ -2441,183 +2441,7 @@ How a notice reaches you:
- `Device::degraded_objects(kind)` counts the textures a device met as a kind that is announced
once per object.
With `METAL2VULKAN_LOG_PIPELINES` set, a device also logs one line per compute `VkPipeline` it
makes (id name `metal2vulkan-pipeline-creation`, `Info` severity): its kernel, its SPIR-V (a hash
and its length), each specialization constant, the subgroup size the pipeline requires
(`subgroup size required 32`, or `subgroup size any`), whether its kernel's simdgroups are
emulated in place of the pin to the device's widest mode (`simdgroups emulated (widest pin)`) or
by the dispatch's emulated-simdgroups variant (`simdgroups emulated (variant)`), else `simdgroups
not emulated for the widest pin or a variant` (which does not tell whether the translator emulated
them for another cause), the precision notes the stage holds under that specialization, the
creation's time and the descriptor the kernel was made from (the function's name, the SHA-256 of
its bitcode and the constant values it was made with), after a line as the making starts, before
the driver's call, naming its kernel, its SPIR-V, its specialization, the subgroup size and the
simdgroups' emulation: a making that never returns is that line without its made line. And one
line per render `VkPipeline` it makes (the same id name and severity), with where its time went:
the wait for its turn, the digests that name its parts, each library (made by this making, its
driver cache record loaded, missed or shared with an earlier making in this process, and whether
its driver found it in that cache or compiled it, or another caller's) and the link (a record
names its pass by which attachments it has, its samples and its inputs, not their formats; a
format a stage's translation reads names the record through that stage's module, so makings that
differ only in formats no translation reads share one); a state's first line also names the
descriptor it was made from (each function's name, the SHA-256 of its bitcode and the constant
values it was made with, each color attachment's format, blend and write mask, the depth and
stencil formats and the raster samples). With `METAL2VULKAN_DUMP_PIPELINES` naming a directory, a
device writes each such pipeline's SPIR-V modules there, render and compute (a compute module as
its making starts), one file per module named by the hash
the line prints it by (`<hash>.spv`), and the log is on too. And, once per reason, why a draw
that reads its own pass's color attachment after a barrier took the split rather than a snapshot
(id name `metal2vulkan-snapshot-fallback`, `Info` severity; `WorkCounts::reading_draws_snapshotted`
counts those that took a snapshot), and now and then a count of the draws the snapshot's area rule
weighed, by their scissors' share of the target, texel bytes and the form each took (id name
`metal2vulkan-snapshot-readers`, `Info` severity). With `METAL2VULKAN_LOG_MEMORY` set, a device
logs one line per `VkDeviceMemory` it allocates, imports or frees (id name `metal2vulkan-memory`,
`Info` severity): what it holds (a block of buffers or images, a host-memory import with its host
address, a dma-buf import), its handle, memory type, bytes and device address range, where the
block holds buffers that take device addresses (its own buffer of addresses gives the range; the
log makes no Vulkan object to ask one). On NVIDIA that range is the GPU virtual address a fault
report names. It
also logs each placement of 4 MiB or more in a pooled block as it is placed and returned: an image
or a buffer, its memory class where placed, its bytes, its offset and its block's handle and type;
and each placement that takes a kept empty dedicated block, which allocates nothing: its class,
bytes, block and memory type; and each copy of a no-copy object's host pages (`copied-host-pages`)
as it is made and as it goes: the caller's pointer and length and the copy's host address, the
two ranges the runtime's comparisons write on the CPU. On Linux with glibc's allocator each line
ends with glibc's heap then, every arena's (`mallinfo2`: bytes in use, bytes free, what its arenas
hold, what it mapped apart) and the `malloc_trim` calls the process made (after its large pipeline
makings, and at its devices' idle sweeps once more than 256 MiB of free heap came since the last
trim), so a resident set that grows and stays reads as free heap, heap in use, or neither.
With `METAL2VULKAN_LOG_SHADOWS` set, a device logs one line per shadow it makes of a texture (id
name `metal2vulkan-shadows`, `Info` severity): the call (an IOSurface plane's among them, or the
binding's or pass's call for a shadow made at its first use), the texture's format, size, levels
and usage, its truth (a buffer's storage mode, length and object ID with the texels' offset and row
pitch, or the texture's own image), and what made it a shadow. The shadows it names are a texture's
over a buffer's bytes where no image over them serves (as its `shadowed-texture` notice says it), a
usage shadow (a binding beyond the texture's usage, a draw that samples a color attachment of its
own pass, or a YCbCr texture's writes, with what the texture's own image is: an aliasing image over
the bytes with or without the feedback loop usage, a shadow, or an image of its own), a rotated
texture's image of its stored frame and its twin, a two-plane extended-range texture's image, a
depth or stencil texture's tiled twin over a surface plane, and a YCbCr texture's converted image
and render shadow. A heap texture's shadow, a view's shadow of an image and a texture buffer's
staging are not logged. It also logs, once per shadowed texture (a shadow of its truth, a usage
shadow or two faces that take turns), at the first draw or dispatch whose pipeline uses a slot that
binds it: the slot, whether the function fetches, samples or writes the texture, and the filters of
each sampler it samples it through (a sampler state's minification, magnification and mipmap
filters, or a constexpr sampler's as the pipeline layout bakes it). And once per texture over a
buffer of Metal's private option bit 24 whose read twin is not in place over the twin's bytes: the
texture, its buffer, offset and row pitch, and why (the twin's placement where its making made a
shadow, whose own line, under the call `make_twin_texture`, names the twin's bytes and the cause in
full; or the making's error). And one line per reader's snapshot a draw takes (a draw that samples a
color attachment of its own pass at its own pixels and writes that color reads it through a storage
image of the texture's extent, held by the command buffers whose draws take it): the draw's call,
the texture it binds (format, size, levels, usage, object ID, and the texture it is a view of), the
snapshot's format and extent, and whether its image is the recycler's parked one or one placed for
it (`WorkCounts::reading_snapshots_taken` and `reading_snapshots_recycled` count them).
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`) 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, 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
off; a value the runtime cannot read turns the log off and says why on stderr.
With `METAL2VULKAN_QUEUE_TIMES` set, each command buffer also notes two host times beside its
kernel times, in seconds of `host_time`'s clock: when its first batch became the first of its
queue's batches the device's scheduler had not taken, the batch before it on its queue taken for
submission (`CommandBuffer::queue_head_time`), and when the `vkQueueSubmit` that carried its last
batch returned (`CommandBuffer::submit_returned_time`; its `kernelEndTime` is that call's start).
From its commit to the first it waited behind its queue's earlier work, and from the first to its
`kernelStartTime` it was held at its queue's head. Both read 0 where it is unset, and for a command
buffer whose work went with no submission. Each batch whose submission held the thread that made
it (the scheduler's, or a committing or waiting thread's) 5 ms or longer from its start to its
`vkQueueSubmit` call, or to its hold in the device's group of batches that go in one
`vkQueueSubmit` in that call's place, is also named in one line (id name
`metal2vulkan-slow-submissions`): its place in its command buffer, its `VkQueue` slot, and the span
split into the prologue, its first work's take, the staging queue's flush (with its waits for the
staging queue's lock and for one of that queue's command buffers counted apart), and the planning
and recording, then the call's own time, or that it went to the group. The submitting thread's
CPU time across each `vkQueueSubmit` is counted then too (`WorkCounts::batch_submit_cpu_nanos`,
and `submit_long_call_cpu_nanos` for the calls of 1 ms or more), 0 where it is unset: the thread's
clock is a system call on Linux, two reads a call. It changes no work.
With `METAL2VULKAN_PENDING_AUDIT` set (or `DeviceOptions::pending_audit`), a device checks, at each
`vkBeginCommandBuffer`, each `vkResetCommandPool` of a spare command pool, each command pool given
back to its spares and each submission of a command buffer submitted before (one not begun for
simultaneous use), that the GPU completed every submission that carries the command buffers
concerned: a batch's, the device's own and the staging and fill queues', to the timeline value each
signals, and a secondary through each primary that executes it. It reads those timelines
(`vkGetSemaphoreCounterValue`) and logs each command buffer found pending (id name
`metal2vulkan-pending-audit`, `Info` severity): what was done, the thread, the command buffer, the
timeline, its counter and the value, with the thread's backtrace for the first 8; and a line as the
device is made and as it goes, with the checks and findings by kind. It changes no work.
With `METAL2VULKAN_ENCODER_TRAIL` set (or `DeviceOptions::encoder_trail`), a device submits each
encoder, and each part of one a host step splits off, in a `vkQueueSubmit` of its own that signals
its queue's timeline, grouping no batches, and notes what each encoder was: its kind, its command
buffer's object ID, its place among the command buffer's encoders, a render pass's area, sample
count, attachments' formats and sizes, Vulkan render pass instances and whether it is over a
rasterization-rate map, its executions of indirect commands, and the label hash of each pipeline
state it bound (the first 8 bytes of the SHA-256 of the state's label and its functions' names; no
name and no shader text), and of each state its indirect commands named at a host step, with what
that step drew: each range it read from a buffer (its location and length as the bytes held them,
and the commands it ran), its draws, their vertices or indices times their instances summed, the
draw of the most of those (its primitive type, count and instances), the route each draw took
(plain, a rate-mapped pass's probe, fanned out, or region by region), the executions it recorded in
their GPU form, and the kept chunks it ran again, whose draws it did not read. An execution of render
commands recorded in its GPU form, at the commit or by a host step, is named by its shape (merged
into one draw or a draw per command, indexed or not, its primitive type, the commands its
preprocess runs over and where its range comes from). Once no work of the device advanced for 2 s
while some was pending, it logs one line for each `VkQueue` whose oldest batch is pending (id name
`metal2vulkan-encoder-trail`, `Info` severity): that batch's encoders, with each GPU form's scratch
read while its work is pending (the range the GPU copied, the merged draw's two indirect draws,
the commands whose arguments draw, their vertices or indices times instances and the most of them,
and the command buffer's execution status words: the scratch lies in device memory, so the GPU
copies those words into host-visible memory once the passes that write them ended, before the
draws, and they read zero until then; only reads of host-visible memory already mapped, taking no
lock and waiting for nothing, each word as it stood when read), the last batch the queue
completed, with how long before, and the device's pipeline pool's makings waiting and under way;
once a stall. A
submission a host step makes and waits for itself (a rasterization-rate map's fan-out probe, a
predicated loop's check run again) signals no timeline: once it ran for 2 s, one line names it,
the encoder whose step made it and the states its commands named. The stall probe and the
watchdog count as they do without it, after its line. It changes when work goes to the driver, and
its timing, never what the work computes.
With `METAL2VULKAN_ENCODER_TIMES` set, a device times each render, compute and blit encoder on the
GPU: a timestamp at the bottom of the pipe as the first command of the `VkCommandBuffer` the
encoder opens in (a compute encoder that records on in the one of the compute encoders before it
writes it there, at its place) and one as the last command of the one it ends in, after its render
pass instance's end and its copies back. It changes no batch, group or submission; a render pass
whose draws record inline takes a `VkCommandBuffer` of its own after the encoder's, so the commands
the encoder records before the pass come after its start. An encoder's time runs from the moment
the work submitted before it completed (or the GPU reached its start, where it waited for nothing)
to the moment its own completed, so a queue's encoders share its busy time with no time counted
twice; where two encoders' dispatches overlap, the overlap counts for the one that ends first, and
an encoder's dispatches and draws are not timed apart (an encoder of one dispatch gives that
kernel's time). At each command buffer's completion, each encoder's time is given to its kind and
the label hashes of the pipeline states it bound (as the encoder trail names them: the first 8
bytes of the SHA-256 of a state's label and its functions' names; no name and no shader text), one
row for each kind and list of states; an encoder of several states is not split among them. Every
5 s of activity, and as the device goes, it logs a summary (id name `metal2vulkan-encoder-times`,
`Info` severity): the command buffers, the encoders timed and not, and their GPU time since the
last, then the 20 rows of the most GPU time, each with its encoders, the dispatches and draws the
program called, its total and share, and its time per encoder at the median and the 90th percentile
(each within 1/32 of the truth) and the most. A value of the form `<N>ms` (for example `20ms`) also
logs one line per command buffer whose GPU time is `N` ms or more, 1024 at most: each encoder's
place, kind, states, dispatches and draws, offset from the command buffer's GPU start and time. An
encoder whose recording ran nothing reads no time and counts as not timed: one encoded again (a
rebind, a failure that splits a group of encoders recorded together), one left out by command predication or
failed, and one that ended inside a predicated loop. An encoder whose parts went in submissions
apart, with a host step between them, counts the time between them. It does nothing on a device
whose queue family writes no timestamps, one the runtime adopted (it resets query pools on the
host, which an adopted device may not enable), or one whose timestamps are Metal counter samples
(MoltenVK). It costs two timestamp queries per encoder, a `VkCommandBuffer` more per render pass
recorded inline, a SHA-256 per pipeline state bound, and a query read per encoder at each
completion; it changes no work's answers.
Whatever the variables, a placement heap's `newTextureWithDescriptor:offset:` that makes no texture
A placement heap's `newTextureWithDescriptor:offset:` that makes no texture
(`Nil` or `OutOfMemory`) at an offset inside the heap says so (id name
`metal2vulkan-heap-texture-refused`, `Info` severity): the descriptor, the offset, the heap's size,
options and memory, the size and alignment the size query answers the descriptor, what the making