Repository navigation
Conversation
…l load
ggml-org NVFP4 Inkling-2 GGUFs store full-attention attn_{k,v}_conv_proj.weight
as Q8_0 (wtype > 2), which trips the megakernel eligibility guard in
agx-inkling2-target.cpp and forces the 1,800-dispatch fallback (~58 tok/s).
Unpack (via agx_repack_get_tensor when repacked) and losslessly dequantize
Q8_0 attn_{k,v}_conv_proj.weight tensors to F32 (0-ULP bit-exact via ggml
Q8_0 to_float, 2.25 MiB for 4 full-attention layers) into a single readonly
SLC-stream BO at model bind time, freeing it on rebind and engine destroy.
Pass the dequantized F32 VAs (AGX_WTYPE_F32) into both the Wave 61 MMA tail
and fallback attn_in dispatches so Inkling-2 hits the 48-pass megakernel.
Keep mmap and lazy_mode active for CPU-only tensors (such as Qwen4 per_layer_token_embd.weight) under --load-mode auto --lazy-mode auto even when the GPU device reports mmap_support == false, saving ~10.5 GiB anon RAM and ~9.6 GiB swap on Qwen4-35B-A3B Q8_0.
Add and optimize AGX3 compute kernels for Qwen4-35B-A3B Q8_0 and Q4_K_M: - Zero-bloat planar Q4_0_32x64 and Q4_K_PLANAR_32x256 supertile dequantization - High-occupancy Q8_0_8BLK Fused MoE (s5/s6, sequential gate->up pass, zero DRAM scale stalls, 0:0 spills) - Paired-stream zero-barrier DSV4_HC_PRE (EPILOGUE=2) and 2-row/WG K_SPLIT_ROW=2 Q8_0/BF16 GEMV - Sparse QSA D=256 FlashAttention MMA (with sh_kv WAR barrier and FP16 clamp), general tiled Coopmat MMA FA (d=1..128 for vision mmproj), and WY-chunked GDN.
…d hazards - Planar Q4_0/Q4_K repacking, Split-K M8_DIRECT, and Q8_0/BF16 GEMM/MoE dispatch tuning - 100% graph fusion hit rates across M=1..4 (hcpn, rtrg, rgrp, shdn, mres) via rotating rtr_io_bo, GDN rs_replay absorption (-120 server dispatches), multi-WG parallel ARGMAX/TOP_K, and zero-spill hc_post_norm/gdn_s128/shexp shaders - Offload mmproj IM2COL, UPSCALE, ROPE(VISION, d=72), and FLASH_ATTN_EXT(d=72) to AGX0 (-3.5-4.0 GiB anon RAM, 2.77x faster vision prefill) - 1-submit batched GPU sampler (agx_sample_batch_logits) and async D2D copy (agx_copy_tensor_bytes_async) - Respect GGML_TENSOR_FLAG_COMPUTE to skip unselected forward_select branches, bounds-check SET_ROWS, and raise CDM hazard-tracker caps (1024/2048).
…, and AGX sampler - GPU-resident h_nextn_dev handoff and single-submit fused Inject+Draft MTP (moving commit_pending_row off the sampling critical path) - Adaptive draft-mtp and batched 2x/4x MTP support in llama-server - Batched GPU sampling integration and small_graph_cache MTP key tracking in llama_context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings full Qwen4-35B-A3B (
Q8_0,Q4_K_M,MTP-Q8_0,MTP-Q4_0, andmmproj-Q8_0vision) support and bare-metal Apple M4 Max (40c AGX3) performance, memory, and correctness upgrades toggml-agx.Commits
ad6cdb5ggml-agx: dequantize Q8_0 attn_{k,v}_conv_proj weights to F32 at model loadca451c6qwen4exp: support Qwen4-35B-A3B model, QSA kpool, template, and parser testsadc9fa5model: preserve lazy mmap for CPU-only tensors when GPU lacks mmapmmapandlazy_modeactive for CPU-only tensors (per_layer_token_embd.weight) under--load-mode auto --lazy-mode auto, saving ~10.5 GiB anon RAM and ~9.6 GiB swap onQ8_0.3561fe2ggml-agx: add Qwen4 Q8_0/Q4 MoE, GEMM, FA/QSA, GDN, and vision kernelsQ4_0_32x64/Q4_K_PLANAR_32x256supertiles.Q8_0_8BLKFused MoE (s5/s6, sequentialgate -> uppass eliminating DRAM bank ping-pong, back-to-back scale loads eliminating in-order DRAM scoreboard stalls,0:0spills).EPILOGUE=2(DSV4_HC_PRE) and 2-row/WGK_SPLIT_ROW=2Q8_0/BF16GEMV (≤52 GPR32,ActSG=32).D=256FlashAttention MMA (fixing shared-memorysh_kvWAR race + FP16 clamp), general tiled Coopmat MMA FA (d=1..128formmproj), and WY-chunked GDN.9d039f4ggml-agx: optimize Qwen4 fusions, vision offload, batched sampler, and hazardsM=1..4(hcpn=80/80,rtrg=40/40,rgrp=40/40,shdn=40/40,mres=40/40) via rotating 128 KiBrtr_io_bo, GDNrs_replayabsorption (-120server dispatches), and multi-WG parallelARGMAX/TOP_K.mmprojIM2COL,UPSCALE,ROPE(VISION, d=72), andFLASH_ATTN_EXT(d=72)toAGX0(-3.5–4.0 GiBanon RAM, 2.77× faster vision prefill).agx_sample_batch_logits) and async D2D copy (agx_copy_tensor_bytes_async).GGML_TENSOR_FLAG_COMPUTEto skip unselectedggml_build_forward_selectbranches, bounds-checksSET_ROWS, and raises CDM hazard-tracker caps (1024/2048).e46a94bspeculative, server: add GPU-resident MTP, adaptive/batched draft-mtp, and AGX samplerh_nextn_devhandoff, single-submit fusedInject+DraftMTP (movingcommit_pending_rowoff the sampling critical path), adaptive and batched2x/4xdraft-mtp, and batched GPU sampling inllama-server.Verification & Benchmarks (Apple M4 Max 40c AGX3, NixOS bare-metal)
Correctness & Stability
0errors,0warnings (llama-server,llama-bench,llama-cli,test-backend-ops).test-backend-ops: 100% PASS acrossMUL_MAT(849/849),MUL_MAT_ID(731/731),FLASH_ATTN_EXT(2,408/2,408),TOP_K(476/476),ROPE(176/176),IM2COL(113/113),GATED_DELTA_NET(89/89),SET_ROWS(55/55),UPSCALE(24/24),DSV4_HC_POST(11/11),ARGMAX(7/7),DSV4_HC_PRE(6/6).SHADERDB:0:0spills across all modified/new shaders.GGML_AGX_HAZARD_CHECK=1):0hazards on long-prompt (pp > 2048) QSA +draft-mtp.Q8_0+MTP-Q8_0+mmproj-Q8_0): 210/210 OK (0HTTP 500s,0retries).Performance (
Qwen4-35B-A3B-GGUF:Q8_0,MTP-Q8_0,mmproj-Q8_0)llama-bench tg128:85.96 ± 0.15 tok/s(M=1REPLAY-M8GPU11.27 ms, prefillpp512–4096 = 1,304–1,324 tok/s).Coding,Multimodal,Knowledge Work, mean decode tok/s):dmax83.9384.0382.58105.93(1.26×)108.13(1.29×)106.58(1.29×)101.84(1.21×)106.45(1.27×)105.22(1.27×)88.05(1.05×)95.01(1.13×)92.07(1.11×)75.73(0.90×)81.33(0.97×)81.62(0.99×)64.35(0.77×)68.58(0.82×)67.91(0.82×)100.51(1.20×)106.04(1.26×)103.55(1.25×)-c 131072 -ctk q8_0 -ctv q8_0 --cache-ram 0):RssAnon = 279 MiB(-13.45 GiBvs pre-optimization),GPU user_committed = 43.2 GiB.