Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f9fc1a7
glm: group-limited top-k routing (Ling's 8 groups, keep 4) and a per-…
jschmied Oct 15, 2026
a655957
ling: Ling-3.1-flash's config loader and weight map, its routing and …
jschmied Oct 15, 2026
d46e372
ling: weights in the checkpoint's own format (bf16, FP8 blocks, Model…
jschmied Oct 15, 2026
faf7af1
docs: Ling-3.1-flash recipe: what exists, what is missing, testing wi…
jschmied Oct 15, 2026
7d184cb
glm: MLA kernels take Ling-3.1's shape: 64 roped key columns, 128-wid…
jschmied Oct 15, 2026
ef8f12f
glm: KDA serves Ling-3.1 as is (real layer 0 vs fla and float64); an …
jschmied Oct 15, 2026
6f583ba
ling: the TP=1 layer graph in any loaded format: KDA and MLA mixers, …
jschmied Oct 15, 2026
bfb44dd
ling: SwiGLU clamp in Ling's order, min(silu(g), L) * clip(u, -L, L)
jschmied Oct 15, 2026
2a5e1b6
tests: zig fmt ling_mla_real.zig
jschmied Oct 15, 2026
a3f14d3
ling: served through the lane core at TP=1: engine, lane backend, ser…
jschmied Oct 15, 2026
577436b
ling: the MTP layer (model.layers.72) drafts: enorm | hnorm through e…
jschmied Oct 15, 2026
7bd7a40
tests: ling-pack times one MoE layer's expert load (read, pack, cold)…
jschmied Oct 15, 2026
bbe360f
ling: routed experts staged in batches through pinned memory and pack…
jschmied Oct 15, 2026
412f66f
tests: ling-layer-speed times one real layer whole and op by op per p…
jschmied Oct 15, 2026
99652ba
ling: row copies 16 bytes a thread on aligned rows (prompt KDA and ML…
jschmied Oct 15, 2026
b3faea6
ling: a single decode row's projections write their columns in place,…
jschmied Oct 15, 2026
5b00637
ling: FP8 prompt chunks under 16 routed pairs an expert run the decod…
jschmied Oct 15, 2026
e78d23b
glm: group-limited select without divisions where groups are whole la…
jschmied Oct 15, 2026
0ffce4f
tests: ling-layer-speed takes a rows list, times prompt ops from an i…
jschmied Oct 15, 2026
bd7c23e
tests: ling-layer-speed starts each rep after a random spin (tf_probe…
jschmied Oct 15, 2026
32055e9
glm: swiglu keeps GLM's limit as given; only Ling's swigluWith maps 0…
jschmied Oct 15, 2026
991383f
glm: swigluWith's doc comment within 120 columns
jschmied Oct 15, 2026
03171bf
glm: drop the opt-in 16-row chunked KDA prompt path; GLM's cuda_kda.z…
jschmied Oct 15, 2026
66579cb
ling: config refuses every geometry the kernels don't take, at load, …
jschmied Oct 16, 2026
92afed6
ling: routing groups of one and a single pick refused at load; one gr…
jschmied Oct 16, 2026
674163f
ling: Store.alloc owns a buffer only once it is in both lists; a fake…
jschmied Oct 16, 2026
0ba510a
ling: a new stream's slot is chosen before its map entry exists (lane…
jschmied Oct 16, 2026
82b3817
ling: rows past a sequence's capacity are refused before any layer ru…
jschmied Oct 16, 2026
0ba2adf
ling: Engine.init frees its sequences when binding slot 0 or the last…
jschmied Oct 16, 2026
5649c63
ling: every tensor of the full checkpoint checked against the loader'…
jschmied Oct 16, 2026
e4c9bcc
oracle: the Ling oracles check their HF source against inclusionAI/Li…
jschmied Oct 16, 2026
5e931c3
ling: a segment the scratch cannot hold is refused before any layer r…
jschmied Oct 16, 2026
1395e26
ling: staging and loaded weights freed only after the stream drains; …
jschmied Oct 16, 2026
e99e650
docs/recipes/ling-3.1: file names for hashes the rebase changed, curr…
jschmied 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
ling: SwiGLU clamp in Ling's order, min(silu(g), L) * clip(u, -L, L)
Ling's reference (inclusionAI's SwigluStepAndMul, SGLang's BailingMoeV3MLP)
clamps silu's output; GLM's glue and the grouped expert kernels clamp the
gate before silu. Ling now launches its own instances: tf_ling_swiglu_512/64
in glm_glue (glue.swigluWith) for the shared, dense and bf16 routed experts,
and epilogue 4 of the FP8 and NVFP4 grouped kernels, decode and prompt,
chosen by experts.Layer.after (set by the Ling loader, refused by affine4).

Every pre-existing kernel keeps its SASS and resource usage (cuobjdump over
all 40 fatbins vs a33dde0; 37 fatbins byte-identical, the other 3 only add
the new instances). ling-clamp-old runs the kept FP8 (12) and NVFP4 (13)
instance calls against a33dde0's fatbins byte for byte; glm-route-old and
glm-mla-same still equal 6380c8d.

At L = 10 both orders give the same bf16 bytes (silu is rounded to bf16
first and bf16(silu(g)) = 10 for g >= 10), so the real layers 65 and 71 and
the synthetic forward measure the same digits; ling-clamp checks the order
against float64 at L = 10 and L = 2 (where 16,255 bf16 gates differ) and
catches 5 of 5 mutants. The float64 oracle clamps after silu too.
  • Loading branch information
jschmied committed Oct 16, 2026
commit bfb44ddc505e1e3022065e3d50c262f31feaf271
26 changes: 24 additions & 2 deletions docs/recipes/ling-3.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ block FP8 (e4m3 in 128 x 128 blocks with `weight_scale_inv`).
| Weight loader at TP=1: bf16, FP8 block, ModelOpt NVFP4 | `zig/src/families/ling/weights.zig`, `weights_proj.zig` | `ling-weights`, `ling-weights-real` |
| Synthetic checkpoints in all three formats | `tf-cuda-test ling-synth` | its own name check |
| The TP=1 layer graph: embedding, KDA/MLA mixers, dense MLP and MoE, final norm, head; windows and commits | `zig/src/families/ling/forward.zig`, `graph.zig`, `state.zig`, `block_*.zig`, `kernels/cuda/ling_glue.cu` | `ling-forward-synth`, `ling-layer-real` |
| SwiGLU clamped in Ling's order, `min(silu(g), L) * clip(u, -L, L)`, in the glue and the FP8/NVFP4 grouped experts (every older kernel's SASS unchanged) | `glm_glue_moe.cuh` (`tf_ling_swiglu_*`), `experts.cuh` (epilogue 4), `experts.Layer.after` | `ling-clamp`, `ling-clamp-old`, `glm-route-old` |

## The layer graph

Expand Down Expand Up @@ -67,6 +68,7 @@ Real layers of the FP8 release (`ling-layer-real`, the HF bf16 chain's captured
| 0 | KDA, dense | 3.27e-3 | - | 3.27e-3 | 3.12e-3 | 0.9 GB |
| 4 | KDA, MoE | 5.88e-3 | 21 | 3.13e-3 | 4.28e-3 | 8.5 GB |
| 7 | MLA, MoE | 4.89e-3 | 17 | 3.05e-3 | 3.57e-3 | 8.3 GB |
| 65 | KDA, MoE, limits 10 | 4.85e-3 | 14 | 3.35e-3 | 3.33e-3 | 8.5 GB |
| 71 | MLA, MoE, limits 10 | 4.13e-3 | 7 | 3.75e-3 | 3.89e-3 | 8.3 GB |

exllamav3's port measured 0.4-1.1e-3 without flips (4 flips each on layers 4 and 7) on the same chain: it keeps fp16
Expand Down Expand Up @@ -94,15 +96,33 @@ both formats. Each projection loads as a `qlinear.Weight` (`bf16`, `fp8g` or `nv
`Fp8Experts`/`Nvfp4Experts`). There is no grouped bf16 expert kernel, so bf16 routed experts load as one lane weight
per projection. The router must be bf16 (GLM's router kernel reads bf16); a quantized router is refused.

### The SwiGLU clamp

Layers 64-71 clamp the shared expert and layers 65-71 the routed experts at L = 10 as inclusionAI's vLLM
(`SwigluStepAndMul`) and SGLang (`BailingMoeV3MLP`) do: `min(silu(g), L) * clip(u, -L, L)`, the limit on SiLU's output.
GLM's glue and the grouped expert kernels clamp the gate before SiLU, so Ling launches its own instances: the glue's
`tf_ling_swiglu_512`/`_64` (`glue.swigluWith`) for the shared expert, dense and bf16 routed experts, and epilogue 4 of
the FP8 and NVFP4 grouped kernels (decode and prompt), chosen by `experts.Layer.after`, which the Ling loader sets.
Every kernel that existed before has the same SASS and resource usage as at a33dde0c (`cuobjdump`, all 40 fatbins);
`ling-clamp-old` runs the kept FP8 (12 calls) and NVFP4 (13 calls) instances against a33dde0c's fatbins byte for byte.

At L = 10 the two orders give the same bf16 bytes: the kernels (and HF's bf16 `act_fn`) round SiLU to bf16 first, and
bf16(silu(g)) is 10 for every bf16 g >= 10. They differ at small limits (L = 2: 16,255 of the 65,536 bf16 gates).
`ling-clamp DIR` checks Ling's order against float64 at L = 10 and L = 2 on gates and ups straddling L: the glue at
widths 1024 and 704 (worst 0.93 of 2^-7 relative; 0 bytes differ from GLM's order at 10, 6,794 at 2) and the clamped
layer's grouped gate-up, decode and prompt rows (FP8 worst 0.090, NVFP4 0.102 of the bound). a33dde0c's binary and
this one print the same digits on the real layers (71: rel L2 4.125e-3, 3.747e-3 without 7 flipped rows, decode rows
3.893e-3; 65: 4.851e-3, 3.347e-3 without 14, 3.325e-3) and on the synthetic forward in all three formats, whose
float64 references do not change either (the synthetic clamped layer never reaches g > 10). HF's clamp itself moves
layer 71's output by 3.7e-3 (rel L2 against the unclamped layer) and layer 65's by 0 on these 512 tokens.

## What is missing

- Lanes hooks (drafted, concurrent and cut-prompt windows) for Ling: the graph has the pieces (segments, windows,
`commit(keep)`), nothing schedules them yet. Sampling, the server and a full-checkpoint run are not wired.
- MTP drafting: the MTP layer's tensors load (`weights.Mtp`); the graph leaves it unwired. It would be
`enorm(embed(next)) | hnorm(hidden)` through `eh_proj`, one MLA + MoE layer on its own cache, the final norm and
the shared head.
- The SwiGLU limit clamps the gate before SiLU (`silu(min(g, 10))`, the grouped expert kernels' and GLM's rule);
the Ling reference clamps after (`min(silu(g), 10)`). They differ by at most 4.5e-4 on a clamped element.
- Speed: nothing is tuned. Projections land in their columns through a byte copy, bf16 routed experts run densely,
and the RMS norms take hidden and `q_lora_rank` widths 512, 1536 and 4096 only (`glue.rmsnorm`).
- EXL3, through ashhart's EXL3 module (tracker #832).
Expand All @@ -120,6 +140,8 @@ python zig/tests/cuda/oracle/ling_forward.py /tmp/ling-fp8 /tmp/ref
zig-out/bin/tf-cuda-test ling-forward-synth /tmp/ling-fp8 /tmp/ref /tmp/picks # exactness; writes the picks
python zig/tests/cuda/oracle/ling_forward.py /tmp/ling-fp8 /tmp/fref --picks /tmp/picks
zig-out/bin/tf-cuda-test ling-forward-synth /tmp/ling-fp8 /tmp/fref # same picks: logits bounded
zig-out/bin/tf-cuda-test ling-clamp /tmp/ling-fp8 # Ling's SwiGLU order vs float64, L 10 and 2
zig-out/bin/tf-cuda-test ling-clamp-old /tmp/ling-fp8 OLD/fatbin # kept expert instances vs an older build's bytes
```

`ling-synth` writes `config.json` (the real file's schema) and `model.safetensors` with the real key names: hidden 512,
Expand Down
14 changes: 14 additions & 0 deletions zig/kernels/cuda/experts.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ __device__ __forceinline__ float swiglu(float g, float u, float limit) {
return bf(gv / (1.f + expf(-gv))) * uv;
}

// Ling's order (EPI 4): the limit on silu's output, min(silu(g), L) * clip(u, -L, L).
__device__ __forceinline__ float swiglu_after(float g, float u, float limit) {
const float gv = bf(g);
float uv = bf(u), s = bf(gv / (1.f + expf(-gv)));
if (limit > 0.f) {
s = fminf(s, limit);
uv = fminf(fmaxf(uv, -limit), limit);
}
return s * uv;
}

__device__ __forceinline__ float relu2(float a) {
const float u = fmaxf(bf(a), 0.f);
return u * u;
Expand All @@ -88,6 +99,9 @@ __device__ __forceinline__ void epilogue(const float (&acc)[M][RT][NTW][4], int
} else if constexpr (EPI == 2) {
o0 = swiglu(a0, acc[M - 1][r][j][2 * h], limit);
o1 = swiglu(a1, acc[M - 1][r][j][2 * h + 1], limit);
} else if constexpr (EPI == 4) {
o0 = swiglu_after(a0, acc[M - 1][r][j][2 * h], limit);
o1 = swiglu_after(a1, acc[M - 1][r][j][2 * h + 1], limit);
} else {
o0 = a0;
o1 = a1;
Expand Down
4 changes: 3 additions & 1 deletion zig/kernels/cuda/fp8_experts.cu
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,13 @@ __global__ void __launch_bounds__(PWARPS * 32, PMIN)
}
}

// The instances fp8_experts_cuda and fp8_experts_prompt_cuda launch: SwiGLU gate-up, fp32 and bf16 down.
// The instances: SwiGLU gate-up (EPI 4 in Ling's clamp order), fp32 and bf16 down; decode and prompt forms.
template __global__ void fp8_expert_kernel<2, 2, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_kernel<2, 4, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_kernel<1, 0, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_kernel<1, 3, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_prompt_kernel<2, 2, 2, 2>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_prompt_kernel<2, 4, 2, 2>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_prompt_kernel<1, 0, 4, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void fp8_expert_prompt_kernel<1, 3, 4, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
}
67 changes: 39 additions & 28 deletions zig/kernels/cuda/glm_glue_moe.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ __device__ __forceinline__ float group64(const float* q) {
return g;
}

// AFTER false: GLM's silu(min(g, L)); true: Ling's min(silu(g), L) (inclusionAI's SwigluStepAndMul). Both clip u.
template <bool AFTER>
__device__ __forceinline__ float swiglu1(float g, float u, float limit) {
g = fminf(g, limit);
if (!AFTER) g = fminf(g, limit);
u = fminf(fmaxf(u, 0.0f - limit), limit);
const float s = rbf(div_full(g, exp_approx(0.0f - g) + 1.0f));
float s = rbf(div_full(g, exp_approx(0.0f - g) + 1.0f));
if (AFTER) s = fminf(s, limit);
return rbf(__fmul_rn(u, s));
}

Expand Down Expand Up @@ -68,35 +71,43 @@ __device__ __forceinline__ void keep_groups(float* choice, int lane, int ne, int
} // namespace glm_moe

// glue._swiglu with BLOCK 512 (128 threads, 4 values each, 64-group sums over 16 lanes), column block blockIdx.y.
extern "C" __global__ void __launch_bounds__(128)
tf_glm_swiglu_512(const __nv_bfloat16* gu, __nv_bfloat16* out, float* xs, float limit, int64_t w) {
const int64_t r = blockIdx.x, d0 = blockIdx.y * 512 + threadIdx.x * 4;
const uint2 gv = *reinterpret_cast<const uint2*>(gu + r * 2 * w + d0);
const uint2 uv = *reinterpret_cast<const uint2*>(gu + r * 2 * w + w + d0);
const __nv_bfloat16* gh = reinterpret_cast<const __nv_bfloat16*>(&gv);
const __nv_bfloat16* uh = reinterpret_cast<const __nv_bfloat16*>(&uv);
float a[4];
uint2 ov;
__nv_bfloat16* oh = reinterpret_cast<__nv_bfloat16*>(&ov);
for (int j = 0; j < 4; ++j) {
a[j] = glm_moe::swiglu1(bf(gh[j]), bf(uh[j]), limit);
oh[j] = __float2bfloat16_rn(a[j]);
#define TF_GLM_SWIGLU_512(NAME, AFTER) \
extern "C" __global__ void __launch_bounds__(128) \
NAME(const __nv_bfloat16* gu, __nv_bfloat16* out, float* xs, float limit, int64_t w) { \
const int64_t r = blockIdx.x, d0 = blockIdx.y * 512 + threadIdx.x * 4; \
const uint2 gv = *reinterpret_cast<const uint2*>(gu + r * 2 * w + d0); \
const uint2 uv = *reinterpret_cast<const uint2*>(gu + r * 2 * w + w + d0); \
const __nv_bfloat16* gh = reinterpret_cast<const __nv_bfloat16*>(&gv); \
const __nv_bfloat16* uh = reinterpret_cast<const __nv_bfloat16*>(&uv); \
float a[4]; \
uint2 ov; \
__nv_bfloat16* oh = reinterpret_cast<__nv_bfloat16*>(&ov); \
for (int j = 0; j < 4; ++j) { \
a[j] = glm_moe::swiglu1<AFTER>(bf(gh[j]), bf(uh[j]), limit); \
oh[j] = __float2bfloat16_rn(a[j]); \
} \
*reinterpret_cast<uint2*>(out + r * w + d0) = ov; \
const float g = glm_moe::group64<4>(a); \
if ((threadIdx.x & 15) == 0) xs[r * (w / 64) + d0 / 64] = g; \
}
*reinterpret_cast<uint2*>(out + r * w + d0) = ov;
const float g = glm_moe::group64<4>(a);
if ((threadIdx.x & 15) == 0) xs[r * (w / 64) + d0 / 64] = g;
}

// glue._swiglu with BLOCK 64 (the TP=3 shared expert's 704): one value a thread, the warp's butterfly, then 2 warps.
extern "C" __global__ void __launch_bounds__(64)
tf_glm_swiglu_64(const __nv_bfloat16* gu, __nv_bfloat16* out, float* xs, float limit, int64_t w) {
__shared__ float smem[2];
const int64_t r = blockIdx.x, d = blockIdx.y * 64 + threadIdx.x;
const float a = glm_moe::swiglu1(bf(gu[r * 2 * w + d]), bf(gu[r * 2 * w + w + d]), limit);
out[r * w + d] = __float2bfloat16_rn(a);
const float g = block_sum<2>(a, smem);
if (threadIdx.x == 0) xs[r * (w / 64) + blockIdx.y] = g;
}
#define TF_GLM_SWIGLU_64(NAME, AFTER) \
extern "C" __global__ void __launch_bounds__(64) \
NAME(const __nv_bfloat16* gu, __nv_bfloat16* out, float* xs, float limit, int64_t w) { \
__shared__ float smem[2]; \
const int64_t r = blockIdx.x, d = blockIdx.y * 64 + threadIdx.x; \
const float a = glm_moe::swiglu1<AFTER>(bf(gu[r * 2 * w + d]), bf(gu[r * 2 * w + w + d]), limit); \
out[r * w + d] = __float2bfloat16_rn(a); \
const float g = block_sum<2>(a, smem); \
if (threadIdx.x == 0) xs[r * (w / 64) + blockIdx.y] = g; \
}

TF_GLM_SWIGLU_512(tf_glm_swiglu_512, false)
TF_GLM_SWIGLU_64(tf_glm_swiglu_64, false)
// Ling's order, the limit on silu's output: min(silu(g), L) * clip(u, -L, L).
TF_GLM_SWIGLU_512(tf_ling_swiglu_512, true)
TF_GLM_SWIGLU_64(tf_ling_swiglu_64, true)

// qmm._group_sums: row blockIdx.x's 64-input sums, 8 lanes a group of 8 consecutive inputs each, 16 groups a block.
extern "C" __global__ void __launch_bounds__(128)
Expand Down
6 changes: 4 additions & 2 deletions zig/kernels/cuda/nvfp4_experts.cu
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,15 @@ __device__ __forceinline__ void prompt_body(const __nv_bfloat16* __restrict__ X,
#undef TF_TILES
}

// The instances: SwiGLU gate-up, fp32 and bf16 down, and relu^2 up for experts without a gate (Nemotron).
// The instances: SwiGLU gate-up (EPI 4 in Ling's order), fp32 and bf16 down, relu^2 up without a gate (Nemotron).
template __global__ void nvfp4_expert_kernel<2, 2, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void nvfp4_expert_kernel<2, 4, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void nvfp4_expert_kernel<1, 0, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void nvfp4_expert_kernel<1, 3, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
template __global__ void nvfp4_expert_kernel<1, 1, 4>(const __nv_bfloat16* __restrict__, int, int, const uint4* __restrict__, const float* __restrict__, int, int, const int* __restrict__, const int* __restrict__, const int* __restrict__, void* __restrict__, int, float, int);
}

// The prompt form's entries, 4 row tiles a warp in one row of WN warps: relu^2 up, SwiGLU gate-up, bf16 sums down.
// The prompt form's entries, 4 row tiles a warp in a row of WN warps: relu^2 up, SwiGLU gate-up (2 orders), down.
#define TF_NVFP4_PROMPT(NAME, M, EPI, WN) \
extern "C" __global__ void __launch_bounds__(WN * 32) NAME( \
const __nv_bfloat16* __restrict__ X, int x_stride, int slots, const uint4* __restrict__ W, \
Expand All @@ -329,3 +330,4 @@ template __global__ void nvfp4_expert_kernel<1, 1, 4>(const __nv_bfloat16* __res
TF_NVFP4_PROMPT(tf_nvfp4_prompt_relu2, 1, 1, 8)
TF_NVFP4_PROMPT(tf_nvfp4_prompt_swiglu, 2, 2, 4)
TF_NVFP4_PROMPT(tf_nvfp4_prompt_down, 1, 3, 8)
TF_NVFP4_PROMPT(tf_nvfp4_prompt_swiglu_after, 2, 4, 4)
Loading