Skip to content
Merged
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- Inkling 2 Mini on Metal: decode's routed-expert dots, router, dynamic convolution, logits and loop gates read their weights and activations in 16-byte loads and the router picks its top 8 in parallel, about twice as fast on an M4 Pro (9.3 to 20.9 tok/s, one stream), with every output bit and every sum order unchanged (#4919).

- Inkling 2 on Metal: the DSpark drafter's kernels are reworked, with transposed phi and RNN weights, one online-softmax attention kernel without score scratch, batched multi-stream drafting, softmax chances and a two-pass GPU top-k; plain and drafted output bits are unchanged (#4699). Thanks @gilby.

- Flash Next on CUDA prefill: `TF_FLASHNEXT_PREFILL_MTP_LEAN=1` runs only the cache-writing part of the MTP step during prefill, skipping proposal and query work whose outputs prefill never reads; off by default (#4529).



- Tests: `test-metal-residency-owners-host` builds and passes again; its Qwen27 fixture no longer reads an unset draft-backend field (#4987).
- DeepSeek-V4.1 on Metal: if the BF16 `mv_mma` pipeline fails to load, the F32 pipeline created before it is released instead of leaked (#5015). Thanks @cwschroeder.

Expand Down
77 changes: 71 additions & 6 deletions zig/kernels/metal/inkling2/experts.metal
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,84 @@ inline float ink2_mx_weight(uchar value, uchar scale) {
return float(bfloat(w));
}

inline float2 ink2_bf2(uint pair) {
return float2(as_type<float>(pair << 16u), as_type<float>(pair & 0xffff0000u));
}

// A byte of two E2M1 codes as two FP16 values scaled by 2^-14, low nibble first; the byte must stand alone.
inline float2 ink2_e2m1_pair(uint code) {
return float2(as_type<half2>(((code * 0x00200200u) & 0x0e000e00u) | ((code * 0x01001000u) & 0x80008000u)));
}

// ink2_e4m3(code) * 2^14 from the FP16 bits of the same layout; 0x7f and 0xff stay NaN.
inline float ink2_e4m3_scale(uint code) {
const float v = float(as_type<half>(ushort(((code & 0x7fu) << 7u) | ((code & 0x80u) << 8u)))) * 4194304.0f;
return (code & 0x7fu) == 0x7fu ? as_type<float>(((code & 0x80u) << 24u) | 0x7fc00000u) : v;
}

// ink2_nv_weight twice: (e2m1 * 2^-14) * (e4m3 * 2^14) is the same exact product, then phi and one BF16 round.
inline float ink2_nv_byte(float sum, uint code, float scale, float phi, float2 x) {
const float2 m = ink2_e2m1_pair(code);
sum += float(bfloat((m.x * scale) * phi)) * x.x;
return sum + float(bfloat((m.y * scale) * phi)) * x.y;
}

// Columns in order, 16 to a scale block; k is a multiple of 16 and w, x are 16-byte aligned.
inline float ink2_dot_nv(device const uchar* w, device const uchar* scales,
device const bfloat* x, float phi, uint k) {
float sum = 0.0f;
for (uint c = 0; c < k; ++c)
sum += ink2_nv_weight(w[c / 2u], c, scales[c / 16u], phi) * float(x[c]);
for (uint b = 0; b < k / 16u; ++b) {
const uint2 codes = *(device const uint2*)(w + 8u * b);
const float scale = ink2_e4m3_scale(scales[b]);
const uint4 xa = *(device const uint4*)(x + 16u * b), xb = *(device const uint4*)(x + 16u * b + 8u);
sum = ink2_nv_byte(sum, codes.x & 255u, scale, phi, ink2_bf2(xa.x));
sum = ink2_nv_byte(sum, (codes.x >> 8u) & 255u, scale, phi, ink2_bf2(xa.y));
sum = ink2_nv_byte(sum, (codes.x >> 16u) & 255u, scale, phi, ink2_bf2(xa.z));
sum = ink2_nv_byte(sum, codes.x >> 24u, scale, phi, ink2_bf2(xa.w));
sum = ink2_nv_byte(sum, codes.y & 255u, scale, phi, ink2_bf2(xb.x));
sum = ink2_nv_byte(sum, (codes.y >> 8u) & 255u, scale, phi, ink2_bf2(xb.y));
sum = ink2_nv_byte(sum, (codes.y >> 16u) & 255u, scale, phi, ink2_bf2(xb.z));
sum = ink2_nv_byte(sum, codes.y >> 24u, scale, phi, ink2_bf2(xb.w));
}
return sum;
}

inline float ink2_dot_mx(device const uchar* w, device const uchar* scales,
device const bfloat* x, uint k) {
// Four E4M3 bytes, columns 4i to 4i + 3, added in order; the FP16 route gives e4m3 / 256, 2^(scale - 119) restores it.
inline float ink2_mx_word(float sum, uint word, float factor, float2 x01, float2 x23) {
const uint even = word & 0x00ff00ffu, odd = (word >> 8u) & 0x00ff00ffu;
const float2 w02 = float2(as_type<half2>(((even << 7u) & 0x3f803f80u) | ((even << 8u) & 0x80008000u)));
const float2 w13 = float2(as_type<half2>(((odd << 7u) & 0x3f803f80u) | ((odd << 8u) & 0x80008000u)));
sum += (w02.x * factor) * x01.x;
sum += (w13.x * factor) * x01.y;
sum += (w02.y * factor) * x23.x;
return sum + (w13.y * factor) * x23.y;
}

// A block of 32 columns: scales 24 to 230 with no NaN code take the word route, the rest decode as ink2_mx_weight.
inline float ink2_mx_block(float sum, device const uchar* w, uint scale, device const bfloat* x) {
const uint4 q0 = *(device const uint4*)w, q1 = *(device const uint4*)(w + 16);
uint nan = 0u;
for (uint i = 0; i < 4u; ++i) nan |= ((q0[i] & 0x7f7f7f7fu) + 0x01010101u) | ((q1[i] & 0x7f7f7f7fu) + 0x01010101u);
if (scale - 24u > 206u || (nan & 0x80808080u) != 0u) {
for (uint j = 0; j < 32u; ++j) sum += ink2_mx_weight(w[j], uchar(scale)) * float(x[j]);
return sum;
}
const float factor = as_type<float>((scale + 8u) << 23u);
const uint4 xa = *(device const uint4*)x, xb = *(device const uint4*)(x + 8), xc = *(device const uint4*)(x + 16);
const uint4 xd = *(device const uint4*)(x + 24);
sum = ink2_mx_word(sum, q0.x, factor, ink2_bf2(xa.x), ink2_bf2(xa.y));
sum = ink2_mx_word(sum, q0.y, factor, ink2_bf2(xa.z), ink2_bf2(xa.w));
sum = ink2_mx_word(sum, q0.z, factor, ink2_bf2(xb.x), ink2_bf2(xb.y));
sum = ink2_mx_word(sum, q0.w, factor, ink2_bf2(xb.z), ink2_bf2(xb.w));
sum = ink2_mx_word(sum, q1.x, factor, ink2_bf2(xc.x), ink2_bf2(xc.y));
sum = ink2_mx_word(sum, q1.y, factor, ink2_bf2(xc.z), ink2_bf2(xc.w));
sum = ink2_mx_word(sum, q1.z, factor, ink2_bf2(xd.x), ink2_bf2(xd.y));
return ink2_mx_word(sum, q1.w, factor, ink2_bf2(xd.z), ink2_bf2(xd.w));
}

inline float ink2_dot_mx(device const uchar* w, device const uchar* scales, device const bfloat* x, uint k) {
float sum = 0.0f;
for (uint c = 0; c < k; ++c)
sum += ink2_mx_weight(w[c], scales[c / 32u]) * float(x[c]);
for (uint b = 0; b < k / 32u; ++b) sum = ink2_mx_block(sum, w + 32u * b, scales[b], x + 32u * b);
return sum;
}

Expand Down
96 changes: 67 additions & 29 deletions zig/kernels/metal/inkling2/glue.metal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@ inline float ink_value(const device bfloat* blocks, const device float* partial,
return source + 1 == sources ? partial[d] : float(blocks[size_t(source) * 2304 + d]);
}

// Two BF16 pairs of w and x multiplied and added to sum in column order.
inline float ink_pair(float sum, uint w, uint x) {
sum += as_type<float>(w << 16u) * as_type<float>(x << 16u);
return sum + as_type<float>(w & 0xffff0000u) * as_type<float>(x & 0xffff0000u);
}
// One thread's dot over k columns, k a multiple of 32 and both rows 16-byte aligned: the serial chain, loads batched.
inline float ink_chain(const device bfloat* w, const device bfloat* x, uint k) {
float sum = 0.0f;
for (uint d = 0; d < k; d += 32) {
uint4 a[4], b[4];
for (uint i = 0; i < 4; ++i) {
a[i] = *(const device uint4*)(w + d + 8 * i);
b[i] = *(const device uint4*)(x + d + 8 * i);
}
for (uint i = 0; i < 4; ++i) {
sum = ink_pair(sum, a[i].x, b[i].x);
sum = ink_pair(sum, a[i].y, b[i].y);
sum = ink_pair(sum, a[i].z, b[i].z);
sum = ink_pair(sum, a[i].w, b[i].w);
}
}
return sum;
}

struct InkEmbedArgs { uint rows; };
[[max_total_threads_per_threadgroup(256)]]
kernel void tf_inkling2_embed_norm(
Expand Down Expand Up @@ -128,10 +152,7 @@ kernel void tf_inkling2_conv_dynamic(
if (r >= a.rows) return;
threadgroup float projected[32];
if (t < 32) {
float dot = 0.0f;
for (uint d = 0; d < 2304; ++d)
dot += float(projection[size_t(t) * 2304 + d]) * float(input[size_t(r) * 2304 + d]);
projected[t] = float(bfloat(dot));
projected[t] = float(bfloat(ink_chain(projection + size_t(t) * 2304, input + size_t(r) * 2304, 2304)));
}
threadgroup_barrier(mem_flags::mem_threadgroup);
for (uint c = t; c < a.channels; c += 256) {
Expand All @@ -152,36 +173,55 @@ kernel void tf_inkling2_router(
device float* weights [[buffer(4)]], constant InkRouteArgs& a [[buffer(5)]],
uint t [[thread_position_in_threadgroup]], uint row [[threadgroup_position_in_grid]]) {
if (row >= a.rows) return;
threadgroup float scores[128], chosen[8];
threadgroup uint picked[8];
threadgroup float scores[128], key[128], chosen[8];
threadgroup uint picked[8], selected[128], any_nan;
if (t < 128) {
float dot = 0.0f;
for (uint d = 0; d < 2304; ++d)
dot += float(weight[size_t(t) * 2304 + d]) * float(x[size_t(row) * 2304 + d]);
scores[t] = ink_sigmoid(dot);
scores[t] = ink_sigmoid(ink_chain(weight + size_t(t) * 2304, x + size_t(row) * 2304, 2304));
key[t] = scores[t] + bias[t];
}
threadgroup_barrier(mem_flags::mem_threadgroup);
if (t == 0) {
bool used[128] = {};
for (uint j = 0; j < 8; ++j) {
uint best = 128;
for (uint e = 0; e < 128; ++e) if (!used[e]) {
if (best == 128 || scores[e] + bias[e] > scores[best] + bias[best]) best = e;
// Ranks 0 to 7 by (key descending, index ascending) are the serial scan's picks; a NaN key runs the scan.
if (t < 128) {
uint rank = 0;
bool nan = false;
for (uint f = 0; f < 128; ++f) {
nan = nan || isnan(key[f]);
rank += (key[f] > key[t] || (key[f] == key[t] && f < t)) ? 1u : 0u;
}
selected[t] = rank < 8 ? 1u : 0u;
// Every thread scanned all 128 keys; thread 0 alone stores the flag, so the barrier publishes one write.
if (t == 0) any_nan = nan ? 1u : 0u;
}
threadgroup_barrier(mem_flags::mem_threadgroup);
if (any_nan != 0) {
if (t == 0) {
bool used[128] = {};
for (uint j = 0; j < 8; ++j) {
uint best = 128;
for (uint e = 0; e < 128; ++e) if (!used[e]) {
if (best == 128 || key[e] > key[best]) best = e;
}
used[best] = true; picked[j] = best; chosen[j] = scores[best];
}
// Combining, including the denominator, is in ascending expert index.
for (uint j = 1; j < 8; ++j) {
uint id = picked[j]; float score = chosen[j]; uint k = j;
while (k > 0 && picked[k - 1] > id) { picked[k] = picked[k - 1]; chosen[k] = chosen[k - 1]; --k; }
picked[k] = id; chosen[k] = score;
}
used[best] = true; picked[j] = best; chosen[j] = scores[best];
}
} else if (t < 128 && selected[t] != 0) {
// Combining, including the denominator, is in ascending expert index.
for (uint j = 1; j < 8; ++j) {
uint id = picked[j]; float score = chosen[j]; uint k = j;
while (k > 0 && picked[k - 1] > id) { picked[k] = picked[k - 1]; chosen[k] = chosen[k - 1]; --k; }
picked[k] = id; chosen[k] = score;
}
uint at = 0;
for (uint f = 0; f < t; ++f) at += selected[f];
picked[at] = t; chosen[at] = scores[t];
}
threadgroup_barrier(mem_flags::mem_threadgroup);
if (t < 8) {
float den = 1e-20f;
for (uint j = 0; j < 8; ++j) den += chosen[j];
for (uint j = 0; j < 8; ++j) {
ids[row * 8 + j] = picked[j];
weights[row * 8 + j] = precise::divide(chosen[j], den) * 8.0f;
}
ids[row * 8 + t] = picked[t];
weights[row * 8 + t] = precise::divide(chosen[t], den) * 8.0f;
}
}

Expand All @@ -205,9 +245,7 @@ kernel void tf_inkling2_logits(
uint2 at [[thread_position_in_grid]]) {
const uint v = at.x, r = at.y;
if (v >= a.vocab || r >= a.rows) return;
float dot = 0.0f;
for (uint d = 0; d < 2304; ++d)
dot += float(unembed[size_t(v) * 2304 + d]) * float(h[size_t(r) * 2304 + d]);
const float dot = ink_chain(unembed + size_t(v) * 2304, h + size_t(r) * 2304, 2304);
// A9(a): unembedding rounds to bf16 before it widens for softcap30.
out[size_t(r) * a.vocab + v] = ink_cap(float(bfloat(dot)), 30.0f);
}
Expand Down
54 changes: 47 additions & 7 deletions zig/kernels/metal/inkling2/loop.metal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ constant uint INKLING_LOOP_MESSAGES = 48;

struct InkLoopArgs { uint rows; };

// Two BF16 pairs of w and x multiplied and added to sum in column order.
inline float ink_loop_pair(float sum, uint w, uint x) {
sum += as_type<float>(w << 16u) * as_type<float>(x << 16u);
return sum + as_type<float>(w & 0xffff0000u) * as_type<float>(x & 0xffff0000u);
}
// A BF16 pair of w times two FP32 values, added to sum in column order.
inline float ink_loop_zpair(float sum, uint w, float z0, float z1) {
sum += as_type<float>(w << 16u) * z0;
return sum + as_type<float>(w & 0xffff0000u) * z1;
}

[[max_total_threads_per_threadgroup(256)]]
kernel void tf_inkling2_loop_messages(
const device bfloat* bank0 [[buffer(0)]], const device bfloat* bank1 [[buffer(1)]],
Expand Down Expand Up @@ -91,8 +102,11 @@ kernel void tf_inkling2_loop_gates(
if (row >= a.rows) return;
const device float* inputs[2] = { h + size_t(row) * INKLING_LOOP_H,
m + size_t(row) * INKLING_LOOP_H };
threadgroup float sums[2 * 8], inverse[2], zeta[INKLING_LOOP_RANK];
threadgroup bfloat normalized[2 * INKLING_LOOP_H];
threadgroup float sums[2 * 8], inverse[2];
threadgroup float4 zeta4[INKLING_LOOP_RANK / 4];
threadgroup uint4 normalized_words[2 * INKLING_LOOP_H / 8];
threadgroup float* zeta = (threadgroup float*)zeta4;
threadgroup bfloat* normalized = (threadgroup bfloat*)normalized_words;
for (uint s = 0; s < 2; ++s) {
float ss = 0.0f;
for (uint d = t; d < INKLING_LOOP_H; d += 256) {
Expand All @@ -115,17 +129,43 @@ kernel void tf_inkling2_loop_gates(
}
threadgroup_barrier(mem_flags::mem_threadgroup);
if (t < INKLING_LOOP_RANK) {
// One thread a rank: the serial chain over the 4,608 normalized values, 64 BF16 loaded ahead of each step.
const device uint4* w = (const device uint4*)(down + size_t(t) * (2 * INKLING_LOOP_H));
float dot = 0.0f;
for (uint d = 0; d < 2 * INKLING_LOOP_H; ++d)
dot += float(down[size_t(t) * (2 * INKLING_LOOP_H) + d]) * float(normalized[d]);
for (uint j = 0; j < 2 * INKLING_LOOP_H / 8; j += 8) {
uint4 wv[8];
for (uint i = 0; i < 8; ++i) wv[i] = w[j + i];
for (uint i = 0; i < 8; ++i) {
const uint4 xv = normalized_words[j + i];
dot = ink_loop_pair(dot, wv[i].x, xv.x);
dot = ink_loop_pair(dot, wv[i].y, xv.y);
dot = ink_loop_pair(dot, wv[i].z, xv.z);
dot = ink_loop_pair(dot, wv[i].w, xv.w);
}
}
zeta[t] = float(bfloat(dot));
}
threadgroup_barrier(mem_flags::mem_threadgroup);
for (uint d = t; d < INKLING_LOOP_H; d += 256) {
// The forget and gain dots over zeta in rank order, each row loaded whole ahead of its chain.
const device uint4* fw = (const device uint4*)(forget + size_t(d) * INKLING_LOOP_RANK);
const device uint4* gw = (const device uint4*)(gain + size_t(d) * INKLING_LOOP_RANK);
uint4 fv[8], gv[8];
for (uint j = 0; j < 8; ++j) {
fv[j] = fw[j];
gv[j] = gw[j];
}
float fdot = 0.0f, gdot = 0.0f;
for (uint r = 0; r < INKLING_LOOP_RANK; ++r) {
fdot += float(forget[size_t(d) * INKLING_LOOP_RANK + r]) * zeta[r];
gdot += float(gain[size_t(d) * INKLING_LOOP_RANK + r]) * zeta[r];
for (uint j = 0; j < 8; ++j) {
const float4 z0 = zeta4[2 * j], z1 = zeta4[2 * j + 1];
fdot = ink_loop_zpair(fdot, fv[j].x, z0.x, z0.y);
fdot = ink_loop_zpair(fdot, fv[j].y, z0.z, z0.w);
fdot = ink_loop_zpair(fdot, fv[j].z, z1.x, z1.y);
fdot = ink_loop_zpair(fdot, fv[j].w, z1.z, z1.w);
gdot = ink_loop_zpair(gdot, gv[j].x, z0.x, z0.y);
gdot = ink_loop_zpair(gdot, gv[j].y, z0.z, z0.w);
gdot = ink_loop_zpair(gdot, gv[j].z, z1.x, z1.y);
gdot = ink_loop_zpair(gdot, gv[j].w, z1.z, z1.w);
}
const float f = precise::tanh(fdot);
const float g = precise::tanh(gdot);
Expand Down
2 changes: 1 addition & 1 deletion zig/src/core/contract/inkling2_glue_metal_records.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub const records = [_]M{
.{ .name = "metal inkling2 glue ar tf_inkling2_ar", .threads = 256, .tg_memory = 368, .reserved = 256 },
.{ .name = "metal inkling2 glue conv_static tf_inkling2_conv_static", .threads = 32, .tg_memory = 0, .reserved = 32 },
.{ .name = "metal inkling2 glue conv_dynamic tf_inkling2_conv_dynamic", .threads = 256, .tg_memory = 128, .reserved = 256 },
.{ .name = "metal inkling2 glue router tf_inkling2_router", .threads = 256, .tg_memory = 576, .reserved = 256 },
.{ .name = "metal inkling2 glue router tf_inkling2_router", .threads = 256, .tg_memory = 1616, .reserved = 256 },
.{ .name = "metal inkling2 glue swiglu tf_inkling2_swiglu", .threads = 32, .tg_memory = 0, .reserved = 32 },
.{ .name = "metal inkling2 glue logits tf_inkling2_logits", .threads = 32, .tg_memory = 0, .reserved = 32 },
.{ .name = "metal inkling2 glue expert_pick tf_inkling2_expert_pick", .threads = 32, .tg_memory = 0, .reserved = 32 },
Expand Down
15 changes: 8 additions & 7 deletions zig/src/families/inkling2/metal/experts.zig
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ fn launch(p: *const Pipelines, e: mtl.ComputeEncoder, op: Operation, groups: u32
e.dispatchGroups(mtl.Size.of(groups, 1, 1), mtl.Size.of(32, 1, 1));
}

/// The products and the combine: threadgroups along the outputs (x) by route pairs or tokens (y).
fn launchGrid(p: *const Pipelines, e: mtl.ComputeEncoder, op: Operation, g: plan.Geometry) void {
/// Products and combine: groups along outputs (x) by route pairs or tokens (y); 16-byte words need 16-byte offsets.
fn launchGrid(p: *const Pipelines, e: mtl.ComputeEncoder, op: Operation, g: plan.Geometry, words: []const Ref) !void {
for (words) |r| if (r.off % 16 != 0) return error.ExpertAlignment;
e.setPipeline(p.get(op));
e.dispatchGroups(mtl.Size.of(g.blocks, g.groups, 1), mtl.Size.of(g.threads, 1, 1));
}
Expand All @@ -109,7 +110,7 @@ pub fn nvfp4Gu(p: *const Pipelines, e: mtl.ComputeEncoder, x: Ref, w: Ref, scale
try plan.check(c);
for ([_]Ref{ x, w, scales, amax, denominator, ids, out }, 0..) |b, i| e.setBuffer(b.buf, b.off, i);
e.setValue(args(c), 7);
launchGrid(p, e, .nvfp4_gu, plan.geometry(c));
try launchGrid(p, e, .nvfp4_gu, plan.geometry(c), &.{ x, w });
}

/// Packed MXFP8 GU with UE8M0 scales per row/block32.
Expand All @@ -118,23 +119,23 @@ pub fn mxfp8Gu(p: *const Pipelines, e: mtl.ComputeEncoder, x: Ref, w: Ref, scale
try plan.check(c);
for ([_]Ref{ x, w, scales, ids, out }, 0..) |b, i| e.setBuffer(b.buf, b.off, i);
e.setValue(args(c), 5);
launchGrid(p, e, .mxfp8_gu, plan.geometry(c));
try launchGrid(p, e, .mxfp8_gu, plan.geometry(c), &.{ x, w });
}

pub fn nvfp4Down(p: *const Pipelines, e: mtl.ComputeEncoder, act: Ref, w: Ref, scales: Ref, amax: Ref, denominator: Ref, ids: Ref, out: Ref, c: Call) !void {
if (c.format != .nvfp4) return error.WrongExpertFormat;
try plan.check(c);
for ([_]Ref{ act, w, scales, amax, denominator, ids, out }, 0..) |b, i| e.setBuffer(b.buf, b.off, i);
e.setValue(args(c), 7);
launchGrid(p, e, .nvfp4_down, plan.geometry(c));
try launchGrid(p, e, .nvfp4_down, plan.geometry(c), &.{ act, w });
}

pub fn mxfp8Down(p: *const Pipelines, e: mtl.ComputeEncoder, act: Ref, w: Ref, scales: Ref, ids: Ref, out: Ref, c: Call) !void {
if (c.format != .mxfp8) return error.WrongExpertFormat;
try plan.check(c);
for ([_]Ref{ act, w, scales, ids, out }, 0..) |b, i| e.setBuffer(b.buf, b.off, i);
e.setValue(args(c), 5);
launchGrid(p, e, .mxfp8_down, plan.geometry(c));
try launchGrid(p, e, .mxfp8_down, plan.geometry(c), &.{ act, w });
}

/// Decode one expert matrix to BF16, not an activation quantization operation.
Expand All @@ -160,7 +161,7 @@ pub fn combine(p: *const Pipelines, e: mtl.ComputeEncoder, down: Ref, ids: Ref,
for ([_]Ref{ down, ids, weights, out }, 0..) |b, i| e.setBuffer(b.buf, b.off, i);
e.setValue(args(c), 4);
// Combine's rows are tokens, rather than route pairs.
launchGrid(p, e, .combine, plan.combineGeometry(c));
try launchGrid(p, e, .combine, plan.combineGeometry(c), &.{});
}

pub fn gu(p: *const Pipelines, e: mtl.ComputeEncoder, x: Ref, w: Ref, scales: Ref, nv_globals: ?struct { amax: Ref, denominator: Ref }, ids: Ref, out: Ref, c: Call) !void {
Expand Down
Loading
Loading