Modern Apps git

← Modern-Apps.git

library:ml: attention over two different lengths, and Kind::Constant

Commit
1c9632d0f83605c6a96f015d79ea21362277c404
Author
vayun-mathur <[email protected]>
When
2026-08-28 15:04 UTC (3 months ago)
Parents
e3bedaa

Diff

library/ml/src/main/rust/shaders/attn_apply.comp
diff --git a/library/ml/src/main/rust/shaders/attn_apply.comp b/library/ml/src/main/rust/shaders/attn_apply.compindex f037df8dd2..02d8610ac6 100644--- a/library/ml/src/main/rust/shaders/attn_apply.comp+++ b/library/ml/src/main/rust/shaders/attn_apply.comp@@ -1,18 +1,25 @@ #version 450 //! `O[h][d][i] = sum_j S[h][i][j] * V[h][d][j]`, the second half of attention. //!-//! Two uses, one per transformer block in PP-OCRv5 recognition.+//! Two uses per transformer block in PP-OCRv5 recognition, and Supertonic's text encoder mixes+//! 50 style tokens with it.+//!+//! # Queries and keys may be different counts+//!+//! `S` is `[heads, queries, keys]` from `softmax.comp`, `V` is `[d_model, 1, keys]` and the+//! output is `[d_model, 1, queries]`. `p.out_w` is the query count and `p.in_w` the key count;+//! for self-attention they are equal and this is the arithmetic it always was. //! //! # Back into the layout it started in //!-//! `S` is `[heads, T, T]` from `softmax.comp`; `V` and the output are `[d_model, 1, T]`,-//! the same layout every projection in this runtime reads and writes. So the head+//! `S` is `[heads, queries, keys]` from `softmax.comp`; `V` and the output share `d_model`,+//! the layout every projection in this runtime reads and writes. So the head //! concatenation that follows attention is not an op: output channel `c` belongs to head //! `c / head_dim` and is written in place, which *is* the concatenated result. No //! `Reshape` and no `Permute` on this side either. //!-//! One invocation per output element, reducing over the `T` keys. Note that `V` needs no-//! head arithmetic at all — channel `c` of `V` is exactly channel `c` of the output — so+//! One invocation per output element, reducing over the keys. Note that `V` needs no+//! head arithmetic at all - channel `c` of `V` is exactly channel `c` of the output - so //! the head index is used only to pick which of `S`'s planes to read. //! //! # Precision@@ -29,14 +36,14 @@ void main() {     if (index >= p.count) {         return;     }-    // The output is `[d_model, 1, T]`, so this is (channel, 0, query).+    // The output is `[d_model, 1, queries]`, so this is (channel, 0, query).     uint channel, unused_row, query;     unpack(index, channel, unused_row, query);--    uint keys = p.out_w;+    uint queries = p.out_w;+    uint keys = p.in_w;     uint head_dim = p.out_c / p.group;     // `S[head][query][*]`, contiguous in the key index.-    uint row = p.in0 + ((channel / head_dim) * keys + query) * keys;+    uint row = p.in0 + ((channel / head_dim) * queries + query) * keys;     // `V[channel][*]`, likewise contiguous, because `V`'s height is 1.     uint values = p.in1 + channel * keys; 
library/ml/src/main/rust/shaders/attn_scores.comp
diff --git a/library/ml/src/main/rust/shaders/attn_scores.comp b/library/ml/src/main/rust/shaders/attn_scores.compindex 319593f076..9f563c62e9 100644--- a/library/ml/src/main/rust/shaders/attn_scores.comp+++ b/library/ml/src/main/rust/shaders/attn_scores.comp@@ -1,7 +1,14 @@ #version 450 //! `S[h][i][j] = scale * sum_d Q[h][d][i] * K[h][d][j]`, the first half of attention. //!-//! Two uses, one per transformer block in PP-OCRv5 recognition.+//! Two uses per transformer block in PP-OCRv5 recognition, and Supertonic's text encoder+//! attends its text over 50 style tokens with it.+//!+//! # Q and K may be different lengths+//!+//! The output is `[heads, queries, keys]`, square only for self-attention. `p.out_h` is Q's+//! length and `p.out_w` is K's, so the two sequences are strided independently; when they are+//! equal this is the arithmetic it always was. //! //! # The contraction is over the middle axis, and that is the whole point //!@@ -19,10 +26,10 @@ //! //! # One invocation per score //!-//! The output is `[heads, T, T]`, so there are `heads * T * T` invocations and each-//! reduces `head_dim` products. That is the parallel axis: `T` is around 80 for a line+//! The output is `[heads, queries, keys]`, so there are `heads * queries * keys` invocations+//! and each reduces `head_dim` products. That is the parallel axis: `T` is around 80 for a line //! of text, so this is tens of thousands of independent invocations against `head_dim`-//! serial steps each — the opposite balance to `gap.comp`, which has only channels to+//! serial steps each - the opposite balance to `gap.comp`, which has only channels to //! spread across. //! //! # Scale@@ -42,20 +49,21 @@ void main() {     if (index >= p.count) {         return;     }-    // The output is `[heads, T, T]`, so `unpack` gives head, query and key directly.+    // The output is `[heads, queries, keys]`, so `unpack` gives head, query and key directly.     uint head, query, key;     unpack(index, head, query, key);--    // Q and K are `[d_model, 1, T]`: one channel every `in_h * in_w` elements, which is-    // `T`. A head owns `head_dim` consecutive channels starting at `head * head_dim`.+    // Q and K are `[d_model, 1, T]`: one channel every `T` elements. A head owns `head_dim`+    // consecutive channels starting at `head * head_dim`. The two lengths are the score map's+    // own height and width.     uint head_dim = p.in_c / p.group;-    uint stride = p.in_h * p.in_w;-    uint base = head * head_dim * stride;-+    uint query_stride = p.out_h;+    uint key_stride = p.out_w;+    uint query_base = head * head_dim * query_stride;+    uint key_base = head * head_dim * key_stride;     float total = 0.0;     for (uint d = 0u; d < head_dim; d++) {-        uint channel = base + d * stride;-        total += float(arena[p.in0 + channel + query]) * float(arena[p.in1 + channel + key]);+        total += float(arena[p.in0 + query_base + d * query_stride + query])+               * float(arena[p.in1 + key_base + d * key_stride + key]);     }     arena[p.out_at + index] = float16_t(total * uintBitsToFloat(p.param0_bits)); }
library/ml/src/main/rust/shaders/constant.comp
diff --git a/library/ml/src/main/rust/shaders/constant.comp b/library/ml/src/main/rust/shaders/constant.compnew file mode 100644index 0000000000..656e6f4bfd--- /dev/null+++ b/library/ml/src/main/rust/shaders/constant.comp@@ -0,0 +1,31 @@+#version 450+//! `out[i] = weights[i]`, a learned tensor copied into the activation arena.+//!+//! # Why an op exists for a copy+//!+//! Every other op reads its weights straight out of binding 1, so nothing needed this until+//! Supertonic's text encoder: its style attention's **keys** are+//! `tanh(W_key . style_key + b_key)`, and `style_key` is a learned `[50, 256]` table. All three+//! are constants, so the whole expression folds to one tensor at conversion time - but+//! `attn_scores.comp` contracts two *arena* tensors, and there was no way to get a weight+//! there.+//!+//! The alternatives were worse. Keeping the fold out and running `W_key` as a convolution needs+//! `style_key` in the arena anyway, so it would have to become a plan input - a model constant+//! travelling with the per-voice data. And `Kind::Embed` over a ramp of ids would do this+//! today, which is a copy dressed as a lookup.+//!+//! # It is not free, and that is fine+//!+//! One dispatch and one write per element. The tensors this is for are small (25 KB for the+//! text encoder's) and it runs once per plan, against 9M parameters of convolution.++#include "common.glsl"++void main() {+    uint index = global_index();+    if (index >= p.count) {+        return;+    }+    arena[p.out_at + index] = weights[p.weight + index];+}
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 2d8fd3c1ed..0bf0abc445 100644--- a/library/ml/src/main/rust/src/nets/mod.rs+++ b/library/ml/src/main/rust/src/nets/mod.rs@@ -306,6 +306,13 @@ pub enum Kind {     /// Distinct from [`Act::PRelu`], which is the same function with a *learned* slope per     /// channel read from the weights file.     LeakyRelu,+    /// `out[i] = weights[i]`, a learned tensor copied into the arena.+    ///+    /// The only op that produces a tensor from nothing but the weights file. It exists because+    /// [`Kind::AttnScores`] contracts two *arena* tensors, and Supertonic's text encoder attends+    /// against 50 style keys that are entirely constant — `tanh(W_key . style_key + b_key)`,+    /// which the converter folds to one tensor. See `shaders/constant.comp`.+    Constant, }  /// The push-constant block every shader declares.@@ -581,6 +588,10 @@ enum Node {         out: Id,         alpha: f32,     },+    Constant {+        out: Id,+        weight: u32,+    },     Embed {         ids: Id,         out: Id,@@ -1139,12 +1150,16 @@ impl<'a> Builder<'a> {     }      /// The validation, output tensor and scale every score map shares, relative or not.+    ///+    /// `q` and `k` may be different lengths: the map is `[heads, queries, keys]`, which for+    /// self-attention is the square `[heads, T, T]` and for a cross-attention is not. They must+    /// still agree on the channel count, since that is what the dot product contracts over.     fn score_map(&mut self, q: Id, k: Id, heads: u32) -> (Id, f32) {         let (sq, sk) = (self.shape_of(q), self.shape_of(k));-        if sq != sk {+        if sq.c != sk.c {             self.fail(format!("attention over q {sq:?} and k {sk:?}"));         }-        if sq.h != 1 {+        if sq.h != 1 || sk.h != 1 {             self.fail(format!(                 "attention on {sq:?}: a sequence is [d_model, 1, T], so a height above \                  one would silently reinterpret the layout"@@ -1155,7 +1170,7 @@ impl<'a> Builder<'a> {         }         let head_dim = sq.c.checked_div(heads).unwrap_or(0);         let scale = 1.0 / (head_dim.max(1) as f32).sqrt();-        (self.tensor(Shape::new(heads, sq.w, sq.w)), scale)+        (self.tensor(Shape::new(heads, sq.w, sk.w)), scale)     }      /// Softmax over the last axis, which for a score map is one query's distribution.@@ -1211,6 +1226,17 @@ impl<'a> Builder<'a> {         out     } +    /// A learned tensor copied into the arena, so it can be an operand rather than a kernel.+    ///+    /// The only op that reads nothing from the arena. See [`Kind::Constant`] for why it exists+    /// at all; `shape` is what the `.maml` tensor holds, and its element count must match.+    pub fn constant(&mut self, weight_index: usize, shape: Shape) -> Id {+        let weight = self.weight(weight_index, &[shape.c, shape.h, shape.w]);+        let out = self.tensor(shape);+        self.nodes.push(Node::Constant { out, weight });+        out+    }+     /// An embedding lookup: `out[c][t] = table[id(t)][c]`, over a `[1, 1, T]` id tensor, or a     /// `[2, 1, T]` one when the table has more than [`EMBED_LANE`] rows.     ///@@ -1266,6 +1292,15 @@ impl<'a> Builder<'a> {     ) -> Id {         let (out, scale) = self.score_map(q, k, heads);         let shape = self.shape_of(q);+        // A relative offset is `key - query`, so the two sequences have to be the same one.+        // Only the cross-attention variants take differing lengths.+        if shape.w != self.shape_of(k).w {+            self.fail(format!(+                "a relative score map over q {shape:?} and k {:?}: an offset is `key - query`, \+                 so both are positions in the same sequence",+                self.shape_of(k)+            ));+        }         let head_dim = shape.c.checked_div(heads.max(1)).unwrap_or(0);         self.check_offsets(offsets);         let table = self.weight(table, &[offsets, head_dim]);@@ -1284,6 +1319,13 @@ impl<'a> Builder<'a> {     ) -> Id {         let out = self.mixed(probs, v, heads);         let shape = self.shape_of(v);+        let probs_shape = self.shape_of(probs);+        if probs_shape.h != probs_shape.w {+            self.fail(format!(+                "a relative value mix over {probs_shape:?}: an offset is `key - query`, so both \+                 are positions in the same sequence"+            ));+        }         let head_dim = shape.c.checked_div(heads.max(1)).unwrap_or(0);         self.check_offsets(offsets);         let table = self.weight(table, &[offsets, head_dim]);@@ -1313,9 +1355,12 @@ impl<'a> Builder<'a> {     }      /// The validation and output tensor every weighted sum shares, relative or not.+    ///+    /// The output is one vector per **query**, so its width comes from the score map's height+    /// rather than from `v`. For self-attention those are the same number.     fn mixed(&mut self, probs: Id, v: Id, heads: u32) -> Id {         let (sp, sv) = (self.shape_of(probs), self.shape_of(v));-        if sp != Shape::new(heads, sv.w, sv.w) {+        if sp.c != heads || sp.w != sv.w {             self.fail(format!(                 "attention weights {sp:?} do not match {heads} heads over a sequence of \                  {} from {sv:?}",@@ -1328,7 +1373,7 @@ impl<'a> Builder<'a> {         if heads == 0 || !sv.c.is_multiple_of(heads) {             self.fail(format!("{} channels do not split into {heads} heads", sv.c));         }-        self.tensor(sv)+        self.tensor(Shape::new(sv.c, 1, sp.h))     }      /// Pack the arena and resolve every offset, with `outputs` as the result tensors.@@ -1893,7 +1938,7 @@ impl<'a> Builder<'a> {                 });             }             Node::AttnApply { probs, v, out, heads } => {-                let so = shape(*out);+                let (sv, so) = (shape(*v), shape(*out));                 ops.push(Op::Dispatch {                     kind: Kind::AttnApply,                     push: Push {@@ -1902,7 +1947,9 @@ impl<'a> Builder<'a> {                         out: at(*out)?,                         in_c: so.c,                         in_h: so.h,-                        in_w: so.w,+                        // The **key** count, which is V's length. `out_w` is the query count,+                        // and for a cross-attention those differ.+                        in_w: sv.w,                         out_c: so.c,                         out_h: so.h,                         out_w: so.w,@@ -1913,6 +1960,22 @@ impl<'a> Builder<'a> {                     invocations: so.len(),                 });             }+            Node::Constant { out, weight } => {+                let so = shape(*out);+                ops.push(Op::Dispatch {+                    kind: Kind::Constant,+                    push: Push {+                        out: at(*out)?,+                        weight: *weight,+                        out_c: so.c,+                        out_h: so.h,+                        out_w: so.w,+                        count: so.len(),+                        ..Push::default()+                    },+                    invocations: so.len(),+                });+            }             Node::LeakyRelu { input, out, alpha } => {                 let so = shape(*out);                 ops.push(Op::Dispatch {@@ -1960,6 +2023,7 @@ impl Node {             | Node::SliceChannels { out, .. }             | Node::ConvInt8 { out, .. }             | Node::AttnApply { out, .. }+            | Node::Constant { out, .. }             | Node::Concat { out, .. } => *out,         }     }@@ -1988,6 +2052,8 @@ impl Node {                 vec![*a, *b]             }             Node::Concat { parts, .. } => parts.clone(),+            // The only op with no arena input at all: it reads the weights file.+            Node::Constant { .. } => Vec::new(),         }     } }@@ -2164,15 +2230,19 @@ pub(crate) mod tests {                         Kind::MulBroadcast => {                             vec![(push.in0, written), (push.in1, push.in_c)]                         }-                        // Q and K are both whole sequences. The relative variants read a-                        // table out of the weights buffer as well, which cannot alias the-                        // arena at all.+                        // Reads no arena at all - it is a copy out of the weights file.+                        Kind::Constant => Vec::new(),+                        // Q and K are each `in_c` channels but of their own lengths, which the+                        // score map's height and width carry.                         Kind::AttnScores | Kind::AttnScoresRelative => {-                            vec![(push.in0, dense), (push.in1, dense)]+                            vec![+                                (push.in0, push.in_c * push.out_h),+                                (push.in1, push.in_c * push.out_w),+                            ]                         }-                        // The score map is `[heads, T, T]`; V is a sequence.+                        // The score map is `[heads, queries, keys]`; V is a sequence of keys.                         Kind::AttnApply | Kind::AttnApplyRelative => {-                            vec![(push.in0, push.group * push.out_w * push.out_w), (push.in1, dense)]+                            vec![(push.in0, push.group * push.out_w * push.in_w), (push.in1, dense)]                         }                         // One id per position per lane, so the read is `in_c * out_w` and                         // not `dense` - `in_w` here is the *table's* row count.
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 db96373b20..c6fc4f6c17 100644--- a/library/ml/src/main/rust/src/nets/reference.rs+++ b/library/ml/src/main/rust/src/nets/reference.rs@@ -196,6 +196,7 @@ impl Reference {                     Kind::AttnScoresRelative => self.attn_scores_relative(push),                     Kind::AttnApplyRelative => self.attn_apply_relative(push),                     Kind::Embed => self.embed(push),+                    Kind::Constant => self.constant(push),                     Kind::GatedTanh => self.gated_tanh(push),                     // The reference interpreter holds its weights as `f32`, so there is no                     // byte view to unpack: an int8 plan can be built and inspected on the@@ -558,6 +559,15 @@ impl Reference {         Ok(())     } +    /// `out[i] = weights[i]`, a learned tensor copied into the arena. See [`Kind::Constant`].+    fn constant(&mut self, p: &Push) -> Result<(), String> {+        for i in 0..p.count {+            let value = self.weight(p.weight, i)?;+            self.store(p.out, i, value)?;+        }+        Ok(())+    }+     /// `x < 0 ? alpha * x : x`, elementwise, with `alpha` carried as raw bits.     fn leaky_relu(&mut self, p: &Push) -> Result<(), String> {         let alpha = f32::from_bits(p.param0_bits);@@ -631,17 +641,19 @@ impl Reference {     /// no transpose anywhere in this, by construction.     fn attn_scores(&mut self, p: &Push) -> Result<(), String> {         let head_dim = heads(p, p.in_c)?;-        let stride = p.in_h * p.in_w;+        // Q and K carry their own lengths, which are the score map's height and width. For+        // self-attention those are equal.+        let (query_stride, key_stride) = (p.out_h, p.out_w);         let scale = f32::from_bits(p.param0_bits);         for head in 0..p.group {-            let base = head * head_dim * stride;+            let query_base = head * head_dim * query_stride;+            let key_base = head * head_dim * key_stride;             for query in 0..p.out_h {                 for key in 0..p.out_w {                     let mut total = 0.0;                     for d in 0..head_dim {-                        let channel = base + d * stride;-                        total += self.load(p.in0, channel + query)?-                            * self.load(p.in1, channel + key)?;+                        total += self.load(p.in0, query_base + d * query_stride + query)?+                            * self.load(p.in1, key_base + d * key_stride + key)?;                     }                     self.store(p.out, nchw(p, head, query, key), total * scale)?;                 }@@ -686,10 +698,11 @@ impl Reference {     /// `c` of the output — which is why concatenating the heads afterwards is not an op.     fn attn_apply(&mut self, p: &Push) -> Result<(), String> {         let head_dim = heads(p, p.out_c)?;-        let keys = p.out_w;+        // `out_w` is the query count and `in_w` the key count; equal for self-attention.+        let (queries, keys) = (p.out_w, p.in_w);         for channel in 0..p.out_c {-            let row = (channel / head_dim) * keys * keys;-            for query in 0..keys {+            let row = (channel / head_dim) * queries * keys;+            for query in 0..queries {                 let mut total = 0.0;                 for key in 0..keys {                     total += self.load(p.in0, row + query * keys + key)?@@ -2083,6 +2096,87 @@ mod tests {         assert!(error.contains("two lanes"), "{error}");     } +    #[test]+    fn a_score_map_over_two_different_lengths_is_queries_by_keys() {+        // Three queries against five keys, one head, two channels. Cross-attention: the map is+        // `[1, 3, 5]` and not square, and the two operands are strided by their own lengths —+        // reading K with Q's stride is the failure this pins, and it would still produce a+        // tensor of the right shape.+        let queries = 3u32;+        let keys = 5u32;+        // Q channel 0 is 1 everywhere and channel 1 counts the query; K is the mirror, so+        // `Q . K = 1 * 1 + query * key` and every pair is distinguishable.+        let q: Vec<f32> = (0..queries)+            .map(|_| 1.0)+            .chain((0..queries).map(|i| i as f32))+            .collect();+        let k: Vec<f32> = (0..keys)+            .map(|_| 1.0)+            .chain((0..keys).map(|j| j as f32))+            .collect();+        let got = two(+            (Shape::new(2, 1, queries), Shape::new(2, 1, keys)),+            (&q, &k),+            |b, q, k| b.attn_scores(q, k, 1),+        );+        // One head of two channels, so the scale is `1 / sqrt(2)`.+        let scale = 1.0 / 2.0f32.sqrt();+        let want: Vec<f32> = (0..queries)+            .flat_map(|i| (0..keys).map(move |j| (1.0 + (i * j) as f32) * scale))+            .collect();+        close(&got, &want);+    }++    #[test]+    fn a_value_mix_over_two_different_lengths_is_one_vector_per_query() {+        // Two queries, four keys, two channels of values. The probabilities pick key 3 for+        // query 0 and key 0 for query 1, so the answer is two of V's columns swapped — an+        // output width taken from V instead of from the queries would be four wide.+        let queries = 2u32;+        let keys = 4u32;+        let mut probs = vec![0.0f32; (queries * keys) as usize];+        probs[3] = 1.0;+        probs[keys as usize] = 1.0;+        let v: Vec<f32> = vec![10.0, 11.0, 12.0, 13.0, 20.0, 21.0, 22.0, 23.0];+        let got = two(+            (Shape::new(1, queries, keys), Shape::new(2, 1, keys)),+            (&probs, &v),+            |b, p, v| b.attn_apply(p, v, 1),+        );+        // `[2, 1, 2]`: channel 0 then channel 1, each (query 0, query 1).+        close(&got, &[13.0, 10.0, 23.0, 20.0]);+    }++    #[test]+    fn a_relative_score_map_refuses_two_different_lengths() {+        // A relative offset is `key - query`, so it is only meaningful within one sequence.+        // Cross-attention with a position table would index a band that does not exist.+        let source = Given::new(&[(vec![3, 2], vec![0.0; 6])]).expect("the fixture lays out");+        let mut b = Builder::new(&source);+        let q = b.input(Shape::new(2, 1, 3));+        let k = b.input(Shape::new(2, 1, 5));+        let out = b.attn_scores_relative(q, k, 1, 0, 3);+        let error = b.finish(&[out]).expect_err("a relative map across two sequences");+        assert!(error.contains("same sequence"), "{error}");+    }++    #[test]+    fn a_constant_reaches_the_arena_from_the_weights_file() {+        // The one op that reads no arena. Its output has to be usable as an operand, so this+        // adds it to an input rather than reading it straight back.+        let table: Vec<f32> = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0];+        let got = one(+            Shape::new(2, 1, 3),+            &[10.0, 20.0, 30.0, 40.0, 50.0, 60.0],+            &[(vec![2, 1, 3], table)],+            |b, x| {+                let loaded = b.constant(0, Shape::new(2, 1, 3));+                b.add(x, loaded)+            },+        );+        close(&got, &[11.0, 22.0, 33.0, 44.0, 55.0, 66.0]);+    }+     #[test]     fn a_relative_score_map_adds_a_banded_term_from_its_table() {         // Q = K = 1 everywhere over four positions, two channels, one head. The content
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 acccc59b57..2a1d98a40e 100644--- a/library/ml/src/main/rust/src/vulkan/pipeline.rs+++ b/library/ml/src/main/rust/src/vulkan/pipeline.rs@@ -52,9 +52,10 @@ const CONV_POINT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/conv_point.c const CONV_INT8: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/conv_int8.comp.spv")); const FLIP_CHANNELS: &[u8] =     include_bytes!(concat!(env!("OUT_DIR"), "/flip_channels.comp.spv"));+const CONSTANT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/constant.comp.spv"));  /// Every shader, in the order [`Pipelines::create`] destructures them.-const SPIRV: [&[u8]; 23] = [+const SPIRV: [&[u8]; 24] = [     CONV,     CONV_TRANSPOSE,     MAXPOOL,@@ -78,6 +79,7 @@ const SPIRV: [&[u8]; 23] = [     CONV_INT8,     CONV_POINT,     MUL,+    CONSTANT, ];  /// `local_size_x` in `shaders/common.glsl`. A dispatch covers `ceil(invocations / this)`@@ -124,6 +126,7 @@ pub struct Pipelines {     conv_int8: vk::Pipeline,     conv_point: vk::Pipeline,     mul: vk::Pipeline,+    constant: vk::Pipeline, }  impl Pipelines {@@ -283,6 +286,7 @@ impl Pipelines {             conv_int8,             conv_point,             mul,+            constant,         ] = match <[vk::Pipeline; SPIRV.len()]>::try_from(built) {             Ok(all) => all,             Err(built) => {@@ -322,6 +326,7 @@ impl Pipelines {             conv_int8,             conv_point,             mul,+            constant,         })     } @@ -351,6 +356,7 @@ impl Pipelines {             Kind::ConvInt8 => self.conv_int8,             Kind::ConvPoint => self.conv_point,             Kind::Mul => self.mul,+            Kind::Constant => self.constant,         }     } @@ -382,6 +388,7 @@ impl Pipelines {             self.conv_int8,             self.conv_point,             self.mul,+            self.constant,         ] {             device.destroy_pipeline(pipeline, None);         }