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:
1 parent
8012fff5a1
commit
ca5aa90e09
2 files changed
+6
-437
No files matched your search
@@ -17,17 +17,11 @@ pub struct EnvVar {
|
||||
pub const REGISTRY: &[EnvVar] = &[
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_REPRO_DIR",
|
||||
default: "$TMPDIR/metal2vulkan-repros (the binary's); unset is off (the runtime's)",
|
||||
default: "$TMPDIR/metal2vulkan-repros",
|
||||
effect: "base directory for FALLBACK repro bundles: the input, the device file, the \
|
||||
request's options and descriptor files, repro.sh and failure.txt, in a directory \
|
||||
named by its content, which replays the failure with this binary; the binary \
|
||||
writes one for each failure after it read its inputs; metal2vulkan-runtime's \
|
||||
diagnostics, where set and neither empty nor 0: one for each distinct library \
|
||||
or compute, tile or render pipeline state creation it refuses (the library's \
|
||||
bytes, device.json for --device, the request; not a mesh state or a later \
|
||||
variant), at most 32 bundles and 256 MiB per process, each named in one line \
|
||||
through the device's message sink or on stderr (id name metal2vulkan-repro); the \
|
||||
refusal returned is unchanged",
|
||||
writes one for each failure after it read its inputs",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_<TOOL>",
|
||||
@@ -35,173 +29,6 @@ pub const REGISTRY: &[EnvVar] = &[
|
||||
effect: "absolute per-tool override (for example METAL2VULKAN_LLVM_AS or \
|
||||
METAL2VULKAN_SPIRV_VAL)",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_LANE_VALIDATION",
|
||||
default: "unset (the validation layer's own checks)",
|
||||
effect: "validation's runtime lane only, diagnostics: the validation layer's extra \
|
||||
checks every lane device enables, comma-separated (`sync`: synchronization \
|
||||
validation with shader accesses; `load-store`: load operations after earlier \
|
||||
stores)",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_LOG_PIPELINES",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: one line per compute VkPipeline a device \
|
||||
makes (its kernel, its SPIR-V, its specialization constants, the subgroup size \
|
||||
it requires, whether its simdgroups are emulated for the widest mode's pin or by \
|
||||
the dispatch's variant, its precision notes, the creation's time and the \
|
||||
descriptor it was made from: the function's name, the SHA-256 of its bitcode and \
|
||||
the constant values it was made with), after one as its making starts (its \
|
||||
kernel, its SPIR-V, its specialization, the subgroup size and the simdgroups' \
|
||||
emulation), and one per \
|
||||
render VkPipeline, through the device's \
|
||||
message sink or on stderr: its state, its key, the \
|
||||
key's fields that differ from the state's closest earlier pipeline (a state's \
|
||||
first line also names the descriptor the state 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), and the creation's time, split by the making's parts (the digests, each library made \
|
||||
with its record loaded, missed or its cache shared with an earlier making, and \
|
||||
what its driver reported, found in that cache or compiled, or another caller's, \
|
||||
the link) and by \
|
||||
MoltenVK's activities where its performance tracking is on \
|
||||
(MVK_CONFIG_PERFORMANCE_TRACKING=1); 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, and how many such draws the snapshot's area rule weighed at each \
|
||||
share of their colors' pixels and texel bytes; set to anything but empty or 0",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_DUMP_PIPELINES",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: a directory (made where missing) each device \
|
||||
writes the SPIR-V modules of every render and compute VkPipeline it makes into \
|
||||
(a compute pipeline's as its making starts), one file per \
|
||||
module, `<hash>.spv`, the hash METAL2VULKAN_LOG_PIPELINES's lines name the \
|
||||
module by, each written once; setting it turns that log on too; empty or 0 is \
|
||||
off",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_LOG_MEMORY",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: one line per VkDeviceMemory a device \
|
||||
allocates, imports or frees, through the device's message sink or on stderr: \
|
||||
its kind, handle, memory type, bytes, host address (an import's) and device \
|
||||
address range (a block of buffers that take device addresses), to place a GPU \
|
||||
fault's address; and one line per placement of \
|
||||
4 MiB or more in a pooled block as it is placed and returned: image or buffer, \
|
||||
its memory class (placed), bytes, offset and block, to show what makes and \
|
||||
frees blocks; one line per placement that takes a kept empty dedicated \
|
||||
block: its memory class, bytes, block and memory type; and one line per copy of \
|
||||
a no-copy object's host pages as it is made and as it goes: the caller's \
|
||||
pointer and length, and the copy's host address; on Linux with glibc each line \
|
||||
ends with glibc's heap (bytes in use, free, held by its arenas, mapped apart) \
|
||||
and the heap trims the process made; set to anything but empty or 0",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_PENDING_AUDIT",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: each device checks, at each \
|
||||
vkBeginCommandBuffer, vkResetCommandPool and command pool given back to its \
|
||||
spares, and at each submission of a command buffer submitted before, that the \
|
||||
GPU completed every submission carrying the command buffers concerned (a \
|
||||
secondary through each primary that executes it), reading those submissions' \
|
||||
timelines with vkGetSemaphoreCounterValue; it logs each one found pending, \
|
||||
through the device's message sink or on stderr, with the thread's backtrace for \
|
||||
the first 8, and changes no work. Costs when set: a lock of the device's ledger \
|
||||
at each of those calls and at each vkCmdExecuteCommands, an entry per command \
|
||||
buffer per submission until a check finds it completed, one \
|
||||
vkGetSemaphoreCounterValue per carrying timeline at each check of a command \
|
||||
buffer still in the ledger; set to anything but empty or 0",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_LOG_SHADOWS",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: one line per shadow a device makes of a \
|
||||
texture (over a buffer's bytes, an IOSurface plane's among them; a usage \
|
||||
shadow; a rotated, two-plane, tiled depth or YCbCr texture's), through the \
|
||||
device's message sink or on stderr: the call, the texture's format, size, \
|
||||
levels and usage, its truth (the buffer's storage mode, length and object ID, \
|
||||
the texels' offset and row pitch, or its own image), and what made it a \
|
||||
shadow; once per shadowed texture, at the first draw or dispatch that binds \
|
||||
it, whether its function fetches, samples or writes it and its samplers' \
|
||||
filters; once per texture over a buffer of private option bit 24 whose read \
|
||||
twin is not in place, why; and one line per reader's snapshot a draw takes \
|
||||
(its texture, the snapshot's format and extent, the recycler's image or one \
|
||||
placed for it); set to anything but empty or 0",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_LOG_PASSES",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: the textures and pipeline states to watch, \
|
||||
a comma-separated list of FORMAT:WIDTHxHEIGHT (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); at the end of \
|
||||
each render pass that renders into a watched texture, binds one to its \
|
||||
fragment stage, makes one resident or draws with a watched state, one line \
|
||||
through the device's message sink or on stderr: the pass's attachments \
|
||||
(format, size, level, slice, object ID and label, load and store actions, \
|
||||
stand-in, storage form), its Vulkan render pass instances and draws, its draws' \
|
||||
pipeline states (with their label hashes) and the textures bound to their \
|
||||
fragment stage, and what it watched; a pass the same as one \
|
||||
printed before but for its counts prints no line again, and at most 256 lines \
|
||||
are printed; empty or 0 is off",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_QUEUE_TIMES",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: each command buffer also notes the host \
|
||||
time its first batch became the first of its queue's batches the scheduler \
|
||||
had not taken, and the host time the vkQueueSubmit that carried its last batch \
|
||||
returned, which the consumer reads beside its kernel times \
|
||||
(CommandBuffer::queue_head_time, CommandBuffer::submit_returned_time), and each \
|
||||
batch whose submission held its thread 5 ms or longer before its vkQueueSubmit \
|
||||
call, or before its hold in a group of batches for one vkQueueSubmit in the \
|
||||
call's place, is named in one line (id name metal2vulkan-slow-submissions), its \
|
||||
time split by phase, and the submitting thread's CPU time across each \
|
||||
vkQueueSubmit is counted (WorkCounts::batch_submit_cpu_nanos and \
|
||||
submit_long_call_cpu_nanos, 0 when unset; two reads of the thread's clock a \
|
||||
call, a system call on Linux); it changes no work; set to anything but empty or \
|
||||
0",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_ENCODER_TRAIL",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: each device submits each encoder (or 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 the encoder was: its \
|
||||
kind, its command buffer's object ID, its place among the command buffer's \
|
||||
encoders, a render pass's area and attachments' formats and sizes, its \
|
||||
indirect command executions, and the label hashes of the pipeline states it \
|
||||
bound (a SHA-256 of each state's label and functions' names: no name and no \
|
||||
shader text), and those its indirect commands named at a host step; once no \
|
||||
work of the device advanced for 2 s while some was pending, one line through \
|
||||
the device's message sink or on stderr for each queue whose oldest batch is \
|
||||
pending names that encoder and the last one the queue completed, and a line \
|
||||
names a host step's own waited submission (a rate-map fan-out probe, a loop's \
|
||||
check) that ran for 2 s; costs when set: a submission per encoder and a line \
|
||||
formatted at each encoder's end; set to anything but empty or 0",
|
||||
},
|
||||
EnvVar {
|
||||
name: "METAL2VULKAN_ENCODER_TIMES",
|
||||
default: "unset (off)",
|
||||
effect: "metal2vulkan-runtime's diagnostics: each device that writes timestamps and \
|
||||
resets query pools on the host writes a timestamp at each render, compute and \
|
||||
blit encoder's start and end in the encoder's own recording (a compute encoder \
|
||||
that records on in the one before it included), changing no batch and no \
|
||||
submission, and at each command buffer's completion gives each encoder's GPU \
|
||||
time to its kind and the label hashes of the pipeline states it bound (a SHA-256 \
|
||||
of each state's label and functions' names: no name and no shader text); every \
|
||||
5 s of activity and as the device goes, the top 20 of those by GPU time (their \
|
||||
encoders, dispatches and draws, total, and p50, p90 and most per encoder) in \
|
||||
lines through the device's message sink or on stderr (id name \
|
||||
metal2vulkan-encoder-times); a value of the form <N>ms (for example 20ms) also \
|
||||
prints one line per command buffer whose GPU time is N ms or more, each \
|
||||
encoder's time and offset in it, 1024 lines at most; costs when set: two \
|
||||
timestamp queries per encoder, a VkCommandBuffer more per render pass, a \
|
||||
SHA-256 at each pipeline state bound, a query read per encoder and a lock of \
|
||||
the device's tally at each completion; set to anything but empty or 0",
|
||||
},
|
||||
];
|
||||
|
||||
/// Multi-line `--help` block listing every registry var.
|
||||
@@ -216,95 +43,13 @@ pub fn help_text() -> String {
|
||||
out
|
||||
}
|
||||
|
||||
/// The base directory for FALLBACK repro bundles (`REGISTRY`), as set: the binary's (it writes
|
||||
/// under `$TMPDIR/metal2vulkan-repros` where unset), and metal2vulkan-runtime's where neither empty
|
||||
/// nor `0` (unset, it writes none). A default-off diagnostic in the runtime: it writes files, and
|
||||
/// changes no translation and no answer.
|
||||
/// The base directory for the binary's FALLBACK repro bundles (`REGISTRY`), as set; the binary
|
||||
/// writes under `$TMPDIR/metal2vulkan-repros` where unset. It writes files, and changes no
|
||||
/// translation and no answer.
|
||||
pub fn repro_dir() -> Option<OsString> {
|
||||
std::env::var_os("METAL2VULKAN_REPRO_DIR")
|
||||
}
|
||||
|
||||
/// The validation layer's extra checks validation's runtime lane enables on every device it makes,
|
||||
/// as set: a comma-separated list the lane parses and refuses when it names an unknown check (or
|
||||
/// is not Unicode). A default-off diagnostic of the lane's test devices; no product path reads it.
|
||||
pub fn lane_validation() -> Option<OsString> {
|
||||
std::env::var_os("METAL2VULKAN_LANE_VALIDATION")
|
||||
}
|
||||
|
||||
/// Whether metal2vulkan-runtime logs each render `VkPipeline` it makes (`REGISTRY`): set, and
|
||||
/// neither empty nor `0`. A default-off diagnostic: it changes no pipeline, only what is printed.
|
||||
pub fn log_pipelines() -> bool {
|
||||
std::env::var_os("METAL2VULKAN_LOG_PIPELINES")
|
||||
.is_some_and(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// Whether metal2vulkan-runtime logs each `VkDeviceMemory` a device allocates, imports or frees,
|
||||
/// and each placement of 4 MiB or more in a pooled block (`REGISTRY`): set, and neither empty nor
|
||||
/// `0`. A default-off diagnostic: it changes no
|
||||
/// allocation, only what is printed.
|
||||
pub fn log_memory() -> bool {
|
||||
std::env::var_os("METAL2VULKAN_LOG_MEMORY")
|
||||
.is_some_and(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// Whether metal2vulkan-runtime logs each shadow a device makes of a texture (`REGISTRY`): set,
|
||||
/// and neither empty nor `0`. A default-off diagnostic: it changes no
|
||||
/// texture, only what is printed.
|
||||
pub fn log_shadows() -> bool {
|
||||
std::env::var_os("METAL2VULKAN_LOG_SHADOWS")
|
||||
.is_some_and(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// The directory metal2vulkan-runtime writes its pipelines' SPIR-V modules into
|
||||
/// (`REGISTRY`), as set; `None` where unset, empty or `0`. A default-off diagnostic: it writes
|
||||
/// files, and changes no pipeline.
|
||||
pub fn dump_pipelines() -> Option<OsString> {
|
||||
std::env::var_os("METAL2VULKAN_DUMP_PIPELINES")
|
||||
.filter(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// The textures metal2vulkan-runtime's pass log watches, as set (`REGISTRY`): a comma-separated
|
||||
/// list of `FORMAT:WIDTHxHEIGHT` the runtime parses, empty or `0` for none. A default-off
|
||||
/// diagnostic: it changes no pass, only what is printed.
|
||||
pub fn log_passes() -> Option<OsString> {
|
||||
std::env::var_os("METAL2VULKAN_LOG_PASSES")
|
||||
}
|
||||
|
||||
/// Whether each metal2vulkan-runtime device runs its pending audit (`REGISTRY`): set, and neither
|
||||
/// empty nor `0`. A default-off diagnostic: it reads timelines and prints, and changes no work.
|
||||
pub fn pending_audit() -> bool {
|
||||
std::env::var_os("METAL2VULKAN_PENDING_AUDIT")
|
||||
.is_some_and(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// Whether each metal2vulkan-runtime command buffer notes when its first batch became its queue's
|
||||
/// head in the scheduler's order and when the submission of its last batch returned, and each
|
||||
/// batch whose submission held its thread 5 ms or longer before the driver's call is named phase
|
||||
/// by phase, and each submission's thread CPU time is counted (`REGISTRY`): set, and neither empty
|
||||
/// nor `0`. A default-off diagnostic: it reads the host's clock twice more a command buffer and at
|
||||
/// each phase of a submission, the thread's clock twice a submission, prints, and changes no
|
||||
/// work.
|
||||
pub fn queue_times() -> bool {
|
||||
std::env::var_os("METAL2VULKAN_QUEUE_TIMES")
|
||||
.is_some_and(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// Whether each metal2vulkan-runtime device submits each encoder alone and names the encoder its
|
||||
/// GPU stopped in (`REGISTRY`): set, and neither empty nor `0`. A default-off diagnostic: it
|
||||
/// changes how the work is split into submissions, never what it computes, and prints.
|
||||
pub fn encoder_trail() -> bool {
|
||||
std::env::var_os("METAL2VULKAN_ENCODER_TRAIL")
|
||||
.is_some_and(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// Whether each metal2vulkan-runtime device times its encoders on the GPU, and the threshold of its
|
||||
/// lines per command buffer (`REGISTRY`), as set: `None` where unset, empty or `0`; the runtime
|
||||
/// reads a value of the form `<N>ms` as that threshold. A default-off diagnostic: it adds
|
||||
/// timestamps to the encoders' recordings, prints, and changes no work's answers.
|
||||
pub fn encoder_times() -> Option<OsString> {
|
||||
std::env::var_os("METAL2VULKAN_ENCODER_TIMES").filter(|value| !value.is_empty() && value != "0")
|
||||
}
|
||||
|
||||
/// Optional path override for an external tool `cmd` (`llvm-as`, `spirv-val`, …), read from
|
||||
/// `METAL2VULKAN_<CMD>` (uppercased, `-`→`_`). A dynamic family — one var per tool the binary or
|
||||
/// the crate's test support runs — documented in `REGISTRY` as a single `METAL2VULKAN_<TOOL>`
|
||||
|
||||
+1
-177
@@ -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
|
||||
|
||||
Reference in new issue
Block a user