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.
This commit is contained in:
Anees Iqbal committed 2026-11-12 03:35:36 -08:00
1 parent 236340a171
commit bd427d30ca
1 file changed
+22 -5
+22 -5
View File
@@ -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)