Pipeline log: a refused kernel's compile takes a line naming its function

A compute state whose kernel's compile is refused, at its creation or at a
dispatch's variant, printed nothing under METAL2VULKAN_LOG_PIPELINES, and
the refusal itself (compile failed: LimitExceeded(SpirvWords)) names no
function, so a consumer's log could not say which kernel it was. The log
now prints, at both compile sites, a line with the kernel's function name,
the refusal, and the descriptor it was made from, as a made pipeline's
line names them. Diagnostics only: nothing else changes.
This commit is contained in:
Anees Iqbal committed 2026-11-12 13:18:48 -08:00
1 parent d782275fc5
commit 0bb4e9f42b
2 files changed
+35 -4

No files matched your search

@@ -9,8 +9,10 @@
//! what the kernel was made from (`descriptor:`, as a render state's first line names each
//! function: its name, its bitcode's SHA-256 and the constant values it was made with). A
//! compute state's pipelines differ by their specialization alone (the threadgroup size, an
//! edge region), so each line prints it whole: no numbering, no diff and no split. The rest of
//! this log is the render pipelines'.
//! edge region), so each line prints it whole: no numbering, no diff and no split. A kernel
//! whose compile is refused, at its state's creation or at a dispatch's variant, takes a line of
//! its own ([`compute_refused`]): its function name, the refusal, and its `descriptor:`. The
//! rest of this log is the render pipelines'.
//!
//! - **What it prints.** One line per render `VkPipeline` a device makes for a draw (or a host
//! step's draw), through the device's message sink at `Info` severity (id name
@@ -749,6 +751,29 @@ pub(crate) fn compute(
);
}
/// Deliver the line of a compute pipeline of `function` whose compile `device` refused with
/// `error`, at its creation or at a dispatch's variant (the module's documentation, "Compute
/// pipelines"): the kernel's function name, the refusal, and what the kernel was made from, where
/// the log is on.
pub(crate) fn compute_refused(
device: &Device,
function: &FunctionDescriptor,
error: &metal2vulkan::error::Error,
) {
if !enabled() {
return;
}
deliver(
device,
format!(
"metal2vulkan: pipeline creation: compute pipeline `{}`: refused: {error:?}; \
descriptor: {}",
function.function.info().name,
super::render::logged_function(function),
),
);
}
/// Hand `line` to the device's message sink, else to stderr.
fn deliver(device: &Device, line: String) {
device.inform("metal2vulkan-pipeline-creation", line);
@@ -859,7 +859,10 @@ impl ComputePipelineState {
let ((found, compiled), key) = stand_in::compile_with_stand_ins(profile, |key| {
Variant::compiled(&sources, function, &kernel, key)
})
.map_err(|error| compile_error(device, error))?;
.map_err(|error| {
creation_log::compute_refused(device, function, &error);
compile_error(device, error)
})?;
additions::check_kernel_maximum(&compiled, call)?;
// Metal fails the creation over a binary function not compiled to a binary once the
// stage links, after a reference it leaves unresolved (`additions.rs`).
@@ -1819,7 +1822,10 @@ impl Variant {
) -> Result<Arc<Variant>, Error> {
let _noted = NoteEntries(device);
let (found, _) = Variant::compiled(&Sources::later(device), function, descriptor, &key)
.map_err(|error| compile_error(device, error))?;
.map_err(|error| {
creation_log::compute_refused(device, function, &error);
compile_error(device, error)
})?;
Variant::of(device, key, found, function)
}