mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5347] [Engine] Native Flint 40B MoE backend with Batched TC GEMM & 256K 3-Tier KV Ring Buffer #5398
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5398
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5347
Author: @Andgihat
Created: 11/5/2026
Status: 🔄 Open
Base:
main← Head:feat/flint-native-engine📝 Commits (10+)
3113b56feat: native C++/CUDA inference engine for Flint 40B Preview (sm_120)7e14ee4feat(flint): implement hardware-accelerated Q8_0 KV cache (4x compression)1cdfe69fix(flint): use IEEE-754 rintf and full [-128, 127] range for Q8_0 KV cache5958634docs(flint): add Universal Fat Binary build instructionsb983b22feat(flint): add multi-token parse support in serve mode and synthetic prompt benchmarkinga48b373perf(flint): implement hardware-accelerated batched Tensor Core GEMM for prefill and sliding window early-exita30f2d0feat(flint): implement Batched Tensor Core Attention in prefill and 3-Tier 256K KV Cache03fb68afeat(flint): implement CUDA Graph capture and replay for single-token decode1889df2feat(flint): add dynamic adaptive expert swapping, usage profiling, and miss zeroingeab99c9docs(flint): update architecture plan and benchmark results for Stages 1-5📊 Changes
24 files changed (+151949 additions, -12 deletions)
View changed files
📝
.gitignore(+2 -0)📝
CMakeLists.txt(+16 -0)📝
README.md(+48 -0)➕
data/flint_tokenizer/chat_template.jinja(+61 -0)➕
data/flint_tokenizer/merges.txt(+149744 -0)➕
data/flint_tokenizer/token_type.json(+1 -0)➕
data/flint_tokenizer/tokenizer.json(+14 -0)➕
data/flint_tokenizer/vocab.json(+1 -0)➕
docs/FLINT_ARCHITECTURE_PLAN.md(+78 -0)📝
include/strata/artifact/gguf_reader.hpp(+16 -0)📝
include/strata/artifact/model_family.hpp(+6 -0)➕
include/strata/flint/engine.hpp(+13 -0)➕
include/strata/flint/sampling.hpp(+32 -0)📝
setup.py(+9 -0)➕
src/flint/flint_engine.cu(+1199 -0)➕
src/flint/flint_kernels.cuh(+594 -0)➕
src/flint/flint_main.cpp(+6 -0)📝
src/kernels/cuda/iq_kernels.cu(+2 -2)📝
src/prefill/mmq_kq_lib.cu(+4 -4)📝
src/prefill/mmq_nvfp4_w4a4.cu(+2 -1)...and 4 more files
📄 Description
Problem and result
Problem: The Flint 40B Preview MoE model (40B parameters, 256 experts, top-6 routed + 2 shared, 49 layers) was previously unsupported in Strata, and on consumer GPUs (12–16 GB VRAM) running long context (up to 256K) caused out-of-memory (OOM) crashes in other frameworks. Furthermore, prefill on standard split-K kernels took ~320 ms per chunk (~422 tok/s), and decode suffered from host driver kernel launch overhead (~71 tok/s).
Result: With this change, Strata gains native high-throughput support for Flint 40B MoE:
cublasGemmStridedBatchedEx).cudaGraphExec_t).strata launch --family flint --model flint-40b --context 256k.Approach
src/flint/andinclude/strata/flint/, preserving full backwards compatibility and architectural isolation with existing Qwen (src/qwen35/) and DeepSeek (src/dsv41/) backends.cublasGemmStridedBatchedExpattern.--max-contextand--kv-resident(32,768), pinning attention sinks (tokens 0..3) in VRAM while sliding the ring across page-locked host memory.k_count_usage) for dynamic adaptive expert swapping (rebalance()).--family flintandFlint-40Binsetup.py,strata_cli/launch/adopt.py, andstrata_control/models.py.Key Mechanisms & Architecture
cublasGemmStridedBatchedEx):--max-context(up to 262,144) and--kv-resident(32,768).cudaGraphExec_t).k_count_usage) and safely balances resident expert slots without rebuilding graphs or stalling generation.strata launch):--family flint --model flint-40b.--model-pathwith automatic GGUF architecture detection (flint).Benchmarks (NVIDIA RTX 5060 Ti 16GB, Blackwell sm_120)
Prefill Throughput
Decode Throughput
Validation
CMake -B build -G "Visual Studio 17 2022" -DSTRATA_HAVE_FLINT=1on CUDA 12.8 / 13.0 (MSVC v143, fat binary targetingsm_75,sm_86,sm_89,sm_120). Compiled successfully with 0 warnings insrc/flint/.flint-UD-Q3_K_XL.gguf: 256K context executed with 0 VRAM errors (13.5 GiB peak VRAM).strata launch --model-path E:\AI-models\models\flint\flint-UD-Q3_K_XL.gguf --family flint --context 256k --planpasses with proper auto-detection.READY,PP,GEN,RESETcommands.Limits
sm_75and newer, Turing through Blackwell).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.