SEMANTICS 2139: An attribute read only into a gated-off output is not read

What: canon's unobserved_code kept every value-only instruction that a surviving
one reads. The returned struct's insertvalue chain stays because the return reads
it, so an insert into the field of an output a function constant gates off (or of a
field a later insert sets again) kept its inserted value alive, and with it the
value's whole computation and the parameter it read. Such an insert now inserts
`undef` in place of a value the observation does not observe (unread_inserts), and
kept_reads follows only its aggregate, so the computation and the parameter's read
go. lower::users::params_used, and with it pipeline::compile::declared_attributes,
then leave out a vertex attribute that reaches only a gated-off varying, and the
vertex projection no longer refuses a descriptor without it.

Why: a render pipeline was refused InvalidDescriptor(VertexAttribute { attribute: 1 }).
Its vertex function reads attribute 1 through one phi into a varying whose
air.function_constant predicate is false in the pipeline's constants. Metal reports
that attribute inactive and makes the pipeline from a descriptor without it. A live
attribute the descriptor lacks stays refused, as Metal refuses it.

Oracle (m3-max-37322, Apple M3 Max, macOS 27.0.1, validation layer off and on), the
new owned fixture fca_vertex_unread_attribute: constant false: attribute 1 active 0,
a descriptor of attribute 0 alone makes the pipeline, texel (64, 128, 191, 255);
constant true: attribute 1 active 1, that descriptor is refused ("Vertex attribute
color(1) is missing from the vertex descriptor"), both attributes draw
(191, 64, 64, 191).

Tests: tests::engine_unread_attribute (six committed profiles: gated off links
with attribute 0 alone and every stage passes L3; gated on refuses
VertexAttribute{1} without it and links with both); the runtime device test
tests::unread_attribute (the same three states, drawn, pixels compared with
Metal's). The lane's job reports and its negative control are in the tip report.

With 9a15486547: Owned fixture: an ungated vertex attribute that reaches only a gated-off varying.

Checks (lane deadattr): clippy plain (-p metal2vulkan-air -p metal2vulkan -p metal2vulkan-runtime, all targets, all features) 0 in m3-max-37340. Oracle m3-max-37322 (M3 Max, macOS 27.0.1, validation off and on): constant off, attribute 1 inactive and a descriptor of attribute 0 alone makes the pipeline; constant on, that descriptor is refused ("Vertex attribute color(1) is missing"). The air and translator suites, the negative control and the lavapipe draw (m3-max-37341) follow on development; golden and census re-bless on development.
This commit is contained in:
Anees Iqbal committed 2026-11-16 11:16:28 -08:00
1 parent e2922ae77c
commit c8484ddf0f
13 files changed
+660 -37

No files matched your search

+130 -34
View File
@@ -9,9 +9,12 @@
//!
//! **Absent outputs**. An output gated off is not part of the specialized function: it leaves the
//! entry point's outputs, and the returned struct keeps its field, which no interface variable
//! receives. Each remaining output names its field. Two remaining color outputs at one color
//! attachment and one blend index are an invalid request (`RequestError::DuplicateColorOutput`):
//! Metal refuses such a specialization when it makes the function.
//! receives. The field is inserted `undef`, so what only computed its value goes
//! ([`unobserved_code`]): a parameter read only into it, such as a vertex attribute, is not read
//! (Metal reports such an attribute inactive). Each remaining output names its field. Two
//! remaining color outputs at one color attachment and one blend index are an invalid request
//! (`RequestError::DuplicateColorOutput`): Metal refuses such a specialization when it makes the
//! function.
//!
//! **Absent arguments**. The LLVM parameter of an argument gated off stays, and the body may still
//! read it (SCCP deletes the reads its own constants guard, not every dead one).
@@ -979,8 +982,14 @@ fn absent_values(
/// allocation, and a terminator are never [`value_only`] or deferred, so the observation starts
/// from them and they stay. A [`value_only`] instruction the observation observes is read by an
/// instruction that stays, or only by the address of a write it deletes; one it does not observe
/// stays only where an instruction that stays reads it (the part of a returned struct no output
/// stores). The body stays valid, and nothing any output, side effect, or branch sees changes.
/// stays only where an instruction that stays reads it: an `insertvalue` of the returned struct's
/// chain, which builds a field no output stores or a later insert sets again. Such an insert stays
/// and inserts `undef` in place of a value the observation does not observe ([`unread_inserts`]),
/// so what computed that value, a parameter's read included, goes with it: the specialized function
/// reads nothing for a field it does not output, as Metal's reads nothing for a gated-off output
/// (Metal reports a vertex attribute that reaches only such an output inactive, and makes the
/// pipeline from a vertex descriptor without it). The body stays valid, and nothing any output,
/// side effect, or branch sees changes.
///
/// Specialization leaves such code where it deletes uses: SCCP removes the uses its constants
/// guard, and an absent argument's unobserved reads take `undef`, so an absent texture table's
@@ -1009,7 +1018,7 @@ pub(super) fn unobserved_code(
let n = body.insts.len();
let gone_bytes = n * std::mem::size_of::<bool>();
m.charge(gone_bytes)?;
let gone = {
let marked = {
let mut private = Private::new(body, &parts.types, &parts.consts, params, &layouts, m)?;
let observed = observation(
body,
@@ -1018,7 +1027,7 @@ pub(super) fn unobserved_code(
&mut private,
m,
);
let gone = observed.and_then(|(o, bytes)| {
let marked = observed.and_then(|(o, bytes)| {
let mut gone = vec![false; n];
for (id, inst) in body.insts.iter() {
m.tick(1)?;
@@ -1027,26 +1036,18 @@ pub(super) fn unobserved_code(
*g = value_only(&inst.kind) || (!seen && private.deferred(id));
}
}
let unread = unread_inserts(body, params, &o, m);
m.release(bytes);
Ok(gone)
Ok((gone, unread?))
});
private.release(m);
gone
marked
};
m.release(parts.types.len() * std::mem::size_of::<Option<Layout>>());
let rebuilt = gone.and_then(|mut gone| {
if !kept_reads(body, &mut gone, m)? {
return Ok(None);
}
scoped(m, |m, held| {
let mut edit = BodyEdit::keep_all(body, m, held)?;
for (i, g) in gone.iter().enumerate() {
if *g {
edit.delete(InstId::new(u32::try_from(i).map_err(|_| invariant("ids"))?));
}
}
apply(body, &edit, &|c| c, m).map(Some)
})
let rebuilt = marked.and_then(|(gone, unread)| {
let r = without_unobserved(body, gone, &unread, &mut parts.consts, m);
m.release(unread.len() * std::mem::size_of::<(InstId, TypeId)>());
r
});
m.release(gone_bytes);
rebuilt?
@@ -1063,10 +1064,62 @@ pub(super) fn unobserved_code(
Ok(())
}
/// `body` without the instructions `gone` marks for deletion that no instruction that stays reads
/// ([`kept_reads`]), each insert of `unread` that stays inserting `undef` of its value's type in
/// place of its value; `None` where that deletes and rewrites nothing.
fn without_unobserved(
body: &Body,
mut gone: Vec<bool>,
unread: &[(InstId, TypeId)],
consts: &mut ConstTable,
m: &mut Meter,
) -> Result<Option<Body>, Error> {
let deletes = kept_reads(body, &mut gone, unread, m)?;
let mut undef = Vec::new();
for &(id, ty) in unread {
m.tick(1)?;
if gone.get(id.index()).copied().unwrap_or(true) {
continue;
}
let value = Const::Undef;
undef.push((id, consts.intern(Constant { ty, value }, m)?));
}
if !deletes && undef.is_empty() {
return Ok(None);
}
scoped(m, |m, held| {
let mut edit = BodyEdit::keep_all(body, m, held)?;
for (i, g) in gone.iter().enumerate() {
if *g {
edit.delete(InstId::new(u32::try_from(i).map_err(|_| invariant("ids"))?));
}
}
for (id, c) in undef {
if let Some(InstKind::InsertValue { agg, indices, .. }) =
body.insts.get(id).map(|x| &x.kind)
{
let kind = InstKind::InsertValue {
agg: *agg,
val: Value::Const(c),
indices: indices.clone(),
};
edit.rewrite.insert(id, kind);
}
}
apply(body, &edit, &|c| c, m).map(Some)
})
}
/// Keep, among the instructions `gone` marks for deletion, every one an instruction that stays
/// reads (transitively), so no surviving use names a deleted instruction. Whether any is still
/// marked.
fn kept_reads(body: &Body, gone: &mut [bool], m: &mut Meter) -> Result<bool, Error> {
/// reads (transitively), so no surviving use names a deleted instruction. An insert of `unread`
/// ([`unread_inserts`]) that stays reads only its aggregate: it inserts `undef` in place of its
/// value. Whether any is still marked.
fn kept_reads(
body: &Body,
gone: &mut [bool],
unread: &[(InstId, TypeId)],
m: &mut Meter,
) -> Result<bool, Error> {
let bytes = gone.len() * std::mem::size_of::<InstId>();
m.charge(bytes)?;
let mut work: Vec<InstId> = body
@@ -1074,26 +1127,69 @@ fn kept_reads(body: &Body, gone: &mut [bool], m: &mut Meter) -> Result<bool, Err
.ids()
.filter(|id| !gone.get(id.index()).copied().unwrap_or(false))
.collect();
let mut keep = |v: Value, work: &mut Vec<InstId>| {
if let Value::Inst(j) = v {
if let Some(g) = gone.get_mut(j.index()) {
if *g {
*g = false;
work.push(j);
}
}
}
};
while let Some(id) = work.pop() {
m.tick(1)?;
let Some(inst) = body.insts.get(id) else {
continue;
};
inst.kind.for_each_value(|v| {
if let Value::Inst(j) = v {
if let Some(g) = gone.get_mut(j.index()) {
if *g {
*g = false;
work.push(j);
}
}
match &inst.kind {
InstKind::InsertValue { agg, .. }
if unread.binary_search_by_key(&id, |(i, _)| *i).is_ok() =>
{
keep(*agg, &mut work);
}
});
kind => kind.for_each_value(|v| keep(v, &mut work)),
}
}
m.release(bytes);
Ok(gone.iter().any(|g| *g))
}
/// The `insertvalue` instructions of `body` whose inserted value the observation `o` does not
/// observe (an instruction it leaves unobserved, or a parameter of `params` it reads only
/// unobserved), each with that value's type, in instruction order: the inserts into a field of the
/// returned struct that no output stores or that a later insert sets again, whose own result only
/// the return's chain reads (an observed insert observes its value). The ledger bytes the list
/// holds are charged to `m`, for the caller to release.
fn unread_inserts(
body: &Body,
params: &[TypeId],
o: &Observation,
m: &mut Meter,
) -> Result<Vec<(InstId, TypeId)>, Error> {
let mut out = Vec::new();
for (id, inst) in body.insts.iter() {
m.tick(1)?;
let InstKind::InsertValue { val, .. } = &inst.kind else {
continue;
};
let ty = match *val {
Value::Inst(j) if !o.observed.get(j.index()).copied().unwrap_or(true) => {
body.insts.get(j).map(|x| x.ty)
}
Value::Arg(a) if o.reads.get(a.index()).copied().flatten() != Some(Read::Observed) => {
params.get(a.index()).copied()
}
_ => None,
};
if let Some(ty) = ty {
out.push((id, ty));
}
}
m.charge(out.len() * std::mem::size_of::<(InstId, TypeId)>())?;
Ok(out)
}
/// How the body reads a parameter.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Read {
@@ -918,6 +918,8 @@ mod unique_identifier;
mod unit_axes;
#[cfg(all(any(m2v_gpu, m2v_cpu_icd), target_os = "linux"))]
mod unmap_order;
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod unread_attribute;
mod unshared_hold;
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod unsubmitted;
@@ -0,0 +1,175 @@
//! A render state over a vertex function whose attribute reaches only a varying a function constant
//! gates off is made from a vertex descriptor without that attribute, and draws Metal's pixels.
//!
//! The functions are the owned fixture
//! `validation/fixtures/public/engine/fca_vertex_unread_attribute.ll`'s
//! `fca_vertex_unread_attribute` (the position from attribute 0, the constant `shade` varying, and
//! attribute 1 into the `color` varying constant 0 gates) and `fca_fragment_unread_attribute`
//! (`color` where the constant holds, else `shade`), over a 4x4 `RGBA8Unorm` target that one
//! triangle covers. Metal's answer, on an Apple M3 Max (macOS 27.0.1, validation layer off and on):
//! with the constant false a descriptor of attribute 0 alone makes the state and the target reads
//! `shade`, `(64, 128, 191, 255)`; with it true that descriptor is refused, and one of both
//! attributes draws `color`, attribute 1's `(1, 0, 0, 1)` scaled by 0.5 and biased by 0.25:
//! `(191, 64, 64, 191)`.
//!
//! A device test: compiled only under the GPU safety cfgs (`m2v_gpu`, `m2v_cpu_icd`), on the kind
//! of device the cfg selects (`llvm-as`).
use super::blit_holds::{Scratch, WAIT};
use super::encoder_holds::{library, pass, words_of};
use crate::{
BlitOption, CommandBufferStatus, Device, DeviceKind, DeviceOptions, Error, Library, Origin,
PipelineOptions, RenderPipelineState, ResourceOptions, ShaderCacheOptions, Size,
TextureDescriptor,
};
use metal2vulkan::error::{DescriptorError, Error as CompileError};
use metal2vulkan::library::{FunctionConstantValue, FunctionConstantValues};
use metal2vulkan::metal::{DataType, PixelFormat, PrimitiveType, TextureUsage, VertexFormat};
use metal2vulkan::pipeline::{
ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource, VertexAttributeDescriptor,
VertexBufferLayoutDescriptor, VertexDescriptor,
};
/// The side of the target.
const SIDE: u64 = 4;
/// Three vertices of `{ position, color }` that cover the target, `color` `(1, 0, 0, 1)`.
const VERTICES: [[f32; 8]; 3] = [
[-1.0, -1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0],
[3.0, -1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0],
[-1.0, 3.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0],
];
/// A device of the kind the cfg selects, with an empty shader cache of its own.
fn device(cache: &std::path::Path) -> Device {
let options = DeviceOptions {
kinds: match cfg!(m2v_cpu_icd) {
true => vec![DeviceKind::Cpu],
false => vec![
DeviceKind::Discrete,
DeviceKind::Integrated,
DeviceKind::Virtual,
],
},
shader_cache: ShaderCacheOptions {
directory: Some(cache.to_owned()),
..ShaderCacheOptions::default()
},
..DeviceOptions::default()
};
Device::system_default_with(&options).unwrap()
}
/// A state of the fixture's functions with constant 0 `has_color`, drawing into `RGBA8Unorm`, its
/// vertex descriptor attributes `0..attributes` (`Float4` each, 16 bytes apart in buffer 0's
/// 32-byte records).
fn state(
device: &Device,
library: &Library,
has_color: bool,
attributes: u32,
) -> Result<RenderPipelineState, Error> {
let constants = FunctionConstantValues::defaults().with_index(
0,
FunctionConstantValue::new(DataType::Bool, [u8::from(has_color)]),
);
let function = |name| {
let function = library
.new_function_with_name_constant_values(name, &constants)
.unwrap();
StageSource::Function(function.function_descriptor())
};
let mut descriptor = RenderPipelineDescriptor::new(function("fca_vertex_unread_attribute"));
descriptor.fragment = Some(function("fca_fragment_unread_attribute"));
descriptor.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm));
let mut vertex = VertexDescriptor::new();
for a in 0..attributes {
vertex.attributes.insert(
a,
VertexAttributeDescriptor::new(VertexFormat::Float4, 16 * a, 0),
);
}
vertex
.layouts
.insert(0, VertexBufferLayoutDescriptor::new(Some(32)));
descriptor.vertex_descriptor = Some(vertex);
device.new_render_pipeline_state(&descriptor, &PipelineOptions::default())
}
/// The bytes of texel (1, 1) of the target one triangle of `state` covers, committed and waited
/// for.
fn draw(device: &Device, state: &RenderPipelineState) -> [u8; 4] {
let mut descriptor = TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, SIDE, SIDE, false);
descriptor.usage = TextureUsage::RENDER_TARGET;
descriptor.resource_options = ResourceOptions::private();
let target = device.new_texture(&descriptor).unwrap();
let back = device
.new_buffer(SIDE * SIDE * 4, ResourceOptions::shared())
.unwrap();
let bytes: Vec<u8> = VERTICES
.iter()
.flatten()
.flat_map(|f| f.to_le_bytes())
.collect();
let queue = device.new_command_queue().unwrap();
let command_buffer = queue.command_buffer().unwrap();
let mut encoder = command_buffer
.render_command_encoder(&pass(&target))
.unwrap();
encoder.set_render_pipeline_state(state).unwrap();
encoder.set_vertex_bytes(&bytes, 0).unwrap();
encoder
.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0)
.unwrap();
encoder.end_encoding().unwrap();
let mut blit = command_buffer.blit_command_encoder().unwrap();
blit.copy_from_texture_to_buffer(
&target,
0,
0,
Origin::new(0, 0, 0),
Size::new(SIDE, SIDE, 1),
&back,
0,
SIDE * 4,
SIDE * SIDE * 4,
BlitOption::None,
)
.unwrap();
blit.end_encoding().unwrap();
command_buffer.commit().unwrap();
command_buffer.wait_until_completed_for(WAIT).unwrap();
assert_eq!(command_buffer.status(), CommandBufferStatus::Completed);
words_of(&back)[(SIDE + 1) as usize].to_le_bytes()
}
/// Gated off, the state is made without attribute 1 and draws `shade`; gated on, it is refused
/// without attribute 1, and with it draws `color` (the module docs).
#[test]
fn a_state_without_an_attribute_only_a_gated_off_varying_reads_draws_metal_s_pixels() {
let scratch = Scratch::new("unread-attribute");
let device = device(&scratch.0);
let library = library(&device, "engine/fca_vertex_unread_attribute.ll");
let off = state(&device, &library, false, 1)
.unwrap_or_else(|e| panic!("gated off, attribute 0 alone: {e}"));
let shade = draw(&device, &off);
eprintln!(
"UNREAD-ATTRIBUTE: {} gated off draws {shade:?}",
device.name()
);
assert_eq!(shade, [64, 128, 191, 255], "gated off: Metal's shade");
match state(&device, &library, true, 1) {
Err(Error::Compile(CompileError::InvalidDescriptor(
DescriptorError::VertexAttribute { attribute: 1 },
))) => {}
other => panic!("gated on, attribute 0 alone: {:?}", other.map(|_| ())),
}
let on = state(&device, &library, true, 2)
.unwrap_or_else(|e| panic!("gated on, both attributes: {e}"));
let color = draw(&device, &on);
eprintln!(
"UNREAD-ATTRIBUTE: {} gated on draws {color:?}",
device.name()
);
assert_eq!(color, [191, 64, 64, 191], "gated on: Metal's color");
}
@@ -139,6 +139,7 @@ depth buffer 2 holds, bounded by its stack); an authored case that executes a lo
| `vv1_sixteen_byte_units` | `vv1_sixteen_byte_units` | `uint4` loads and stores aligned to 16 at bytes 32 and up of their buffers (a nonzero residual where the offset alignment is 16) and a 64-byte `align 16` copy of a `constant` struct to a `device` buffer, each moved as `uvec4`s | `out[2] = (src[2] & w.mask) + w.bias`, `out[3] = src[3] ^ w.bias`, `out[4 + i] = rows.r[i]` |
| `fca_kernel_absent_builtin` | `fca_kernel_absent_builtin` | a kernel builtin (`threads_per_threadgroup`) gated by `function_constant(0)` and read without a guard | `has_width = false`: every `out[tid] = 0` (the read is zero; CPU interpreter, `crates/metal2vulkan/tests/engine_absent_value_arguments.rs`); Metal leaves the output's sentinel there, so this specialization carries no authored case; `true`: `out[tid]` is the threadgroup width |
| `fca_vertex_absent_attribute` | `fca_vertex_absent_attribute` | a vertex attribute gated by `function_constant(0)` and read without a guard into the `tint` varying | `has_tint = false`: attribute 1 is not declared and `tint` is zero; `true`: `tint` is attribute 1 |
| `fca_vertex_unread_attribute` | `fca_vertex_unread_attribute`, `fca_fragment_unread_attribute` | an ungated vertex attribute (1) whose value reaches only the `color` varying `function_constant(0)` gates, and a fragment that returns `color` where the constant holds, else the constant `shade` | `has_color = false`: the specialized vertex function reads attribute 1 nowhere, so a vertex descriptor without it makes the pipeline (Metal reports it inactive) and the target is `shade`; `true`: attribute 1 is read and a descriptor without it is refused |
| `fca_fragment_absent_inputs` | `fca_fragment_absent_inputs` | a varying, a color input, `[[primitive_id]]`, and `[[barycentric_coord]]`, each gated by its own constant (0 to 3) and read without a guard into one lane of color 0 | every constant false: none of the four is declared (no fetch, no `PrimitiveId` or `BaryCoordKHR`) and color 0 is `(0, 0, 0, 0)`; a constant true declares its input |
| `ob1_storage_buffer` | `ob1_storage_buffer` | loads and stores past `device` buffers (the storage buffer containment form) | `out[t] = src[idx[t]]`, `out[idx[8 + t]] = 0xA0000000 \| t`; the reads past `src` are its case's out-of-bounds reads |
| `ob1_uniform_buffer` | `ob1_uniform_buffer` | loads past a 16-byte `constant` struct (the uniform buffer form) | `out[t]` = word `idx[t]` of `blk`; the reads past it are out-of-bounds reads |
@@ -90,6 +90,7 @@ fixture fbl_fetch_dual: metal: Apple metal version 32023.921 (metalfe-32023.921.
fixture fca_fragment_absent_inputs: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture fca_kernel_absent_builtin: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture fca_vertex_absent_attribute: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture fca_vertex_unread_attribute: metal: Apple metal version 32023.922 (metalfe-32023.922.4); macosx-sdk: 27.2 (26B118)
fixture fmx2_divide_edges: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture fmx2_divide_fast: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture fmx2_divide_half_fast: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
@@ -0,0 +1,94 @@
; Generated by scripts/regen-air-fixtures from fca_vertex_unread_attribute.metal (typed pointers; xcrun metal-as reassembles it). Do not edit.
; ModuleID = '-'
source_filename = "-"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
target triple = "air64_v28-apple-macosx26.0.0"
@_ZL9has_color = internal unnamed_addr addrspace(2) global i8 undef, align 1
@_Z9has_color.MTL_FC_INIT_0_b = linkonce_odr hidden local_unnamed_addr addrspace(2) externally_initialized constant i8 undef, section "air.fc_initializer", align 1
@__metal_implicit_fc_pred_0 = internal addrspace(2) global i8 0, align 1
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I__, i8* null }]
@llvm.compiler.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(2)* @__metal_implicit_fc_pred_0 to i8*)], section "llvm.metadata"
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
define <{ <4 x float>, <4 x float>, <4 x float> }> @fca_vertex_unread_attribute(<4 x float> %0, <4 x float> %1) local_unnamed_addr #0 {
%3 = fmul fast <4 x float> %1, <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>
%4 = fadd fast <4 x float> %3, <float 2.500000e-01, float 2.500000e-01, float 2.500000e-01, float 2.500000e-01>
%5 = insertvalue <{ <4 x float>, <4 x float>, <4 x float> }> undef, <4 x float> %0, 0
%6 = insertvalue <{ <4 x float>, <4 x float>, <4 x float> }> %5, <4 x float> <float 2.500000e-01, float 5.000000e-01, float 7.500000e-01, float 1.000000e+00>, 1
%7 = insertvalue <{ <4 x float>, <4 x float>, <4 x float> }> %6, <4 x float> %4, 2
ret <{ <4 x float>, <4 x float>, <4 x float> }> %7
}
; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
declare i8 @air.normalize_function_constant_predicate.i8(i8) local_unnamed_addr #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind readonly willreturn
define <4 x float> @fca_fragment_unread_attribute(<4 x float> %0, <4 x float> %1, <4 x float> %2) local_unnamed_addr #2 {
%4 = load i8, i8 addrspace(2)* @_ZL9has_color, align 1, !tbaa !32, !range !36
%5 = icmp eq i8 %4, 0
%6 = select fast i1 %5, <4 x float> %1, <4 x float> %2
ret <4 x float> %6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn
define internal void @_GLOBAL__sub_I__() #3 section "air.static_init" {
%1 = load i8, i8 addrspace(2)* @_Z9has_color.MTL_FC_INIT_0_b, align 1, !tbaa !32, !range !36
store i8 %1, i8 addrspace(2)* @_ZL9has_color, align 1, !tbaa !32
%2 = tail call i8 @air.normalize_function_constant_predicate.i8(i8 %1) #4
store i8 %2, i8 addrspace(2)* @__metal_implicit_fc_pred_0, align 1
ret void
}
attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
attributes #1 = { mustprogress nofree nosync nounwind readnone willreturn }
attributes #2 = { mustprogress nofree norecurse nosync nounwind readonly willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
attributes #4 = { nounwind readnone willreturn }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
!air.vertex = !{!9}
!air.fragment = !{!18}
!air.compile_options = !{!25, !26, !27}
!air.function_constants = !{!28}
!llvm.ident = !{!29}
!air.version = !{!30}
!air.language_version = !{!31}
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 2]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 7, !"frame-pointer", i32 2}
!3 = !{i32 7, !"air.max_device_buffers", i32 31}
!4 = !{i32 7, !"air.max_constant_buffers", i32 31}
!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31}
!6 = !{i32 7, !"air.max_textures", i32 128}
!7 = !{i32 7, !"air.max_read_write_textures", i32 8}
!8 = !{i32 7, !"air.max_samplers", i32 16}
!9 = !{<{ <4 x float>, <4 x float>, <4 x float> }> (<4 x float>, <4 x float>)* @fca_vertex_unread_attribute, !10, !15}
!10 = !{!11, !12, !13}
!11 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"}
!12 = !{!"air.vertex_output", !"generated(5shadeDv4_f)", !"air.arg_type_name", !"float4", !"air.arg_name", !"shade"}
!13 = !{!"air.function_constant", !14, !"air.vertex_output", !"generated(5colorDv4_f)", !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
!14 = !{i8 addrspace(2)* @__metal_implicit_fc_pred_0, !"bool", !"has_color"}
!15 = !{!16, !17}
!16 = !{i32 0, !"air.vertex_input", !"air.location_index", i32 0, i32 1, !"air.arg_type_name", !"float4", !"air.arg_name", !"position"}
!17 = !{i32 1, !"air.vertex_input", !"air.location_index", i32 1, i32 1, !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
!18 = !{<4 x float> (<4 x float>, <4 x float>, <4 x float>)* @fca_fragment_unread_attribute, !19, !21}
!19 = !{!20}
!20 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4"}
!21 = !{!22, !23, !24}
!22 = !{i32 0, !"air.position", !"air.center", !"air.no_perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"position", !"air.arg_unused"}
!23 = !{i32 1, !"air.fragment_input", !"generated(5shadeDv4_f)", !"air.center", !"air.perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"shade"}
!24 = !{i32 2, !"air.function_constant", !14, !"air.fragment_input", !"generated(5colorDv4_f)", !"air.center", !"air.perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
!25 = !{!"air.compile.denorms_disable"}
!26 = !{!"air.compile.fast_math_enable"}
!27 = !{!"air.compile.framebuffer_fetch_enable"}
!28 = !{i8 addrspace(2)* @_Z9has_color.MTL_FC_INIT_0_b, !"bool", !"has_color", i32 0}
!29 = !{!"Apple metal version 32023.922 (metalfe-32023.922.4)"}
!30 = !{i32 2, i32 8, i32 0}
!31 = !{!"Metal", i32 4, i32 0, i32 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"bool", !34, i64 0}
!34 = !{!"omnipotent char", !35, i64 0}
!35 = !{!"Simple C++ TBAA"}
!36 = !{i8 0, i8 2}
@@ -0,0 +1,94 @@
; Generated by scripts/regen-air-fixtures from fca_vertex_unread_attribute.metal (llvm-dis of fca_vertex_unread_attribute.air). Do not edit.
; ModuleID = '<stdin>'
source_filename = "-"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
target triple = "air64_v28-apple-macosx26.0.0"
@_ZL9has_color = internal unnamed_addr addrspace(2) global i8 undef, align 1
@_Z9has_color.MTL_FC_INIT_0_b = linkonce_odr hidden local_unnamed_addr addrspace(2) externally_initialized constant i8 undef, section "air.fc_initializer", align 1
@__metal_implicit_fc_pred_0 = internal addrspace(2) global i8 0, align 1
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I__, ptr null }]
@llvm.compiler.used = appending global [1 x ptr] [ptr addrspacecast (ptr addrspace(2) @__metal_implicit_fc_pred_0 to ptr)], section "llvm.metadata"
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
define <{ <4 x float>, <4 x float>, <4 x float> }> @fca_vertex_unread_attribute(<4 x float> %0, <4 x float> %1) local_unnamed_addr #0 {
%3 = fmul fast <4 x float> %1, splat (float 5.000000e-01)
%4 = fadd fast <4 x float> %3, splat (float 2.500000e-01)
%5 = insertvalue <{ <4 x float>, <4 x float>, <4 x float> }> undef, <4 x float> %0, 0
%6 = insertvalue <{ <4 x float>, <4 x float>, <4 x float> }> %5, <4 x float> <float 2.500000e-01, float 5.000000e-01, float 7.500000e-01, float 1.000000e+00>, 1
%7 = insertvalue <{ <4 x float>, <4 x float>, <4 x float> }> %6, <4 x float> %4, 2
ret <{ <4 x float>, <4 x float>, <4 x float> }> %7
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare i8 @air.normalize_function_constant_predicate.i8(i8) local_unnamed_addr #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
define <4 x float> @fca_fragment_unread_attribute(<4 x float> %0, <4 x float> %1, <4 x float> %2) local_unnamed_addr #2 {
%4 = load i8, ptr addrspace(2) @_ZL9has_color, align 1, !tbaa !32, !range !36
%5 = icmp eq i8 %4, 0
%6 = select fast i1 %5, <4 x float> %1, <4 x float> %2
ret <4 x float> %6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn
define internal void @_GLOBAL__sub_I__() #3 section "air.static_init" {
%1 = load i8, ptr addrspace(2) @_Z9has_color.MTL_FC_INIT_0_b, align 1, !tbaa !32, !range !36
store i8 %1, ptr addrspace(2) @_ZL9has_color, align 1, !tbaa !32
%2 = tail call i8 @air.normalize_function_constant_predicate.i8(i8 %1) #4
store i8 %2, ptr addrspace(2) @__metal_implicit_fc_pred_0, align 1
ret void
}
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
attributes #4 = { nounwind willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
!air.vertex = !{!9}
!air.fragment = !{!18}
!air.compile_options = !{!25, !26, !27}
!air.function_constants = !{!28}
!llvm.ident = !{!29}
!air.version = !{!30}
!air.language_version = !{!31}
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 2]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 7, !"frame-pointer", i32 2}
!3 = !{i32 7, !"air.max_device_buffers", i32 31}
!4 = !{i32 7, !"air.max_constant_buffers", i32 31}
!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31}
!6 = !{i32 7, !"air.max_textures", i32 128}
!7 = !{i32 7, !"air.max_read_write_textures", i32 8}
!8 = !{i32 7, !"air.max_samplers", i32 16}
!9 = !{ptr @fca_vertex_unread_attribute, !10, !15}
!10 = !{!11, !12, !13}
!11 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"}
!12 = !{!"air.vertex_output", !"generated(5shadeDv4_f)", !"air.arg_type_name", !"float4", !"air.arg_name", !"shade"}
!13 = !{!"air.function_constant", !14, !"air.vertex_output", !"generated(5colorDv4_f)", !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
!14 = !{ptr addrspace(2) @__metal_implicit_fc_pred_0, !"bool", !"has_color"}
!15 = !{!16, !17}
!16 = !{i32 0, !"air.vertex_input", !"air.location_index", i32 0, i32 1, !"air.arg_type_name", !"float4", !"air.arg_name", !"position"}
!17 = !{i32 1, !"air.vertex_input", !"air.location_index", i32 1, i32 1, !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
!18 = !{ptr @fca_fragment_unread_attribute, !19, !21}
!19 = !{!20}
!20 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4"}
!21 = !{!22, !23, !24}
!22 = !{i32 0, !"air.position", !"air.center", !"air.no_perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"position", !"air.arg_unused"}
!23 = !{i32 1, !"air.fragment_input", !"generated(5shadeDv4_f)", !"air.center", !"air.perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"shade"}
!24 = !{i32 2, !"air.function_constant", !14, !"air.fragment_input", !"generated(5colorDv4_f)", !"air.center", !"air.perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
!25 = !{!"air.compile.denorms_disable"}
!26 = !{!"air.compile.fast_math_enable"}
!27 = !{!"air.compile.framebuffer_fetch_enable"}
!28 = !{ptr addrspace(2) @_Z9has_color.MTL_FC_INIT_0_b, !"bool", !"has_color", i32 0}
!29 = !{!"Apple metal version 32023.922 (metalfe-32023.922.4)"}
!30 = !{i32 2, i32 8, i32 0}
!31 = !{!"Metal", i32 4, i32 0, i32 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"bool", !34, i64 0}
!34 = !{!"omnipotent char", !35, i64 0}
!35 = !{!"Simple C++ TBAA"}
!36 = !{i8 0, i8 2}
@@ -0,0 +1,35 @@
// Owned fixture: an ungated vertex attribute whose value reaches only a varying a function
// constant gates. With `has_color` false (or undefined) the `color` varying is not declared
// (MSL 5.8.1.6), so nothing the specialized function outputs reads attribute 1: Metal reports the
// attribute inactive and makes the pipeline from a vertex descriptor without it. With `has_color`
// true the varying is declared, attribute 1 is read, and a descriptor without it is refused.
// - `fca_vertex_unread_attribute`: the position from attribute 0, the `shade` varying a constant,
// and `color` attribute 1 scaled and biased;
// - `fca_fragment_unread_attribute`: `color` where `has_color`, else `shade`. Loop-free.
#include <metal_stdlib>
using namespace metal;
constant bool has_color [[function_constant(0)]];
struct FcuAttributes {
float4 position [[attribute(0)]];
float4 color [[attribute(1)]];
};
struct FcuVaryings {
float4 position [[position]];
float4 shade;
float4 color [[function_constant(has_color)]];
};
vertex FcuVaryings fca_vertex_unread_attribute(FcuAttributes in [[stage_in]]) {
FcuVaryings out;
out.position = in.position;
out.shade = float4(0.25, 0.5, 0.75, 1.0);
out.color = in.color * 0.5 + 0.25;
return out;
}
fragment float4 fca_fragment_unread_attribute(FcuVaryings in [[stage_in]]) {
return has_color ? in.color : in.shade;
}
+1 -1
View File
@@ -61,7 +61,7 @@ mod tests;
/// unchanged version, and its bless records the version. Independent of the crate's version and of
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
/// history.
pub const SEMANTICS_VERSION: u32 = 2138;
pub const SEMANTICS_VERSION: u32 = 2139;
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
+2 -1
View File
@@ -8,7 +8,8 @@ use crate::air::ir::{Body, Idx, InstId, Value};
/// The parameters `body` uses: each argument an instruction names, a call's operand included. A
/// parameter of a specialized entry whose reads its constants fold away (deleted with what nothing
/// observes) is not among them. This is the lowering's reading of a used parameter: what it plans,
/// observes), or that reaches only an output they gate off (whose field is inserted `undef`), is
/// not among them. This is the lowering's reading of a used parameter: what it plans,
/// and what the compile decides an input's attachment state, ordering and refusals from.
pub(crate) fn params_used(body: &Body) -> BTreeSet<u32> {
let mut used = BTreeSet::new();
+2 -1
View File
@@ -2125,7 +2125,8 @@ fn params_used(spec: &air::Entry) -> BTreeSet<u32> {
/// The Metal attribute indices the specialized vertex entry `spec` reads: its `[[attribute(n)]]`
/// parameters that survived function-constant specialization and that an instruction uses (the
/// parameters `lower::stage_io` plans), each with the numeric class it is declared with. Empty for
/// any other stage.
/// any other stage. An attribute whose value reaches only an output the constants gate off is not
/// among them, as Metal reports it inactive: specialization inserts `undef` in that output's field.
pub(crate) fn declared_attributes(
spec: &air::Entry,
) -> std::collections::BTreeMap<u32, crate::pipeline::stage_io::IoNumeric> {
@@ -0,0 +1,122 @@
//! A vertex attribute whose value reaches only a varying a function constant gates off is not read
//! by the specialized vertex function: render pipelines of the owned fixture
//! `engine/fca_vertex_unread_attribute` (`fca_vertex_unread_attribute`, whose `color` varying
//! constant 0 gates and which reads attribute 1 only into it, and `fca_fragment_unread_attribute`)
//! on committed profiles.
//!
//! Metal's answer, on an Apple M3 Max (macOS 27.0.1, validation layer off and on): with the
//! constant false the specialized function's attribute 1 is inactive and a vertex descriptor of
//! attribute 0 alone makes the pipeline; with it true attribute 1 is active, that descriptor is
//! refused ("Vertex attribute color(1) is missing from the vertex descriptor"), and one of both
//! attributes makes the pipeline. The translation reads the same: the gated-off varying's field of
//! the returned struct is inserted `undef` (`air::canon`'s `unobserved_code`), so the attribute's
//! read goes and the pipeline's vertex input names attribute 0 alone; gated on, the descriptor
//! without attribute 1 is `InvalidDescriptor(VertexAttribute { attribute: 1 })`.
//!
//! `llvm-as` assembles the fixture; without it the test skips visibly. No GPU is used.
use crate::budget::Budget;
use crate::device::{Device, DevicePolicy};
use crate::error::{DescriptorError, Error};
use crate::library::{FunctionConstantValue, FunctionConstantValues, Library};
use crate::metal::{DataType, PixelFormat, VertexFormat};
use crate::pipeline::artifact::RenderPipeline;
use crate::pipeline::descriptor::{
ColorAttachmentDescriptor, RenderPipelineDescriptor, VertexAttributeDescriptor,
VertexBufferLayoutDescriptor, VertexDescriptor,
};
use crate::pipeline::testing::{description, engine_dir, llvm_assemble, AssembleError};
use crate::pipeline::{FunctionDescriptor, StageSource};
use crate::spirv::testing::check_words_valid;
fn fixture() -> Option<Vec<u8>> {
let path = engine_dir().join("fca_vertex_unread_attribute.ll");
match llvm_assemble(&path) {
Ok(b) => Some(b),
Err(AssembleError::Missing(why)) => {
eprintln!("SKIPPED: {why}");
None
}
Err(AssembleError::Rejected(why)) => panic!("llvm-as rejected {}: {why}", path.display()),
}
}
/// The fixture's pipeline on `dev` with constant 0 `has_color` and a vertex descriptor of
/// attributes `0..attributes` (`Float4` each, 16 bytes apart in buffer 0's 32-byte records).
fn compile(
dev: &Device,
library: &Library,
has_color: bool,
attributes: u32,
) -> Result<RenderPipeline, Error> {
let constants = FunctionConstantValues::defaults().with_index(
0,
FunctionConstantValue::new(DataType::Bool, [u8::from(has_color)]),
);
let function = |name| {
let mut f = FunctionDescriptor::new(library.function(name).expect("entry"));
f.constants = constants.clone();
StageSource::Function(f)
};
let mut d = RenderPipelineDescriptor::new(function("fca_vertex_unread_attribute"));
d.fragment = Some(function("fca_fragment_unread_attribute"));
d.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm));
let mut vertex = VertexDescriptor::new();
for a in 0..attributes {
vertex.attributes.insert(
a,
VertexAttributeDescriptor::new(VertexFormat::Float4, 16 * a, 0),
);
}
vertex
.layouts
.insert(0, VertexBufferLayoutDescriptor::new(Some(32)));
d.vertex_descriptor = Some(vertex);
dev.compile_render_pipeline(&d, &Budget::standard())
}
/// The attributes `p`'s vertex input fetches, in fixed function or pulled, and every stage's
/// module through L3.
fn fetched(p: &RenderPipeline, dev: &Device, what: &str) -> usize {
for stage in &p.stages {
check_words_valid(&stage.spirv, &p.requirements, dev.profile())
.unwrap_or_else(|e| panic!("{what}, {:?}: L3: {e}", stage.stage));
}
p.vertex_input.attributes.len() + p.vertex_input.pulled.len()
}
/// Gated off, the varying's attribute needs no descriptor entry and the vertex input fetches
/// attribute 0 alone; gated on, a descriptor without it is refused as Metal refuses it, and one
/// with it fetches both (the module docs).
#[test]
fn an_attribute_read_only_into_a_gated_off_varying_needs_no_descriptor_entry() {
let Some(bc) = fixture() else { return };
let library = Library::from_air(&bc).expect("library");
for stem in [
"moltenvk-m3",
"lavapipe",
"amd-780m-radv",
"intel-irisxe-anv",
"nvidia-rtx5080-laptop",
"vk12-floor",
] {
let dev = Device::new(
description(stem).expect("committed description"),
DevicePolicy::default(),
)
.expect("device");
let off = compile(&dev, &library, false, 1)
.unwrap_or_else(|e| panic!("{stem}: gated off, attribute 0 alone: {e}"));
assert_eq!(fetched(&off, &dev, stem), 1, "{stem}: gated off");
match compile(&dev, &library, true, 1) {
Err(Error::InvalidDescriptor(DescriptorError::VertexAttribute { attribute: 1 })) => {}
other => panic!(
"{stem}: gated on, attribute 0 alone: {:?}",
other.map(|_| ())
),
}
let on = compile(&dev, &library, true, 2)
.unwrap_or_else(|e| panic!("{stem}: gated on, both attributes: {e}"));
assert_eq!(fetched(&on, &dev, stem), 2, "{stem}: gated on");
}
}
+1
View File
@@ -196,6 +196,7 @@ mod engine_typed_clamp;
mod engine_typed_threadgroup;
mod engine_uniform_varyings;
mod engine_unmeasured_speculation;
mod engine_unread_attribute;
mod engine_unspecialized;
mod engine_vertex_fetch;
mod engine_vertex_variants;