MATE Gated Delta Network (GDN) Support Matrix¶
This document provides a comprehensive overview of the Gated Delta Network (GDN) features, data types, and execution backends currently supported in MATE. Use this matrix to verify configuration compatibility for production deployment and optimization.
Overview¶
MATE provides optimized kernels for Gated Delta Networks (GDN). MATE splits GDN execution into two primary phases:
Prefill: high-throughput processing of prompt contexts.
Decode: low-latency generation, including standard single-token streaming and multi-token prediction (MTP).
Decode¶
Dispatch Matrix¶
|
|
|
Status |
Notes |
|---|---|---|---|---|
|
|
|
✅ Supported |
TileLang decode with FP32 accumulation |
|
|
|
✅ Supported |
TileLang MTP path, currently K=V=128 |
|
|
|
✅ Supported |
Current active decode path |
|
|
|
✅ Supported |
TileLang MTP path, currently K=V=128 |
|
|
|
❌ Not supported |
KV backend is not implemented yet |
|
anything else |
any |
❌ Not supported |
Unsupported combination |
Current MATE Active Path¶
Current MATE decode support is intentionally narrow:
API:
mate.gated_delta_rule_decode(...)Supported combinations:
state_layout="VK",state.dtype=float32,T=1state_layout="VK",state.dtype=bfloat16,T=1state_layout="VK",state.dtype=float32,T>1,K=V=128state_layout="VK",state.dtype=bfloat16,T>1,K=V=128
Backend: TileLang
State update: in place
Current MATE Restrictions¶
Item |
MATE |
|---|---|
|
✅ Supported on VK decode and VK MTP; negative entries are padding |
BF16 state backend |
✅ Supported on VK decode and MTP ( |
KV backend |
❌ Not supported |
MTP ( |
✅ Supported for VK float32/bfloat16 state with K=V=128 |
|
✅ Supported on VK MTP; dtype must match |
|
✅ Supported on VK MTP |
Input Contract on the Active Path¶
On the currently supported MATE path:
q / k / v:float16orbfloat16A_log:float32dt_bias:float32orbfloat16a / b: same dtype asqstate:float32orbfloat16for single-token decode and MTPintermediate_states_buffer: same dtype asstateoutput: optional, supportsfloat16/bfloat16/float32
Prefill¶
Prefill At a Glance¶
Area |
Status |
Notes |
|---|---|---|
Backend |
✅ Supported |
FlashInfer-aligned native MP31 prefill path on MUSA via |
Sequence Mode |
✅ Supported |
Dense prefill without |
Head Layout |
✅ Supported |
|
Dtype (Q/K/V) |
✅ Supported |
|
Gate Inputs |
✅ Supported |
|
Gate Space |
✅ Supported |
|
Initial State |
✅ Supported |
Optional |
Final State Output |
✅ Supported |
|
Output Heads |
✅ Supported |
|
QK L2 Norm Option |
✅ Supported |
|
Strided Q/K/V |
✅ Supported |
Split-QKV views are supported when the last dimension is contiguous ( |
Prefill Shape Rules¶
H_qk is the number of Q/K heads, H_v is the number of value/output heads,
and D is the current Q/K/V head dimension.
Input or output |
Dense |
Varlen |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
Cumulative sequence lengths with shape |
Output |
|
|
For both modes:
Q, K, and V must have the same token count and Q and K must have the same head dimension.
GQArequiresnum_v_heads == num_k_headsandnum_q_heads % num_k_heads == 0.GVArequiresnum_q_heads == num_k_headsandnum_v_heads % num_q_heads == 0.chunk_sizemust be exactly64on the current native path.Q, K, and V may be non-contiguous split views, but each must satisfy
stride(-1) == 1.If
use_qk_l2norm_in_kernel=True, Q and K are modified in place before the KKT solve and fused prefill launch.No decay (
g=0in log space, org=1in alpha space) remains causal: a token cannot attend to future tokens with an equal gate prefix.Inputs with zero tokens return an empty output without launching the normalization, KKT, or fused prefill kernels. When requested, the final state equals
initial_state, or is zero when no initial state is supplied; a preallocatedoutput_stateis populated in place.
Minimal Dense Prefill Example¶
Dense prefill uses 4D Q/K/V tensors and does not provide cu_seqlens:
import torch
import mate
batch_size, num_tokens = 2, 128
num_qk_heads, num_v_heads, head_dim = 2, 2, 128
q = torch.randn(
batch_size,
num_tokens,
num_qk_heads,
head_dim,
device="musa",
dtype=torch.float16,
)
k = torch.randn_like(q)
v = torch.randn(
batch_size,
num_tokens,
num_v_heads,
head_dim,
device="musa",
dtype=torch.float16,
)
# g is log(alpha) because is_log_space defaults to True.
g = torch.zeros(
batch_size, num_tokens, num_v_heads, device="musa", dtype=torch.float32
)
beta = torch.ones_like(g)
output, final_state = mate.gdn_prefill.chunk_gated_delta_rule(
q=q,
k=k,
v=v,
g=g,
beta=beta,
cu_seqlens=None,
output_final_state=True,
)
assert output.shape == (batch_size, num_tokens, num_v_heads, head_dim)
assert final_state.shape == (
batch_size,
num_v_heads,
head_dim,
head_dim,
)
Current Kernel Constraints¶
Item |
Status |
Notes |
|---|---|---|
|
✅ Required |
Native MP31 kernel currently supports |
|
✅ Required |
Native MP31 kernel currently supports |
|
✅ Required |
Current native path is fixed to |
Device |
✅ Required |
MUSA on MP31 |
Not Supported Yet (Prefill)¶
Feature |
Status |
Notes |
|---|---|---|
Non-GQA/GVA head mapping |
❌ Not supported |
Only the two grouped layouts above are accepted |
Notes¶
Public API entry:
mate.gdn_prefill.chunk_gated_delta_rule.use_qk_l2norm_in_kernel=Trueis an in-place operation on the input Q and K tensors. Pass cloned tensors if the original unnormalized values are still needed after the call.Strided support is intended for fused/split QKV layouts such as a single physical
[tokens, qkv_dim]allocation split into Q, K, and V views. Arbitrary layouts with a non-contiguous last dimension are not supported.