rt: loads of memory nothing writes go through NonWritable device-address places

Under the identity domains, a slot the module never writes (an unaliased
device buffer no store or atomic reaches) and every constant-address-space
slot are loaded through a PhysicalStorageBuffer block whose member is
NonWritable. Default-domain output is unchanged.
This commit is contained in:
Anees Iqbal committed 2026-11-17 11:31:24 -08:00
1 parent 52ba11dad4
commit 45da84cc5a
11 files changed
+273 -30

No files matched your search

+2 -1
View File
@@ -284,8 +284,9 @@ pub(super) fn prepare(
psb::prepare(fb, table, t.root, m, start, n, contained)?
};
let units = cx.plan.families.access.psb_units;
let read_only = cx.plan.families.access.unwritten.contains(&t.slot);
return Ok(Prepared {
mem: Mem::Psb(a.mem.with(ops).with_units(units)),
mem: Mem::Psb(a.mem.with(ops).with_units(units).read_only(read_only)),
off: a.off,
inb: a.inb,
guard_store: false,
+24 -15
View File
@@ -755,9 +755,11 @@ pub struct AccessPlan {
/// while the dispatch or draw runs, and an atomic needs a storage view's word pointer, so the
/// per-stage storage-buffer fallback never views them as uniform buffers.
pub ordered: BTreeSet<usize>,
/// Memory-plan slots read through a storage view whose memory nothing in the module writes
/// ([`unwritten_slots`]): their views are decorated `NonWritable`, so the device may read them
/// as read-only memory (on RADV a uniform read is a scalar load).
/// Memory-plan slots whose memory nothing in the module writes ([`unwritten_slots`]), read
/// through a storage view or, under the identity domains, their device address: their views
/// are decorated `NonWritable`, and their device-address loads go through `NonWritable` places
/// (`psb::PsbMem::read_only`), so the device may read them as read-only memory (on RADV a
/// uniform read is a scalar load).
pub unwritten: BTreeSet<usize>,
/// The units ([`Units`]) the static-root accesses of each slot read or write whole, by
/// memory-plan slot index: narrow units whose storage access the profile has, and `uvec2`
@@ -1670,12 +1672,14 @@ fn place_slots(cx: &mut SelectCx<'_>, m: &mut Meter) -> Result<Vec<Option<SlotCh
const BUFFER_NO_ALIAS: &[u8] = b"air-buffer-no-alias";
/// The memory-plan slots whose memory nothing in the module writes, among those read through a
/// storage view (`lowering`): a plain buffer argument the AIR declares unaliased
/// ([`BUFFER_NO_ALIAS`]) that no store or atomic of the function reaches, through the slot or
/// through a pointer its address may come back as (`SlotPlan::wide`), and that no volatile or
/// coherent access reads (what it reads may change while the dispatch runs). Being unaliased, its
/// memory is no other argument's, so no write of the module lands on it. A buffer-table element
/// and a pulled fetch's source are left out.
/// storage view (`lowering`) or, under the identity domains, through their device address: a
/// plain buffer argument the AIR declares unaliased ([`BUFFER_NO_ALIAS`]) that no store or atomic
/// of the function reaches, through the slot or through a pointer its address may come back as
/// (`SlotPlan::wide`), and that no volatile or coherent access reads (what it reads may change
/// while the dispatch runs). Being unaliased, its memory is no other argument's, so no write of
/// the module lands on it. A device-address `constant` argument is one too, aliased or not: Metal's
/// `constant` address space is read-only, so no write of a Metal program lands on it while it
/// runs. A buffer-table element and a pulled fetch's source are left out.
fn unwritten_slots(
cx: &SelectCx<'_>,
lowering: &[Option<SlotLowering>],
@@ -1693,21 +1697,26 @@ fn unwritten_slots(
.any(|&(key, _)| module.symbols().get(key) == Some(BUFFER_NO_ALIAS))
})
};
let storage = Some(SlotLowering::View(ViewKind::Storage));
let identity = identity(cx.profile);
cx.memory
.slots
.iter()
.zip(lowering)
.enumerate()
.filter(|&(i, (plan, l))| {
*l == storage
let unwritten = !plan.access.write && !plan.wide.write && unaliased(plan.param);
let read_only = match l {
Some(SlotLowering::View(ViewKind::Storage)) => unwritten,
Some(SlotLowering::Psb { .. }) if identity => {
unwritten || plan.space == AddrSpace::Constant
}
_ => false,
};
read_only
&& plan.element.is_none()
&& !sources.contains(&plan.slot)
&& !plan.access.write
&& !plan.wide.write
&& !plan.atomic
&& !cx.families.access.ordered.contains(&i)
&& unaliased(plan.param)
})
.map(|(i, _)| i)
.collect()
@@ -1969,7 +1978,7 @@ pub fn declare(
(Some(c), Some(SlotLowering::View(kind))) => Some(views::declare(mb, c.slot, kind)?),
_ => None,
};
if let (Some(c), true) = (s, plan.families.access.unwritten.contains(&i)) {
if let (Some(c), Some(_), true) = (s, view, plan.families.access.unwritten.contains(&i)) {
mb.unwritten_buffer(views::binding_symbol(c.slot));
}
d.views.push(view);
+38 -11
View File
@@ -205,12 +205,14 @@ pub fn narrow_units(p: &DeviceProfile) -> Units {
/// Words at a 4-aligned device address (a `u64`), loaded and stored with memory operands (a
/// coherence and `Volatile`), and the narrow units ([`narrow_units`]) it also loads and stores
/// directly.
/// directly. Memory nothing writes while the module runs is loaded through `NonWritable` places
/// ([`PsbMem::read_only`]).
#[derive(Clone, Copy, Debug)]
pub struct PsbMem {
base: Value,
ops: WordOps,
units: Units,
read_only: bool,
}
impl PsbMem {
@@ -221,9 +223,17 @@ impl PsbMem {
base,
ops: WordOps::default(),
units: Units::NONE,
read_only: false,
}
}
/// The same words, loaded through `NonWritable` places where `read_only`: memory nothing
/// writes while the module runs (`AccessPlan`'s unwritten slots), so the device may read it as
/// read-only memory.
pub fn read_only(self, read_only: bool) -> PsbMem {
PsbMem { read_only, ..self }
}
/// The same words, loaded and stored with `ops`.
pub fn with(self, ops: WordOps) -> PsbMem {
PsbMem { ops, ..self }
@@ -243,12 +253,13 @@ impl PsbMem {
}
/// A `PhysicalStorageBuffer` place of the `bytes`-byte unit `index` (a `u32` index of such
/// units) of the memory, and the unit's type.
/// units) of the memory, to load from where `load`, and the unit's type.
fn unit_ptr(
&self,
fb: &mut FunctionBuilder<'_>,
bytes: u32,
index: Value,
load: bool,
) -> BResult<(Value, TypeId)> {
let u64_ = u64_ty(fb)?;
let i = fb.convert(ConvOp::UConvert, index, u64_)?;
@@ -264,16 +275,18 @@ impl PsbMem {
width: if bytes == 1 { 8 } else { 16 },
signed: false,
})?;
Ok((fb.device_place(addr, ty)?, ty))
Ok((self.place(fb, addr, ty, load)?, ty))
}
/// A `PhysicalStorageBuffer` place of word `word` (a `u32` index) of the memory.
pub fn word_ptr(&self, fb: &mut FunctionBuilder<'_>, word: Value) -> BResult<Value> {
/// A `PhysicalStorageBuffer` place of word `word` (a `u32` index) of the memory, to load from
/// where `load`.
fn word_ptr(&self, fb: &mut FunctionBuilder<'_>, word: Value, load: bool) -> BResult<Value> {
let u32_ = fb.module().ty(Type::Int {
width: 32,
signed: false,
})?;
self.typed_ptr(fb, word, u32_)
let addr = self.word_address(fb, word)?;
self.place(fb, addr, u32_, load)
}
/// A `PhysicalStorageBuffer` place of a `pointee` at word `word` (a `u32` index) of the
@@ -289,6 +302,20 @@ impl PsbMem {
fb.device_place(addr, pointee)
}
/// The place of a `pointee` at `addr`: `NonWritable` for a load of read-only memory.
fn place(
&self,
fb: &mut FunctionBuilder<'_>,
addr: Value,
pointee: TypeId,
load: bool,
) -> BResult<Value> {
match load && self.read_only {
true => fb.device_place_read_only(addr, pointee),
false => fb.device_place(addr, pointee),
}
}
/// The device address (a `u64`) of word `word` (a `u32` index) of the memory.
pub fn word_address(&self, fb: &mut FunctionBuilder<'_>, word: Value) -> BResult<Value> {
let u64_ = u64_ty(fb)?;
@@ -310,13 +337,13 @@ const WORD: MemAccess = MemAccess {
impl WordMem for PsbMem {
fn read(&mut self, fb: &mut FunctionBuilder<'_>, word: Value) -> BResult<Value> {
let p = self.word_ptr(fb, word)?;
let p = self.word_ptr(fb, word, true)?;
let access = self.ops.access(fb, WORD, false)?;
fb.load(p, access)
}
fn write(&mut self, fb: &mut FunctionBuilder<'_>, word: Value, value: Value) -> BResult<()> {
let p = self.word_ptr(fb, word)?;
let p = self.word_ptr(fb, word, false)?;
let access = self.ops.access(fb, WORD, true)?;
fb.store(p, value, access)
}
@@ -328,7 +355,7 @@ impl WordMem for PsbMem {
mask: Value,
bits: Value,
) -> BResult<()> {
let p = self.word_ptr(fb, word)?;
let p = self.word_ptr(fb, word, false)?;
let keep = fb.unary(UnOp::Not, mask)?;
let clear = fb.binary(BinOp::BitwiseOr, keep, bits)?;
fb.atomic(AtomicOp::And, p, Scope::Device, Semantics::RELAXED, clear)?;
@@ -346,7 +373,7 @@ impl WordMem for PsbMem {
bytes: u32,
index: Value,
) -> BResult<Value> {
let (p, _) = self.unit_ptr(fb, bytes, index)?;
let (p, _) = self.unit_ptr(fb, bytes, index, true)?;
let access = self.ops.access(fb, unit_access(bytes), false)?;
let x = fb.load(p, access)?;
let u32_ = fb.module().ty(Type::Int {
@@ -367,7 +394,7 @@ impl WordMem for PsbMem {
index: Value,
value: Value,
) -> BResult<()> {
let (p, ty) = self.unit_ptr(fb, bytes, index)?;
let (p, ty) = self.unit_ptr(fb, bytes, index, false)?;
let x = fb.convert(ConvOp::UConvert, value, ty)?;
let access = self.ops.access(fb, unit_access(bytes), true)?;
fb.store(p, x, access)
@@ -105,6 +105,7 @@ pub fn declare(mb: &mut ModuleBuilder, placement: &PushPlacement) -> BResult<Opt
layout: Some(StructLayout {
rule: LayoutRule::Std140,
block: true,
non_writable: false,
members: layout.into(),
}),
})?;
@@ -803,6 +803,7 @@ impl ModuleBuilder {
layout: Some(StructLayout {
rule,
block: true,
non_writable: false,
members: offsets.clone(),
}),
};
@@ -6,7 +6,7 @@ use crate::spirv::builder::ops::{err, index};
use crate::spirv::error::{BResult, BuildError, ControlRule, OperandRule};
use crate::spirv::ids::{FuncId, TypeId, Value};
use crate::spirv::ir::{
natural_layout, ConvOp, Inst, LayoutRule, Shape, StorageClass, Type, ValueOrigin,
natural_layout, ConvOp, Inst, LayoutRule, Shape, StorageClass, StructLayout, Type, ValueOrigin,
};
impl FunctionBuilder<'_> {
@@ -124,13 +124,27 @@ impl FunctionBuilder<'_> {
/// from here. The block takes the pointee's own layout rule, at most std430, so it needs no
/// layout feature the pointee does not.
pub fn device_place(&mut self, addr: Value, pointee: TypeId) -> BResult<Value> {
self.place_at(addr, pointee, false)
}
/// [`device_place`](Self::device_place) for memory nothing writes while the module runs: its
/// block's member is `NonWritable`, so the device may read it as read-only memory (RADV reads a
/// uniform address of it with a scalar load). Only loads go through it.
pub fn device_place_read_only(&mut self, addr: Value, pointee: TypeId) -> BResult<Value> {
self.place_at(addr, pointee, true)
}
fn place_at(&mut self, addr: Value, pointee: TypeId, non_writable: bool) -> BResult<Value> {
let rule = self
.mb()
.types()
.facts(pointee)?
.max_rule()
.min(LayoutRule::Std430);
let layout = natural_layout(self.mb().types(), rule, true, &[pointee])?;
let layout = StructLayout {
non_writable,
..natural_layout(self.mb().types(), rule, true, &[pointee])?
};
let block = self.module().ty(Type::Struct {
members: [pointee].into(),
layout: Some(layout),
@@ -760,6 +760,7 @@ fn device_places_are_block_members_at_offset_zero() {
let layout = StructLayout {
rule,
block: true,
non_writable: false,
members: [MemberLayout {
offset: 0,
matrix_stride: None,
@@ -87,6 +87,7 @@ impl T {
layout: Some(StructLayout {
rule,
block: false,
non_writable: false,
members: offsets
.iter()
.map(|o| MemberLayout {
@@ -362,6 +363,7 @@ fn runtime_arrays_only_end_blocks_or_index_descriptors() {
members: [u, rta].into(),
layout: Some(StructLayout {
block: false,
non_writable: false,
..not_last
}),
}),
@@ -477,6 +479,7 @@ fn matrix_members_need_a_valid_matrix_stride() {
layout: Some(StructLayout {
rule,
block: false,
non_writable: false,
members: [MemberLayout {
offset: 0,
matrix_stride: ms,
@@ -507,6 +510,7 @@ fn matrix_members_need_a_valid_matrix_stride() {
layout: Some(StructLayout {
rule: LayoutRule::Std430,
block: false,
non_writable: false,
members: [MemberLayout {
offset: 0,
matrix_stride: Some(16),
@@ -1352,6 +1356,7 @@ fn operand_rules_are_enforced() {
layout: Some(StructLayout {
rule: LayoutRule::Std430,
block: true,
non_writable: false,
members: [MemberLayout {
offset: 0,
matrix_stride: None,
+6 -1
View File
@@ -109,11 +109,15 @@ pub struct MemberLayout {
pub matrix_stride: Option<u32>,
}
/// The explicit layout of a struct: its rule, member offsets, and whether it is a `Block`.
/// The explicit layout of a struct: its rule, member offsets, whether it is a `Block`, and whether
/// its members are `NonWritable`.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct StructLayout {
pub rule: LayoutRule,
pub block: bool,
/// Every member is decorated `NonWritable`: the block of a device-address place of memory
/// nothing writes while the module runs (`FunctionBuilder::device_place_read_only`).
pub non_writable: bool,
pub members: Box<[MemberLayout]>,
}
@@ -924,6 +928,7 @@ pub fn natural_layout(
Ok(StructLayout {
rule,
block,
non_writable: false,
members: out.into_boxed_slice(),
})
}
@@ -1794,6 +1794,9 @@ impl Ser<'_> {
Op::MemberDecorate,
&[id, i, Decoration::Offset as u32, ml.offset],
)?;
if l.non_writable {
w.inst(Op::MemberDecorate, &[id, i, Decoration::NonWritable as u32])?;
}
if let Some(ms) = ml.matrix_stride {
w.inst(Op::MemberDecorate, &[id, i, Decoration::ColMajor as u32])?;
w.inst(
@@ -25,6 +25,10 @@
//! - The same kernel with its textures in an argument buffer (`tex` with `ab`) reads their
//! resource IDs from the buffer's members, at its pushed address, and answers the same at the
//! same elements, with no handle table and no descriptor.
//! - A kernel's slots that nothing writes (`read_only`, generated: an unaliased `device` buffer it
//! only reads and a `constant` one) are loaded through `NonWritable` device-address places; a
//! written slot, and a `device` slot the AIR does not declare unaliased, are not. It passes L3
//! and computes its answer on the CPU interpreter.
//! - A kernel that samples a texture (`engine/a2_dynamic_texel_offset`) is still refused as
//! `Unsupported{IdentityDomains}`, not implemented, where the default domains compile it.
//! - A kernel's emulated-simdgroup variant (`engine/gsm2_simd_products`'s `simd_float_products`)
@@ -1119,3 +1123,175 @@ fn the_emulated_tiers_barriers_run_only_in_a_threadgroup_of_several_threads() {
}
}
}
/// A kernel adding the `constant` word `n` (slot 2) to the word at `data + n` (slot 0) and storing
/// the sum to `out` (slot 1); `data` carries `air-buffer-no-alias` where `unaliased`, and the sum
/// is stored back to `data` too where `data_written`. `n` carries no attribute.
fn read_only_kernel(unaliased: bool, data_written: bool) -> String {
let attribute = if unaliased {
" \"air-buffer-no-alias\""
} else {
""
};
let write_back = if data_written {
" store i32 %s, ptr addrspace(1) %0, align 4\n"
} else {
""
};
format!(
"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\"\n\
target triple = \"air64_v28-apple-macosx26.0.0\"\n\n\
define void @read_only(ptr addrspace(1) noundef{attribute} %0, ptr addrspace(1) noundef \"air-buffer-no-alias\" %1, ptr addrspace(2) noundef %2) {{\n\
entry:\n\
%n = load i32, ptr addrspace(2) %2, align 4\n\
%p = getelementptr i8, ptr addrspace(1) %0, i32 %n\n\
%v = load i32, ptr addrspace(1) %p, align 4\n\
%s = add i32 %v, %n\n\
store i32 %s, ptr addrspace(1) %1, align 4\n\
{write_back} ret void\n\
}}\n\n\
!air.kernel = !{{!9}}\n!air.version = !{{!17}}\n!air.language_version = !{{!18}}\n\
!9 = !{{ptr @read_only, !10, !11}}\n!10 = !{{}}\n!11 = !{{!12, !13, !14}}\n\
!12 = !{{i32 0, !\"air.buffer\", !\"air.location_index\", i32 0, i32 1, !\"air.read_write\", !\"air.address_space\", i32 1, !\"air.arg_type_size\", i32 4, !\"air.arg_type_align_size\", i32 4, !\"air.arg_type_name\", !\"uint\", !\"air.arg_name\", !\"data\"}}\n\
!13 = !{{i32 1, !\"air.buffer\", !\"air.location_index\", i32 1, i32 1, !\"air.read_write\", !\"air.address_space\", i32 1, !\"air.arg_type_size\", i32 4, !\"air.arg_type_align_size\", i32 4, !\"air.arg_type_name\", !\"uint\", !\"air.arg_name\", !\"out\"}}\n\
!14 = !{{i32 2, !\"air.buffer\", !\"air.buffer_size\", i32 4, !\"air.location_index\", i32 2, i32 1, !\"air.read\", !\"air.address_space\", i32 2, !\"air.arg_type_size\", i32 4, !\"air.arg_type_align_size\", i32 4, !\"air.arg_type_name\", !\"uint\", !\"air.arg_name\", !\"n\"}}\n\
!17 = !{{i32 2, i32 8, i32 0}}\n!18 = !{{!\"Metal\", i32 4, i32 0, i32 0}}\n"
)
}
/// The device-address loads of serialized module `words`: how many go through a `NonWritable`
/// place (a member of a block decorated `NonWritable`) and how many through a writable one, and
/// how many stores go through a `NonWritable` place.
fn device_address_loads(words: &[u32]) -> (usize, usize, usize) {
const MEMBER_DECORATE: u32 = 72;
const NON_WRITABLE: u32 = 24;
const TYPE_POINTER: u32 = 32;
const PHYSICAL_STORAGE_BUFFER: u32 = 5349;
const CONVERT_U_TO_PTR: u32 = 120;
const ACCESS_CHAIN: u32 = 65;
const LOAD: u32 = 61;
const STORE: u32 = 62;
let insts = || {
let mut at = 5;
std::iter::from_fn(move || {
let w = *words.get(at)?;
let len = ((w >> 16) as usize).max(1);
let inst = &words[at..(at + len).min(words.len())];
at += len;
Some((w & 0xFFFF, inst))
})
};
let read_only_blocks: Vec<u32> = insts()
.filter(|(op, i)| *op == MEMBER_DECORATE && i.get(3) == Some(&NON_WRITABLE))
.map(|(_, i)| i[1])
.collect();
// Each device-address pointer type, whether its block is `NonWritable`.
let pointers: BTreeMap<u32, bool> = insts()
.filter(|(op, i)| *op == TYPE_POINTER && i.get(2) == Some(&PHYSICAL_STORAGE_BUFFER))
.map(|(_, i)| (i[1], read_only_blocks.contains(&i[3])))
.collect();
let mut bases = BTreeMap::new();
let mut places = BTreeMap::new();
let (mut read_only, mut writable, mut stores) = (0, 0, 0);
for (op, i) in insts() {
match op {
CONVERT_U_TO_PTR => {
if let Some(&ro) = pointers.get(&i[1]) {
bases.insert(i[2], ro);
}
}
ACCESS_CHAIN => {
if let Some(&ro) = bases.get(&i[3]) {
places.insert(i[2], ro);
}
}
LOAD => match places.get(&i[3]) {
Some(true) => read_only += 1,
Some(false) => writable += 1,
None => {}
},
STORE => stores += usize::from(places.get(&i[1]) == Some(&true)),
_ => {}
}
}
(read_only, writable, stores)
}
/// Under the identity domains a slot nothing in the kernel writes is loaded through
/// `NonWritable` device-address places, so the device may read it as read-only memory (RADV reads
/// a uniform address of it with a scalar load): a `constant` slot, aliased or not, and a `device`
/// slot the AIR declares unaliased that no store reaches. A `device` slot without the attribute,
/// or one the kernel also writes, is loaded through a writable place, and no store goes through a
/// `NonWritable` one. Each kernel passes L3 and computes its sum on the CPU interpreter.
#[test]
fn unwritten_slots_are_loaded_through_non_writable_places() {
// (case, data unaliased, data written, the unwritten slots, read-only and writable loads)
let cases = [
("read_only", true, false, vec![0u32, 2], (2, 0)),
("data_aliased", false, false, vec![2], (1, 1)),
("data_written", true, true, vec![2], (1, 1)),
];
const N: u32 = 8;
const AT: [u64; 3] = [0x1_0000_0000, 0x2_0000_1000, 0x3_0000_2000];
let mut data = vec![0u8; 16];
data[8..12].copy_from_slice(&0x1234_5678u32.to_le_bytes());
let want = 0x1234_5678u32 + N;
for (case, unaliased, written, slots, loads) in cases {
let Some(bc) = assemble_text(case, &read_only_kernel(unaliased, written)) else {
return;
};
for stem in PROFILES {
let what = format!("{stem} {case}");
let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}"));
let (a, plan, module) =
compile_kept(&bc, "read_only", &p).unwrap_or_else(|e| panic!("{what}: {e}"));
link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}"));
let unwritten: Vec<u32> = plan
.families
.access
.unwritten
.iter()
.filter_map(|&i| plan.slots.get(i).copied().flatten())
.map(|c| c.slot.index)
.collect();
assert_eq!(unwritten, slots, "{what}: unwritten slots");
let (read_only, writable, stores) = device_address_loads(&a.module.words);
assert_eq!((read_only, writable), loads, "{what}: loads");
assert_eq!(stores, 0, "{what}: a store through a NonWritable place");
let mut push = vec![0u8; plan.push.push_range.map_or(0, |(_, end)| end as usize)];
for f in &plan.push.fields {
let PushLoc::Push { offset } = f.loc else {
panic!("{what}: {f:?} spilled");
};
let o = offset as usize;
match f.field {
PushField::SlotGuestBase(s) => {
push[o..o + 8].copy_from_slice(&AT[s.index as usize].to_le_bytes());
}
PushField::DispatchRegion => {
let region = region_bytes([0; 3], [1, 1, 1], [1, 1, 1]).expect("packs");
push[o..o + 32].copy_from_slice(&region);
}
_ => panic!("{what}: unexpected push field {f:?}"),
}
}
let buffer = |at: u64, bytes: Vec<u8>| Buffer {
slot: None,
address: Some(at),
bytes,
};
let res = Resources {
buffers: vec![
buffer(AT[0], data.clone()),
buffer(AT[1], vec![0; 4]),
buffer(AT[2], N.to_le_bytes().to_vec()),
],
push,
spec: local_size(1),
};
let got =
run(&module, &Config::default(), res).unwrap_or_else(|e| panic!("{what}: {e}"));
assert_eq!(got.buffers[1], want.to_le_bytes(), "{what}: out");
}
}
}