From bd427d30caa39ff5e8a2e2a49c351c7fe2904d4c Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 12 Nov 2026 03:33:33 -0800 Subject: [PATCH] Name the air.* intrinsic in a texture or sampler family refusal that names nothing One family refuses many operations alike: Lowering(Texture), NotImplemented, has some 30 sites, and a refusal's location (a block and an instruction of the canonicalized function) does not say which operation a consumer's log met. lower::select now names the call's declaration (Unsupported::naming, diagnostics only, as route_air and the ray tracing family already do) where a texture or sampler family selection of an air.* call refuses it without a symbol. Feature, needs and location are unchanged, so no golden cell moves. Why: a consumer's GL-on-Metal pipeline is refused Lowering(Texture) at block 68 instruction 748 of a function whose AIR stays on the guest; the next log names the operation. --- crates/metal2vulkan/src/lower/select.rs | 27 ++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/crates/metal2vulkan/src/lower/select.rs b/crates/metal2vulkan/src/lower/select.rs index 87b8293dc..2a07e27cd 100644 --- a/crates/metal2vulkan/src/lower/select.rs +++ b/crates/metal2vulkan/src/lower/select.rs @@ -1312,6 +1312,21 @@ struct BodySelection { blocks: u64, } +/// A texture or sampler family's refusal of an `air.*` call that names nothing names the +/// intrinsic's declaration (diagnostics only): one family refuses many operations alike. +fn named_image_call(cx: &SelectCx<'_>, inst: &Inst, family: LowerFamily, e: Error) -> Error { + let image = matches!(family, LowerFamily::Texture | LowerFamily::Sampler); + match (e, &inst.kind) { + (Error::Unsupported(u), InstKind::Call(c)) if image && u.symbol.is_none() => { + match c.callee { + crate::air::ir::Callee::Air { decl, .. } => u.naming(decl_name(cx, decl)).into(), + _ => u.into(), + } + } + (e, _) => e, + } +} + fn located(e: Error, cx: &SelectCx<'_>, block: u32, inst: InstId) -> Error { match e { Error::Unsupported(u) if !u.is_placed() => Error::Unsupported(u.placed_at( @@ -1398,11 +1413,13 @@ fn select_body( .ok_or_else(|| invariant("an instruction out of the value range"))?; let outcome = match route(cx, id, inst) { Route::Refuse(e) => Err(e), - Route::Family(f) => select_inst(cx, id, inst, f, m).map(|s| { - if let Some(slot) = strategy.get_mut(vid.index()) { - *slot = Some(s); - } - }), + Route::Family(f) => select_inst(cx, id, inst, f, m) + .map_err(|e| named_image_call(cx, inst, f, e)) + .map(|s| { + if let Some(slot) = strategy.get_mut(vid.index()) { + *slot = Some(s); + } + }), Route::Control => match &inst.kind { InstKind::Phi { .. } => cx .lowered_repr(Value::Inst(id), inst.ty)