library:ml: gemv int8 shader for single-position convolutions
- Commit
ca92c40a2e9b094215c63b939512dc0e49b34e43- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-29 04:19 UTC (3 months ago)
- Parents
0819363
Diff
library/ml/src/main/rust/shaders/conv_vec_int8.comp
diff --git a/library/ml/src/main/rust/shaders/conv_vec_int8.comp b/library/ml/src/main/rust/shaders/conv_vec_int8.compnew file mode 100644index 0000000000..3698463d95--- /dev/null+++ b/library/ml/src/main/rust/shaders/conv_vec_int8.comp@@ -0,0 +1,112 @@+#version 450+//! `conv_point_int8.comp` for a **single position**: a matrix-vector product, not a tiny matrix.+//!+//! `out[o] = act(scale[o] * sum_i W[o][i] * x[i] + bias[o])`.+//!+//! # Why the tiled shader is the wrong shape here+//!+//! `conv_point_int8.comp` tiles `16 x 16` over output channels and positions, so its workgroup+//! count is `out_c.div_ceil(16) * positions.div_ceil(16)`. At **one** position the second factor is+//! 1 and the tile is 16 channels by 16 positions of which 15 are padding, so:+//!+//! * Of 64 invocations, the 56 whose `local_col` is not 0 compute nothing that is stored. The+//! workgroup produces 16 outputs where it is built to produce 256.+//! * Each staging step zero-fills 240 of the 256 `input_tile` slots, and the activation vector is+//! re-staged once per channel tile — 16 times over for a 256-channel output.+//!+//! That is roughly a 16x waste, and it lands on exactly the wrong op. A SMaLL-100 decode step is+//! *entirely* single-position: 30 projections and the 128,112-class head, 128 times per+//! translation, with the head alone at 131 million multiply-accumulates. Nothing else in a+//! translation is close.+//!+//! # The shape that fits+//!+//! One workgroup per **group of [`ROWS`] output channels**, with the 64 lanes striding along the+//! input channels:+//!+//! ```text+//! for (k = lane; k < in_c; k += 64) // lane's slice of the activation+//! x = arena[in0 + k] // read once, into a register+//! for (r = 0; r < ROWS; r++) // reused by every row+//! acc[r] += W[channel_base + r][k] * x+//! ```+//!+//! Three things fall out:+//!+//! * **Every lane contributes to every output.** No idle lanes and no padding.+//! * **The weight reads are coalesced.** Lane `l` reads `W[c][k0 + l]`, which is contiguous, and+//! four adjacent lanes fall in one 32-bit word of the int8 view.+//! * **The activation is read exactly once per workgroup** and reused from a register across all+//! `ROWS` rows, rather than staged into shared memory `out_c / 16` times over. That is why there+//! is no activation tile here: at one position a lane needs only the elements it strides over.+//!+//! What it costs is a cross-lane reduction, which the tiled shader does not need because each of+//! its invocations owns a whole dot product. [`partial`] is the only shared memory, `ROWS * 64`+//! floats, and lanes `0 .. ROWS` finish the sums. At 2 KB that is an eighth of the 16 KB+//! `maxComputeSharedMemorySize` the spec guarantees.+//!+//! # Precision and the push block+//!+//! Identical to `conv_point_int8.comp`, deliberately: `nets::reference` serves all three int8 kinds+//! from one implementation, so any difference here would be a difference from the oracle. fp32+//! accumulation, the scale applied to the finished accumulator, then the bias, then the activation.+//! `p.weight` is a **32-bit word** offset and `p.act_weight` the scale as an fp16 element index,+//! which is why `Act::PRelu` cannot ride along.++#include "common.glsl"++/// Output channels per workgroup.+///+/// Eight rather than one because a workgroup per output channel would spend 64 lanes on a single+/// dot product and reduce 64 partials for one number; eight amortises the reduction's barrier over+/// eight outputs while keeping [`partial`] at 2 KB. It also bounds the register pressure at eight+/// accumulators, which is what lets the activation stay in a register across the row loop.+#define ROWS 8u++/// Per-lane partial sums, one row of 64 per output channel.+shared float partial[ROWS][64];++void main() {+ // The channel group this workgroup owns. Uniform across the workgroup, so an early return+ // cannot strand a barrier — every invocation takes the same branch.+ uint tile = gl_WorkGroupID.y * gl_NumWorkGroups.x + gl_WorkGroupID.x;+ if (tile >= p.count) {+ return;+ }+ uint channel_base = tile * ROWS;+ uint lane = gl_LocalInvocationID.x;++ float acc[ROWS];+ for (uint r = 0u; r < ROWS; r++) {+ acc[r] = 0.0;+ }+ // Rows past the output are accumulated anyway and discarded at the store. Skipping them would+ // branch inside the hot loop for at most seven channels of the last workgroup.+ for (uint k = lane; k < p.in_c; k += 64u) {+ float x = float(arena[p.in0 + k]);+ for (uint r = 0u; r < ROWS; r++) {+ acc[r] += float(int8_at(p.weight, (channel_base + r) * p.in_c + k)) * x;+ }+ }+ for (uint r = 0u; r < ROWS; r++) {+ partial[r][lane] = acc[r];+ }+ barrier();++ // One lane per row finishes its 64 partials. A log-step tree would cost six barriers to save+ // 56 adds on eight lanes, against an inner loop that just did `in_c` of them on all 64.+ if (lane >= ROWS) {+ return;+ }+ uint channel = channel_base + lane;+ if (channel >= p.out_c) {+ return;+ }+ float total = 0.0;+ for (uint i = 0u; i < 64u; i++) {+ total += partial[lane][i];+ }+ float scale = float(weights[p.act_weight + channel]);+ float offset = float(weights[p.bias + channel]);+ arena[p.out_at + channel] = float16_t(activate(total * scale + offset, p.act, channel));+}
library/ml/src/main/rust/src/nets/mod.rs
diff --git a/library/ml/src/main/rust/src/nets/mod.rs b/library/ml/src/main/rust/src/nets/mod.rsindex 6663a5bd40..ac66ca9b9d 100644--- a/library/ml/src/main/rust/src/nets/mod.rs+++ b/library/ml/src/main/rust/src/nets/mod.rs@@ -304,6 +304,16 @@ pub enum Kind { /// id lane would silently land on a neighbouring row — Supertonic has 8,322 symbols and /// SMaLL-100 has 128,112. Those arrive **split across two lanes**, `id = lo + 2048 * hi`, /// as a `[2, 1, T]` tensor; [`Push::in_c`] carries the lane count. See [`embed_lanes`].+ /// [`Kind::ConvPointInt8`] for a single position: a matrix-vector product.+ ///+ /// The tiled kind's workgroup count is `out_c.div_ceil(16) * positions.div_ceil(16)`, so at one+ /// position 15 of every 16 tile columns are padding and 56 of every 64 invocations store+ /// nothing. A SMaLL-100 decode step is entirely single-position — 30 projections and a+ /// 128,112-class head, 128 times per translation — so that waste lands on the dominant cost.+ /// See `shaders/conv_vec_int8.comp`.+ ///+ /// Chosen automatically by [`Builder`]; no net asks for it.+ ConvVecInt8, Embed, /// `out[i] = weights[i]`, a learned tensor copied into the arena. ///@@ -464,7 +474,7 @@ impl Kind { } // As above, plus the dequantisation scale, which occupies `act_weight` and is why // `Builder::conv_int8` refuses `Act::PRelu`.- Kind::ConvInt8 | Kind::ConvPointInt8 => {+ Kind::ConvInt8 | Kind::ConvPointInt8 | Kind::ConvVecInt8 => { reads.push(WeightRead { at: words(push.weight), field: "weight" }); reads.push(WeightRead { at: elems(push.bias), field: "bias" }); reads.push(WeightRead { at: elems(push.act_weight), field: "act_weight" });@@ -793,6 +803,12 @@ const ALIGN_ELEMS: u32 = 8; /// drift apart. const CONV_POINT_TILE: u32 = 16; +/// `ROWS` in `shaders/conv_vec_int8.comp`: output channels per workgroup.+///+/// That shader is dispatched one workgroup per group of this many channels, so [`Builder::emit`]+/// has to know it to compute [`Push::count`], exactly as it does for [`CONV_POINT_TILE`].+const CONV_VEC_ROWS: u32 = 8;+ /// `erf`, to about 1.5e-7 — Abramowitz and Stegun 7.1.26. /// /// Rust has no `erf`, and [`Act::Gelu`] is the exact form rather than the tanh approximation, so@@ -1777,9 +1793,25 @@ impl<'a> Builder<'a> { && si.h == so.h && si.w == so.w; let positions = so.h * so.w;+ // At one position the tiled shader pads 15 of every 16 columns and stores from 8 of+ // every 64 invocations, so a single-position pointwise convolution goes to the gemv+ // shader instead. It is the whole of a SMaLL-100 decode step.+ let vector = tiled && positions == 1; let tiles = so.c.div_ceil(CONV_POINT_TILE) * positions.div_ceil(CONV_POINT_TILE);+ let rows = so.c.div_ceil(CONV_VEC_ROWS);+ let kind = match (tiled, vector) {+ (_, true) => Kind::ConvVecInt8,+ (true, false) => Kind::ConvPointInt8,+ (false, false) => Kind::ConvInt8,+ };+ // Workgroups for the two staged kinds, output elements for the untiled one.+ let count = match kind {+ Kind::ConvVecInt8 => rows,+ Kind::ConvPointInt8 => tiles,+ _ => so.len(),+ }; ops.push(Op::Dispatch {- kind: if tiled { Kind::ConvPointInt8 } else { Kind::ConvInt8 },+ kind, push: Push { in0: at(*input)?, out: at(*out)?,@@ -1796,9 +1828,9 @@ impl<'a> Builder<'a> { out_c: so.c, out_h: so.h, out_w: so.w,- // `conv_point_int8.comp` reads none of these, unlike `Kind::ConvPoint`'s- // push block, which leaves them at zero. They are filled in either way so- // that `nets::reference` can serve both kinds from one `conv_int8`, whose+ // Neither staged shader reads these, unlike `Kind::ConvPoint`'s push block,+ // which leaves them at zero. They are filled in either way so that+ // `nets::reference` can serve all three kinds from one `conv_int8`, whose // arithmetic is identical once the geometry above holds. kh: kernel.0, kw: kernel.1,@@ -1810,11 +1842,15 @@ impl<'a> Builder<'a> { pad_l: pad.1, group: *group, act: act.code(),- // Tiles for the tiled kind, one workgroup each; output elements otherwise.- count: if tiled { tiles } else { so.len() },+ count, ..Push::default() },- invocations: if tiled { tiles * 64 } else { so.len() },+ // One workgroup of 64 per unit for the two staged shaders; one invocation per+ // output element for the untiled one.+ invocations: match kind {+ Kind::ConvVecInt8 | Kind::ConvPointInt8 => count * 64,+ _ => count,+ }, }); } Node::Conv {@@ -2500,7 +2536,9 @@ pub(crate) mod tests { pub fn name_of(kind: super::Kind) -> String { match kind { super::Kind::ConvPoint => "Conv".to_string(),- super::Kind::ConvPointInt8 => "ConvInt8".to_string(),+ // Both staged int8 lowerings are the same graph op as the untiled one. Which shader+ // serves a `1 x 1` is a lowering decision the op-inventory tests should not see.+ super::Kind::ConvPointInt8 | super::Kind::ConvVecInt8 => "ConvInt8".to_string(), other => format!("{other:?}"), } }@@ -2572,8 +2610,11 @@ pub(crate) mod tests { Kind::Embed => vec![(push.in0, push.in_c * push.out_w)], // As `Conv`: the whole input plane, whatever the kernel touches. Kind::ConvInt8 => vec![(push.in0, dense)],- // count is tiles here, so the read span is the input plane.- Kind::ConvPoint | Kind::ConvPointInt8 => vec![(push.in0, dense)],+ // count is tiles or channel groups here, so the read span is the input+ // plane. `ConvVecInt8`'s is one position of it.+ Kind::ConvPoint | Kind::ConvPointInt8 | Kind::ConvVecInt8 => {+ vec![(push.in0, dense)]+ } _ => vec![(push.in0, dense)], }; ((push.out, written), reads)
library/ml/src/main/rust/src/nets/reference.rs
diff --git a/library/ml/src/main/rust/src/nets/reference.rs b/library/ml/src/main/rust/src/nets/reference.rsindex c508d5fb62..335671d107 100644--- a/library/ml/src/main/rust/src/nets/reference.rs+++ b/library/ml/src/main/rust/src/nets/reference.rs@@ -208,10 +208,12 @@ impl Reference { Kind::AddBroadcast => self.add_broadcast(push), Kind::Rotary => self.rotary(push), Kind::ConvPoint => self.conv_point(push),- // The tiled int8 lowering computes exactly what the untiled one does, and- // `Builder::emit` fills the geometry fields in for both, so there is one- // implementation rather than two that have to be kept agreeing.- Kind::ConvInt8 | Kind::ConvPointInt8 => self.conv_int8(push),+ // All three int8 lowerings compute exactly what the untiled one does, and+ // `Builder::emit` fills the geometry fields in for every one of them, so there+ // is one implementation rather than three that have to be kept agreeing.+ Kind::ConvInt8 | Kind::ConvPointInt8 | Kind::ConvVecInt8 => {+ self.conv_int8(push)+ } }, }; result.map_err(|e| format!("step {step} ({op:?}): {e}"))?;
library/ml/src/main/rust/src/nets/small100.rs
diff --git a/library/ml/src/main/rust/src/nets/small100.rs b/library/ml/src/main/rust/src/nets/small100.rsindex 6b583a5413..78dcdf60d1 100644--- a/library/ml/src/main/rust/src/nets/small100.rs+++ b/library/ml/src/main/rust/src/nets/small100.rs@@ -794,6 +794,91 @@ mod tests { assert!(error.contains("position limit") || error.contains("limit"), "{error}"); } + #[test]+ fn a_single_position_int8_convolution_becomes_a_gemv() {+ // Why `Kind::ConvVecInt8` exists. A decode step is one position almost throughout, and the+ // tiled kind's workgroup count is `out_c.div_ceil(16) * positions.div_ceil(16)` — so at one+ // position it pads 15 of every 16 tile columns and stores from 8 of every 64 invocations.+ let (_, plan) = plan(Mode::DecodeStep { cache_len: 3, src_len: LEN });+ let int8: Vec<_> = plan+ .ops+ .iter()+ .filter_map(|op| match op {+ Op::Dispatch { kind, push, invocations } => {+ (super::super::tests::name_of(*kind) == "ConvInt8")+ .then_some((*kind, *push, *invocations))+ }+ _ => None,+ })+ .collect();+ assert_eq!(int8.len(), DECODER_LAYERS * 10 + HEAD_SPLITS);++ // The split is not "everything": the cross-attention's key and value projections read the+ // **encoder output**, which is `src_len` positions, so they stay tiled and are the only+ // multi-position work a decode step does. Everything else — the four self-attention+ // projections, the cross-attention's query and output, both feed-forwards and both head+ // halves — is one position.+ let (vector, tiled): (Vec<_>, Vec<_>) =+ int8.iter().partition(|(kind, _, _)| *kind == Kind::ConvVecInt8);+ assert_eq!(vector.len(), DECODER_LAYERS * 8 + HEAD_SPLITS, "single-position");+ assert_eq!(tiled.len(), DECODER_LAYERS * 2, "the cross-attention K and V");+ for (kind, push, _) in &tiled {+ assert_eq!(*kind, Kind::ConvPointInt8, "{push:?}");+ assert_eq!(push.out_w, LEN, "{push:?}");+ }+ // One workgroup per group of eight output channels, 64 invocations each.+ for (_, push, invocations) in &vector {+ assert_eq!(push.out_h * push.out_w, 1, "{push:?}");+ assert_eq!(push.count, push.out_c.div_ceil(8), "{push:?}");+ assert_eq!(*invocations, push.count * 64, "{push:?}");+ }+ }++ #[test]+ fn the_gemv_issues_a_sixteenth_of_the_tiled_shader_s_work() {+ // The head is where it matters: 128,112 classes over 1024 channels, 128 times per+ // translation, at 131 million multiply-accumulates. This is the arithmetic that makes the+ // shader worth its own file.+ let (_, plan) = plan(Mode::DecodeStep { cache_len: 0, src_len: LEN });+ let head = plan+ .ops+ .iter()+ .find_map(|op| match op {+ Op::Dispatch { kind: Kind::ConvVecInt8, push, .. }+ if push.out_c == CLASSES_PER_SPLIT =>+ {+ Some(*push)+ }+ _ => None,+ })+ .expect("a head half on the gemv path");++ // Useful work: one multiply-accumulate per weight.+ let useful = u64::from(head.out_c) * u64::from(head.in_c);+ // The gemv issues exactly that: every lane of every workgroup contributes to eight rows.+ let gemv = u64::from(head.count) * 64 * 8 * (u64::from(head.in_c) / 64);+ assert_eq!(gemv, useful);+ // The tiled path issues 64 invocations x a 2x2 register block per k-step, for a tile that+ // is 16 channels by 16 positions of which 15 are padding.+ let tiles = head.out_c.div_ceil(16) * 1u32.div_ceil(16);+ let issued = u64::from(tiles) * 64 * 4 * u64::from(head.in_c);+ assert_eq!(issued / gemv, 16, "{issued} against {gemv}");+ }++ #[test]+ fn the_encoder_stays_on_the_tiled_path() {+ // The gemv shader is for one position only: over a sequence the tiled kind reuses a staged+ // weight tile across 16 positions, which is the whole reason it exists.+ let (_, plan) = plan(Mode::Encode { len: LEN });+ for op in &plan.ops {+ if let Op::Dispatch { kind, push, .. } = op {+ if super::super::tests::name_of(*kind) == "ConvInt8" {+ assert_eq!(*kind, Kind::ConvPointInt8, "{push:?}");+ }+ }+ }+ }+ #[test] fn the_head_is_two_ops_over_disjoint_class_ranges() { let (_, plan) = plan(Mode::Logits);
library/ml/src/main/rust/src/vulkan/parity.rs
diff --git a/library/ml/src/main/rust/src/vulkan/parity.rs b/library/ml/src/main/rust/src/vulkan/parity.rsindex 8b045df8ed..21a2da48c3 100644--- a/library/ml/src/main/rust/src/vulkan/parity.rs+++ b/library/ml/src/main/rust/src/vulkan/parity.rs@@ -253,6 +253,131 @@ fn a_reshape_moves_the_same_elements_on_the_device() { ); } +#[test]+#[ignore = "needs a Vulkan device"]+fn the_gemv_int8_shader_agrees_with_the_reference() {+ // `conv_vec_int8.comp`, which every ungrouped single-position 1x1 int8 convolution lowers to.+ // It is a decode step's whole int8 workload bar the cross-attention keys and values, and it+ // reduces across all 64 lanes through shared memory where the other two int8 shaders give each+ // invocation a whole dot product — so a wrong reduction, a wrong row stride or a missing barrier+ // is invisible in the shape and shows up only here.+ //+ // The shape makes both ragged cases fire at once: 20 output channels is not a multiple of the+ // shader's 8 rows, so the last workgroup accumulates three rows that must be discarded at the+ // store; and 100 input channels is not a multiple of the 64-lane stride, so the inner loop's+ // last pass covers 36 lanes and the other 28 must contribute zero.+ let out_channels = 20u32;+ let in_channels = 100u32;+ let kernel: Vec<i8> = (0..(out_channels * in_channels) as i32)+ .map(|i| ((i * 37) % 251 - 125) as i8)+ .collect();+ // Distinct per channel, and each an exact multiple of a power of two so the interpreter and the+ // device read one number rather than two roundings of one.+ let scales: Vec<f32> = (0..out_channels).map(|c| 0.007_812_5 * (1.0 + c as f32)).collect();+ let biases: Vec<f32> = spread(out_channels as usize, 1.9);+ let blob = write_mixed(+ graph::SUPERTONIC_VE,+ &[+ Fixture::I8(vec![out_channels, in_channels, 1, 1], kernel),+ Fixture::F16(vec![out_channels], scales),+ Fixture::F16(vec![out_channels], biases),+ ],+ );+ let weights = Weights::parse(&blob, graph::SUPERTONIC_VE).expect("the fixture blob parses");+ let input = spread(in_channels as usize, 0.7);++ let mut builder = Builder::new(&weights);+ let first = builder.input(Shape::new(in_channels, 1, 1));+ let last = builder.conv_int8(+ first,+ 0,+ out_channels,+ (1, 1),+ (1, 1),+ (1, 1),+ (0, 0, 0, 0),+ 1,+ Act::Relu,+ );+ let plan = builder.finish(&[last]).expect("the gemv int8 fixture plan builds");+ // The lowering is automatic, so this is also what asserts it happened.+ assert!(+ plan.ops.iter().any(|op| matches!(+ op,+ crate::nets::Op::Dispatch { kind: crate::nets::Kind::ConvVecInt8, .. }+ )),+ "a single-position int8 convolution must lower to the gemv shader: {:?}",+ plan.ops,+ );+ compare("a gemv int8 convolution", plan, weights.data().to_vec(), &[&input]);+}++#[test]+#[ignore = "needs a Vulkan device"]+fn the_gemv_and_tiled_int8_shaders_agree_with_each_other() {+ // The same weights over one position and over 16. `Builder` sends the first to+ // `conv_vec_int8.comp` and the second to `conv_point_int8.comp`, and the wide run's position 0+ // must equal the narrow one — the strongest statement available that adding the lowering+ // changed no numbers, and the one a device can make that the interpreter cannot, since the+ // interpreter serves both from the same `conv_int8`.+ let out_channels = 24u32;+ let in_channels = 64u32;+ let width = 16u32;+ let kernel: Vec<i8> = (0..(out_channels * in_channels) as i32)+ .map(|i| ((i * 53) % 241 - 120) as i8)+ .collect();+ let scales: Vec<f32> = (0..out_channels).map(|c| 0.015_625 * (1.0 + c as f32)).collect();+ let biases: Vec<f32> = spread(out_channels as usize, 0.3);+ let blob = write_mixed(+ graph::SUPERTONIC_VE,+ &[+ Fixture::I8(vec![out_channels, in_channels, 1, 1], kernel),+ Fixture::F16(vec![out_channels], scales),+ Fixture::F16(vec![out_channels], biases),+ ],+ );+ let weights = Weights::parse(&blob, graph::SUPERTONIC_VE).expect("the fixture blob parses");++ let narrow = spread(in_channels as usize, 0.4);+ // Channel-major, so position 0 of each channel is every `width`th element.+ let mut wide = vec![0.0f32; (in_channels * width) as usize];+ for channel in 0..in_channels as usize {+ wide[channel * width as usize] = narrow[channel];+ }++ let run = |shape: Shape, input: &[f32]| -> Vec<f32> {+ let mut builder = Builder::new(&weights);+ let first = builder.input(shape);+ let last = builder.conv_int8(+ first,+ 0,+ out_channels,+ (1, 1),+ (1, 1),+ (1, 1),+ (0, 0, 0, 0),+ 1,+ Act::Relu,+ );+ let plan = builder.finish(&[last]).expect("the comparison plan builds");+ let mut out = on_device(plan, weights.data().to_vec(), &[input]);+ out.pop().expect("one output")+ };+ let one = run(Shape::new(in_channels, 1, 1), &narrow);+ let many = run(Shape::new(in_channels, 1, width), &wide);+ for channel in 0..out_channels as usize {+ let gemv = one[channel];+ let tiled = many[channel * width as usize];+ // Both accumulate in fp32 and store fp16, but in a different order, so the last fp16 place+ // can differ — the same tolerance `matches` applies.+ let tolerance = 1e-3 * gemv.abs().max(1.0);+ assert!(+ (gemv - tiled).abs() <= tolerance,+ "channel {channel}: gemv {gemv} against tiled {tiled}",+ );+ }+}+ #[test] #[ignore = "needs a Vulkan device"] fn rotary_agrees_with_the_reference() {
library/ml/src/main/rust/src/vulkan/pipeline.rs
diff --git a/library/ml/src/main/rust/src/vulkan/pipeline.rs b/library/ml/src/main/rust/src/vulkan/pipeline.rsindex d8ee7dd22f..5a97fda860 100644--- a/library/ml/src/main/rust/src/vulkan/pipeline.rs+++ b/library/ml/src/main/rust/src/vulkan/pipeline.rs@@ -58,9 +58,11 @@ const ATTN_SCORES_CACHED: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/attn_scores_cached.comp.spv")); const ATTN_APPLY_CACHED: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/attn_apply_cached.comp.spv"));+const CONV_VEC_INT8: &[u8] =+ include_bytes!(concat!(env!("OUT_DIR"), "/conv_vec_int8.comp.spv")); /// Every shader, in the order [`Pipelines::create`] destructures them.-const SPIRV: [&[u8]; 26] = [+const SPIRV: [&[u8]; 27] = [ CONV, CONV_TRANSPOSE, MAXPOOL,@@ -87,6 +89,7 @@ const SPIRV: [&[u8]; 26] = [ ROTARY, ATTN_SCORES_CACHED, ATTN_APPLY_CACHED,+ CONV_VEC_INT8, ]; /// `local_size_x` in `shaders/common.glsl`. A dispatch covers `ceil(invocations / this)`@@ -141,6 +144,7 @@ pub struct Pipelines { rotary: vk::Pipeline, attn_scores_cached: vk::Pipeline, attn_apply_cached: vk::Pipeline,+ conv_vec_int8: vk::Pipeline, } impl Pipelines {@@ -356,6 +360,7 @@ impl Pipelines { rotary, attn_scores_cached, attn_apply_cached,+ conv_vec_int8, ] = match <[vk::Pipeline; SPIRV.len()]>::try_from(built) { Ok(all) => all, Err(built) => {@@ -398,6 +403,7 @@ impl Pipelines { rotary, attn_scores_cached, attn_apply_cached,+ conv_vec_int8, }) } @@ -426,6 +432,7 @@ impl Pipelines { Kind::ConvInt8 => self.conv_int8, Kind::ConvPoint => self.conv_point, Kind::ConvPointInt8 => self.conv_point_int8,+ Kind::ConvVecInt8 => self.conv_vec_int8, Kind::Mul => self.mul, Kind::Constant => self.constant, Kind::AddBroadcast => self.add_bcast,@@ -464,6 +471,7 @@ impl Pipelines { self.rotary, self.attn_scores_cached, self.attn_apply_cached,+ self.conv_vec_int8, ] { device.destroy_pipeline(pipeline, None); }