Request
PR #20244 adds the fused Metal kernel for GGML_OP_GATED_DELTA_NET (autoregressive path). The chunked/prompt processing path (fused_gdn_ch) is still // TODO: implement in llama-context.cpp:154.
Without fused_gdn_ch, prompt processing falls back to decomposed Metal ops (23 kernels per DeltaNet layer), which produce NaN on Apple GPU Family 7 (A14 Bionic). Implementing fused_gdn_ch would likely bypass these decomposed ops and is the most probable path to fixing this — though we haven't been able to verify this since the chunked path doesn't exist yet.
Context
Qwen3.5-2B (6 attention + 18 Gated DeltaNet layers) works correctly on A17 Pro (GPU Family 9) but produces NaN logits during prompt eval on A14 (GPU Family 7). llama_decode() returns 0, but all logits are NaN.
We tested PR #20244 built as a custom xcframework on A14. The fused AR kernel is recognized, but prompt processing still uses the decomposed path and produces NaN — confirming the issue is specifically in the chunked/prompt eval code path.
Other findings:
- CPU-only inference works on A14 — Metal kernel issue, not a model issue
- Qwen3-1.7B (no DeltaNet) works on A14 Metal — A14 Metal is fine for standard transformers
- Disabling flash attention and reducing batch size don't help
The decomposed kernels involved include kernel_solve_tri_f32, kernel_cumsum_blk_f32, kernel_ssm_conv_f32_f32_batched_4, kernel_tri_f32_2/3, kernel_l2_norm_f32_f32_4.
Environment
- Failing: iPad Gen 10 (A14, GPU Family 7), iPadOS 26.3.1, b8253
- Working: iPad Mini 7 (A17 Pro, GPU Family 9), same build
- Model: Qwen3.5-2B Q4_K_M
Related
Request
PR #20244 adds the fused Metal kernel for
GGML_OP_GATED_DELTA_NET(autoregressive path). The chunked/prompt processing path (fused_gdn_ch) is still// TODO: implementinllama-context.cpp:154.Without
fused_gdn_ch, prompt processing falls back to decomposed Metal ops (23 kernels per DeltaNet layer), which produce NaN on Apple GPU Family 7 (A14 Bionic). Implementingfused_gdn_chwould likely bypass these decomposed ops and is the most probable path to fixing this — though we haven't been able to verify this since the chunked path doesn't exist yet.Context
Qwen3.5-2B (6 attention + 18 Gated DeltaNet layers) works correctly on A17 Pro (GPU Family 9) but produces NaN logits during prompt eval on A14 (GPU Family 7).
llama_decode()returns 0, but all logits are NaN.We tested PR #20244 built as a custom xcframework on A14. The fused AR kernel is recognized, but prompt processing still uses the decomposed path and produces NaN — confirming the issue is specifically in the chunked/prompt eval code path.
Other findings:
The decomposed kernels involved include
kernel_solve_tri_f32,kernel_cumsum_blk_f32,kernel_ssm_conv_f32_f32_batched_4,kernel_tri_f32_2/3,kernel_l2_norm_f32_f32_4.Environment
Related