Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
51c9ccf
Gemma 4 dense: the 31B's config admission and a token oracle from gil…
BobClawblaw Oct 14, 2026
269e56f
Gemma 4 dense: kernel fixtures from gilby's RowDecode, and the core l…
BobClawblaw Oct 14, 2026
bf4418b
Gemma 4 dense: the decode glue on Metal, bit-equal to gilby's RowDeco…
BobClawblaw Oct 14, 2026
bcf358f
Gemma 4 dense: native greedy decode on Metal, token for token and log…
BobClawblaw Oct 14, 2026
7cf144c
Gemma 4 dense: prompts prefilled in decode windows, the same bits at …
BobClawblaw Oct 14, 2026
f7197de
Gemma 4 dense on the lane core: shared rounds and copy drafts, every …
BobClawblaw Oct 14, 2026
e96fa2d
Gemma 4 31B served natively on Metal: registered as gemma4, served gr…
BobClawblaw Oct 14, 2026
d980d8e
Gemma 4 dense: the reg lane kernel for every projection, the same bit…
BobClawblaw Oct 14, 2026
1832cb0
Gemma 4 dense: prompts in 128-row windows, keys written before attent…
BobClawblaw Oct 14, 2026
3bd3467
tf-gemma4-bench: prompt-window and long-context forwards, and core af…
BobClawblaw Oct 14, 2026
1eacc91
Gemma 4 dense: prompt chunks of 512 rows on core affine_mm, from alig…
BobClawblaw Oct 14, 2026
2efafcc
Gemma 4 dense: prompt attention on the tensor units, the head dim in …
BobClawblaw Oct 14, 2026
41809bf
Gemma 4 dense: the server prefills in 512-row chunks on the tensor-un…
BobClawblaw Oct 14, 2026
42e7e61
tf-gemma4-bench: projections with their group sums given, against the…
BobClawblaw Oct 14, 2026
4e59002
Gemma 4 dense: global layers' decode attention on the tensor units, a…
BobClawblaw Oct 14, 2026
d2bf7bf
Gemma 4 dense: decode scratch sized by 256-key chunks, and long-conte…
BobClawblaw Oct 14, 2026
3e983d9
Gemma 4 dense: decode glue writes the projections' group sums and the…
BobClawblaw Oct 14, 2026
09d40af
Lane core: a target may hand a drafter each prompt chunk's tapped row…
BobClawblaw Oct 15, 2026
819618d
Gemma 4 dense drafts with z-lab's DFlash: 150-190 tokens a second for…
BobClawblaw Oct 15, 2026
abb860c
Gemma 4 drafter: a round's streams in one block forward and one absor…
BobClawblaw Oct 15, 2026
ae4cfdd
Gemma 4: the greedy draw's host fallback switch goes (a getenv a row …
BobClawblaw Oct 15, 2026
0acea2f
Gemma 4 gate: the mlx oracle prefills in 2048-token chunks, and the l…
BobClawblaw Oct 15, 2026
c05ce72
Gemma 4 prompt attention: a simdgroup scores 64 keys over the whole h…
BobClawblaw Oct 15, 2026
9a06f96
Core affine_mm: tile fragments in vector loads, and a step's codes, s…
BobClawblaw Oct 15, 2026
80d1aba
Gemma 4 prompt attention: 32 query rows a threadgroup, a simdgroup sc…
BobClawblaw Oct 15, 2026
127be33
Core affine_mm dequantizes each step's weights to bf16 in its tile, a…
BobClawblaw Oct 15, 2026
b775230
Gemma 4 decode: each shape's fastest K split, and the glue as the pro…
BobClawblaw Oct 15, 2026
31c0410
Gemma 4 decode: a sliding layer's attention kernel preps its own head…
BobClawblaw Oct 15, 2026
64f1895
Core lane kernel: pipelines without a prologue keep main's tile index…
BobClawblaw Oct 15, 2026
9e2afcb
Merge branch 'native-vision' into gemma4-native
BobClawblaw Oct 15, 2026
6d701ac
Gemma 4 startup: a refused drafter, or a failed allocation on the way…
BobClawblaw Oct 15, 2026
0fea59e
The server's image path: an engine names its template's part type, an…
BobClawblaw Oct 15, 2026
8965bbb
Gemma 4 reads images: its 27-layer tower on Metal, bidirectional imag…
BobClawblaw Oct 15, 2026
c530403
Third-party notices: Gemma 4's sources, gilby's RowDecode (#360), MLX…
BobClawblaw Oct 16, 2026
7daa48d
Structured output with DFlash drafts: the Drafted wrapper hands the d…
BobClawblaw Oct 16, 2026
7322cde
Gemma 4's long-lived buffers in one residency set the idle keepalive …
BobClawblaw Oct 16, 2026
d48368c
Gemma 4 docs: structured output with drafts, forced tool calls refuse…
BobClawblaw Oct 16, 2026
c048539
A grammar's read of held fillers leaves them for the verify, so both …
BobClawblaw Oct 16, 2026
0fbb3e2
Gemma 4's image projection is admitted only as u32 words with bf16 sc…
BobClawblaw Oct 16, 2026
5154a1b
Gemma 4's RMS kernel names its source: MLX 0.32's rms_looped (rms_nor…
BobClawblaw Oct 16, 2026
3338988
Merge main (TensorFold 1.0.12) into gemma4-native
BobClawblaw Oct 16, 2026
e8b6054
The kernel contract and tile-check read core affine_mm as it now comp…
BobClawblaw Oct 16, 2026
21e8040
Gemma 4 recipe on 1.0.12: the idle first token held by the residency …
BobClawblaw Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Gemma 4 decode: each shape's fastest K split, and the glue as the pro…
…jections' prologues on one-row windows

A plain token at short context goes from 23.7 to 20.3 ms on the M5 Ultra (42 to 49 tokens a second; mlx-lm 46), 45 at
8k and 40 at 32k. The lane projection's K split is now the one each shape streams fastest at on one row (o and down 4,
the gate/up stack and the head 8), another fp32 summation order than the reference's: tf-gemma4-kernels keeps the
reference split bit for bit and reports the decode split, where a handful of outputs a linear move by one bf16 step.

The core reg lane kernel takes a family prologue and epilogue (Fused): Gemma's dense tail runs as the next layer's qkv
prologue, the attention tail as the gate/up projection's with geglu its epilogue (the stack's rows interleaved in 16-row
blocks), and the down projection sums its own input; seven dispatches a layer rather than ten, the same bits as apart,
worth 0.2 ms. tf-gemma4-bench times the decode stages, each shape plain and fused, and the glue kernels alone.

Receipts: decode prompts equal the oracle but the story at a tie it takes the other way; long prompts equal at 32k, 64k
and 252k, apart at 8k and 128k on mlx-lm's own ties; lanes and DFlash streams equal; served gate passes with its
thinking budget at 800 tokens (the shifted reasoning ran past 400).
  • Loading branch information
BobClawblaw committed Oct 15, 2026
commit b77523009a565c03dcea768abcf18c94938f78cc
46 changes: 30 additions & 16 deletions docs/recipes/gemma-4-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ zig-out/native/bin/tensorfold-native serve "$HOME/models/gemma-4-31b" --port 888
--drafter "$HOME/models/gemma-4-31b-dflash"
```

Without `--drafter` the model decodes plain, at about 43 tokens a second for one stream. With z-lab's DFlash drafter
Without `--drafter` the model decodes plain, at about 49 tokens a second for one stream at short context (mlx-lm 46)
and 40 at 32k. With z-lab's DFlash drafter
a stream decodes at 150-190 tokens a second (6-7 accepted tokens a round on chat and code, 10 on copying replies,
2 on open-ended prose), with the same tokens.

Expand All @@ -31,11 +32,17 @@ decode kernels (gilby's `gemma4-dense` branch, #360, built on cshintov's Gemma k
points, and MLX's own ops where that reference calls them: the looped RMS norm, the 4-bit embedding times its bf16
scale, `geglu` and the soft-cap as bf16 ops, and the global layers' RoPE frequencies from MLX's precise `pow`.
Each output equals the reference's bit for bit at 1, 2 and 16 rows (`tf-gemma4-kernels`, `tf-gemma4-glue`, on
fixtures from `tools/zig/gemma4_dump.py`).
fixtures from `tools/zig/gemma4_dump.py`) at the reference's K split. Decode takes each shape's fastest split instead
(`weights.splitK`: 4 for o and down, 8 for the gate/up stack and the head), another fp32 summation order: at one row a
handful of outputs a linear move by one bf16 step (5 of 43,008 on gate_up, 99 of 262,144 on the head, none on qkv).

A stream keeps a ring of window + 512 slots for each sliding layer and a buffer for each global one; rolling back is
moving the cache's length. A decode forward takes up to 16 rows of one stream and 128 of several, and every row keeps
its bits. Prompts run in chunks of 512 rows on `core/affine_mm` and a tensor-unit attention kernel, at about 1,360
its bits. A one-row window runs seven dispatches a layer rather than ten: the previous layer's dense tail is the qkv
projection's prologue, the attention tail the gate/up projection's with geglu as its epilogue (the stack's rows
interleaved in 16-row blocks, so a lane holds a gate column and its up column), and the down projection sums its own
input (`zig/kernels/metal/gemma4/fused.metal` on the lane core's `Fused` hook), the same bits as the kernels apart.
Prompts run in chunks of 512 rows on `core/affine_mm` and a tensor-unit attention kernel, at about 1,360
tokens a second at 8k, 1,200 at 32k and 560 at 252k.

The drafter is z-lab's DFlash (`zig/src/families/gemma4/dflash.zig`): five Qwen3-style layers reading six of the
Expand Down Expand Up @@ -73,20 +80,19 @@ zig-out/bin/tf-gemma4-run M L NL 49 512 && python tools/zig/gemma4_gate.py check
```

- Four chat prompts, 128 greedy tokens, prompts fed one row at a time or in windows of 16: three equal the oracle
token for token; the code prompt parts at its third token, where the oracle's top two logits are one bf16 step apart
and the native run ties them (its decode attention sums 256-key chunks in its own order). Every row keeps its bits
at any window width and beside other streams' rows.
token for token; the story prompt parts at token 56, where the native run ties the oracle's top two (24.5 and 24.5,
the oracle 24.5 and 24.375) and takes the lower id. Every row keeps its bits at any window width and beside other
streams' rows.
- Long prompts against the oracle's mlx-lm prompt forward (fed in 2048-token chunks, as `mlx_lm.generate` feeds a
prompt), 49 greedy tokens each: equal at 32k and 64k. At 8k, 128k and 252k the two part at tokens 25, 30 and 45,
each where mlx-lm's top two logits are equal (28.25, 26.25 and 28.625); the native run puts them 0.125, 0.625 and
0.125 apart.
prompt), 49 greedy tokens each: equal at 32k, 64k and 252k. At 8k and 128k the two part at tokens 25 and 30, each
where mlx-lm's top two logits are equal (28.25 and 26.25); the native run puts them 0.125 and 0.75 apart.
- The lane core: copy-drafted and DFlash-drafted streams, alone and 4 and 8 in shared rounds, equal the engine's
plain replies token for token, on the four prompts and on two copy-heavy ones.
- Served on an M5 Ultra with the drafter: greedy token SHAs equal the engine's receipts alone, with drafts off and on,
and four at once; thinking replies keep their reasoning apart, and tool calls parse.

With the drafter, one stream decodes at 150-190 tokens a second (6.4, 6.4, 2.1 and 6.7 tokens a round on the four
prompts; 10.2 and 7.8 on copying replies) and eight streams at about 210 together. Plain decode is 43 tokens a second
prompts; 10.2 and 7.8 on copying replies) and eight streams at about 210 together. Plain decode is 49 tokens a second
for one stream. The drafts match z-lab's own MLX drafter's acceptance. Shared rounds draft shallow on purpose: past 16
rows the forward is bound by tensor-op compute at about 0.8 ms a row (40 ms at 32 rows, 71 at 64, 130 at 128, the
same rate as the prompt path and mlx-lm's), so the depth rule, given those costs, finds deeper shared drafts do not
Expand All @@ -97,11 +103,11 @@ Long prompts, one after the other on the same M5 Ultra: native in 512-row chunks

| Prompt | Native prompt tok/s | mlx-lm prompt tok/s | Native decode tok/s | mlx-lm decode tok/s |
|---|---|---|---|---|
| 8k | 1362 | 1305 | about 35 | 39 |
| 32k | 1202 | 1139 | about 33 | 32 |
| 64k | 1047 | 944 | about 29 | 32 |
| 128k | 892 | 651 | about 24 | 25 |
| 252k | 564 | 440 | about 18 | 16 |
| 8k | 1385 | 1305 | about 38 | 39 |
| 32k | 1241 | 1139 | about 35 | 32 |
| 64k | 1072 | 944 | about 33 | 32 |
| 128k | 882 | 651 | about 27 | 25 |
| 252k | 570 | 440 | about 20 | 16 |

Prompt attention takes 32 query rows of a head a threadgroup: each simdgroup scores 32 keys of a block over the whole
head and accumulates its own 64 output columns, the row maxes and fp32 probabilities crossing threadgroup memory 128
Expand All @@ -113,4 +119,12 @@ times code plus bias in fp32, rounded once, as mlx-lm's quantized matmul does) a
the whole depth: a 512-row chunk's 60 layers take 284 ms there (mlx-lm's quantized matmuls 302), where the exact-codes
design, its per-group scale and bias epilogue and its row-sums pass took 344. So the prompt path rounds its weights as
mlx-lm does while the decode path's lane kernels keep the codes exact: over 40 tokens their last-row logits part by up
to 1.4 (0.8 with exact codes in both).
to 0.8.

A plain token at short context is 20.3 ms on the M5 Ultra (mlx-lm 21.6), where it was 23.7: the 241 projections read
17.3 GB in about 18 ms at the decode splits, 20.3 at the reference's (the 168-tile o and down projections ran two
waves of 256-thread groups at a split of 8 and one wave at 4; the gate/up stack and the head streamed 84-group chains
at 1, eight times the simdgroups at 8), the attention's 120 dispatches take 0.9 ms and the glue's 0.7, which running
as the projections' prologues shortens by 0.2: a prologue costs what the tail kernel cost, and only the dispatch gap
goes. `tf-gemma4-bench` prints the stages (`GEMMA_DSTAGES`), each shape plain and fused (`GEMMA_FUSED`) and the glue
kernels alone (`GEMMA_GLUE`).
2 changes: 1 addition & 1 deletion tools/zig/gemma4_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def one(name: str, draft: bool) -> tuple[str, bool]:
for name, (sha, ok) in zip(names, pool.map(lambda n: one(n, True), names)):
failed += not ok
print(f"{'ok ' if ok else 'FAIL'} four at once: {name} {sha}", flush=True)
think = post(args.url, "/v1/chat/completions", {"model": "gemma", "max_tokens": 400, "temperature": 0,
think = post(args.url, "/v1/chat/completions", {"model": "gemma", "max_tokens": 800, "temperature": 0,
"chat_template_kwargs": {"enable_thinking": True},
"messages": [{"role": "user", "content": "What is 17 * 23? Think first."}]})
msg = think["choices"][0]["message"]
Expand Down
79 changes: 63 additions & 16 deletions zig/kernels/metal/core/lane_projection.metal
Original file line number Diff line number Diff line change
Expand Up @@ -276,36 +276,79 @@ uint group_id [[simdgroup_index_in_threadgroup]],uint lane [[thread_index_in_sim
#if TF_BITS == 4 && defined(TF_REG)
struct tf_reg_load { uint4 w0, w1, q0, q1; float x0, x1; }; // a lane's codes, its two metadata quads and its two row sums for one group

inline tf_reg_load tf_reg_fetch(const device uint4* wl, const device uint4* sbv, const device float* XS, int g, int n, int m, int stride) {
return {wl[(size_t)g * 64], wl[(size_t)g * 64 + 32], sbv[((size_t)g * TF_N + n) / 4], sbv[((size_t)g * TF_N + n + 16) / 4], XS[g * stride + m], XS[g * stride + m + 8]};
inline tf_reg_load tf_reg_fetch_w(const device uint4* wl, const device uint4* sbv, int g, int n) {
return {wl[(size_t)g * 64], wl[(size_t)g * 64 + 32], sbv[((size_t)g * TF_N + n) / 4], sbv[((size_t)g * TF_N + n + 16) / 4], 0.0f, 0.0f};
}

template <typename XSP>
inline void tf_reg_sums(thread tf_reg_load& l, XSP XS, int g, int m, int stride) {
l.x0 = XS[g * stride + m];
l.x1 = XS[g * stride + m + 8];
}

template <typename XSP>
inline tf_reg_load tf_reg_fetch(const device uint4* wl, const device uint4* sbv, XSP XS, int g, int n, int m, int stride) {
tf_reg_load l = tf_reg_fetch_w(wl, sbv, g, n);
tf_reg_sums(l, XS, g, m, stride);
return l;
}

#ifndef TF_TPT
#define TF_TPT 1
#endif
// TF_FUSED (Fused in lane_projection.zig): a family's prologue makes the row and its sums under the first weight fetch.

// tf_lane's arithmetic with codes unpacked straight into tensor-op registers: every word equals tf_lane_pair's.
[[kernel]] void tf_lane_reg(const device bfloat* X [[buffer(0)]], const device uint4* W [[buffer(1)]], const device bfloat* SB [[buffer(2)]],
const device int* mdims [[buffer(3)]], device TF_OUT* Y [[buffer(4)]], const device float* XS [[buffer(5)]],
#ifdef TF_FUSED
const device bfloat* A0 [[buffer(6)]], const device bfloat* A1 [[buffer(7)]], const device bfloat* A2 [[buffer(8)]],
const device bfloat* A3 [[buffer(9)]], const device bfloat* A4 [[buffer(10)]], const device bfloat* A5 [[buffer(11)]],
device bfloat* O0 [[buffer(12)]], device bfloat* O1 [[buffer(13)]], constant float4& F [[buffer(14)]], constant int4& I [[buffer(15)]],
#endif
uint sgi [[simdgroup_index_in_threadgroup]], uint lanei [[thread_index_in_simdgroup]], uint2 tg [[threadgroup_position_in_grid]]) {
const int r0 = int(tg.y) * 16, rows = mdims[0] - r0;
if (rows <= 0) return;
X += (size_t)r0 * TF_K;
Y += (size_t)r0 * TF_YS;
XS += r0;
const int lane = int(lanei), ks = int(sgi), M = min(rows, 16), stride = mdims[1], tile = tf_tile(int(tg.x)), n0 = tile * NT;
const int lane = int(lanei), ks = int(sgi) % TF_SK, M = min(rows, 16), stride = mdims[1];
const int tile = tf_tile(int(tg.x) * TF_TPT + int(sgi) / TF_SK), n0 = tile * NT, tp = int(sgi) / TF_SK;
const int nb = 4 * (lane & 1) + 8 * ((lane >> 3) & 1), mb = ((lane >> 1) & 3) + 4 * ((lane >> 4) & 1);
const int first = TF_G0 + (ks * TF_GN) / TF_SK, last = TF_G0 + ((ks + 1) * TF_GN) / TF_SK;
constexpr auto desc = matmul2d_descriptor(16, NT, GS, false, true, false, matmul2d_descriptor::mode::multiply);
matmul2d<desc, execution_simdgroup> op;
const device uint4* wl = W + (size_t)tile * KG * 64 + lane;
const device uint4* sbv = (const device uint4*)SB;
tf_reg_load next = {};
if (first < last) next = tf_reg_fetch_w(wl, sbv, first, n0 + nb); // the first weights fly while any prologue runs
#ifdef TF_FUSED
const tf_fused fa = {A0, A1, A2, A3, A4, A5, O0, O1, F, I};
threadgroup bfloat xs[TF_XROWS > 0 ? TF_XROWS * TF_K : 1];
threadgroup float xsum[KG + 16]; // one row's sums; the 16 past the end feed the discarded rows' lanes
threadgroup float pscratch[16]; // the prologue's reduction partials
const uint tid = sgi * 32 + lanei;
if (tid < 16) xsum[KG + tid] = 0.0f;
tf_prologue(fa, X, xs, xsum, pscratch, tg.x == 0, tid); // args, X, row, sums, scratch, first group, thread
threadgroup_barrier(mem_flags::mem_threadgroup);
const threadgroup float* xsp = xsum;
#if TF_XROWS > 0
tensor<threadgroup bfloat, dextents<int32_t, 2>, tensor_inline> a(xs, dextents<int32_t, 2>(TF_K, M));
#else
tensor<device bfloat, dextents<int32_t, 2>, tensor_inline> a((device bfloat*)X, dextents<int32_t, 2>(TF_K, M));
#endif
#else
const device float* xsp = XS;
tensor<device bfloat, dextents<int32_t, 2>, tensor_inline> a((device bfloat*)X, dextents<int32_t, 2>(TF_K, M));
#endif
auto a0 = a.slice(0, 0);
auto cb = op.template get_right_input_cooperative_tensor<bfloat, half, float>();
auto P = op.template get_destination_cooperative_tensor<metal::remove_addrspace_t<decltype(a0)>, metal::remove_addrspace_t<decltype(cb)>, float>();
thread half2* b2 = (thread half2*)&cb[0];
const device uint4* wl = W + (size_t)tile * KG * 64 + lane;
const device uint4* sbv = (const device uint4*)SB;
const half2 bias = half2(1024.0h);
float C[16];
for (int i = 0; i < 16; i++) C[i] = 0.0f;
tf_reg_load next = {};
if (first < last) next = tf_reg_fetch(wl, sbv, XS, first, n0 + nb, mb, stride);
if (first < last) tf_reg_sums(next, xsp, first, mb, stride);
for (int g = first; g < last; g++) {
const tf_reg_load cur = next;
for (int w = 0; w < 8; w++) {
Expand All @@ -317,7 +360,7 @@ inline tf_reg_load tf_reg_fetch(const device uint4* wl, const device uint4* sbv,
b2[e + 8] = as_type<half2>(((lo >> 8) & 0x00FF00FFu) | 0x64006400u) - bias;
b2[e + 9] = as_type<half2>(((hi >> 8) & 0x00FF00FFu) | 0x64006400u) - bias;
}
if (g + 1 < last) next = tf_reg_fetch(wl, sbv, XS, g + 1, n0 + nb, mb, stride);
if (g + 1 < last) next = tf_reg_fetch(wl, sbv, xsp, g + 1, n0 + nb, mb, stride);
auto x = a.slice(g * GS, 0);
op.run(x, cb, P);
for (int j = 0; j < 4; j++) {
Expand All @@ -329,16 +372,20 @@ inline tf_reg_load tf_reg_fetch(const device uint4* wl, const device uint4* sbv,
C[12 + j] = fma(s1, P[12 + j], fma(b1, cur.x1, C[12 + j]));
}
}
threadgroup float part[(TF_SK > 1 ? TF_SK - 1 : 1) * 16 * 32];
threadgroup float part[TF_TPT * (TF_SK > 1 ? TF_SK - 1 : 1) * 16 * 32];
if (TF_SK > 1) {
if (ks > 0) for (int i = 0; i < 16; i++) part[((ks - 1) * 16 + i) * 32 + lane] = C[i];
if (ks > 0) for (int i = 0; i < 16; i++) part[((tp * (TF_SK - 1) + ks - 1) * 16 + i) * 32 + lane] = C[i];
threadgroup_barrier(mem_flags::mem_threadgroup);
if (ks == 0) for (int s2 = 1; s2 < TF_SK; s2++) for (int i = 0; i < 16; i++) C[i] += part[((s2 - 1) * 16 + i) * 32 + lane];
if (ks == 0) for (int s2 = 1; s2 < TF_SK; s2++) for (int i = 0; i < 16; i++) C[i] += part[((tp * (TF_SK - 1) + s2 - 1) * 16 + i) * 32 + lane];
}
if (ks == 0)
for (int i = 0; i < 16; i++) {
const int m = mb + 8 * ((i >> 2) & 1), n = n0 + nb + 16 * (i >> 3) + (i & 3);
if (m < M && n < TF_N) Y[(size_t)m * TF_YS + n] = static_cast<TF_OUT>(C[i]);
}
if (ks != 0) return;
#ifdef TF_EPILOGUE
tf_epilogue(fa, C, M, mb, n0 + nb, tile, Y); // the family's store of the lane's 16 accumulators
#else
for (int i = 0; i < 16; i++) {
const int m = mb + 8 * ((i >> 2) & 1), n = n0 + nb + 16 * (i >> 3) + (i & 3);
if (m < M && n < TF_N) Y[(size_t)m * TF_YS + n] = static_cast<TF_OUT>(C[i]);
}
#endif
}
#endif
Loading
Loading