Skip to content

Integrate Fireworks KV-outer sparse prefill (fireworks-msa)#7

Closed
ipiszy wants to merge 2 commits into
MiniMax-AI:mainfrom
ipiszy:fireworks-msa
Closed

Integrate Fireworks KV-outer sparse prefill (fireworks-msa)#7
ipiszy wants to merge 2 commits into
MiniMax-AI:mainfrom
ipiszy:fireworks-msa

Conversation

@ipiszy

@ipiszy ipiszy commented Jul 25, 2026

Copy link
Copy Markdown

Summary

  • Vend Fireworks KV-outer sparse prefill from fw-ai/minimax-kernels into fmha_sm100 (Python CuTe-DSL + C++ AOT extension fmha_sm100._C).
  • Route GQA ≥ 8 sparse prefill through kvouter_attention via sparse_fmha_adapter; legacy CuTe CSR path remains for lower GQA ratios.
  • Standardize CUDA 13 / cu13 pip wheels (nvidia-cutlass-dsl[cu13], flash-attn-4[cu13]), add setup.py extension build, and document the integration in README/NOTICE.
  • Split build_k2q_csr into nvcc kernels + g++ host/pybind so legacy sparse prefill JIT compiles on CUDA 13.3 + PyTorch 2.9.

Test plan

  • git submodule update --init --recursive
  • pip install -e . --no-build-isolation on SM100 + CUDA 13
  • pytest tests/ (KV-outer cases require cu13 deps + fmha_sm100._C)
  • FMHA_SM100_KVOUTER_CPP=1 python benchmarks/bench_sparse_attention_ops.py --sections sparse_prefill --dtype fp8 --seqs 4096,8192
  • Confirm legacy sparse prefill (GQA < 8 or FMHA_SM100_KVOUTER_CPP=0) still passes

Made with Cursor


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

ipiszy and others added 2 commits July 25, 2026 04:31
Split pybind bindings into a g++-compiled translation unit and use
minimal ATen headers in the .cu file so nvcc no longer parses
torch/extension.h and pybind11 macros.

Co-authored-by: Cursor <cursoragent@cursor.com>
Vendore minimax-kernels KV-outer (Python CuTe/AOT + fmha_sm100._C), route
GQA>=8 sparse prefill through kvouter_attention, pin CUDA 13 cu13 deps,
and split build_k2q_csr into nvcc kernels vs g++ host/pybind so legacy CuTe
CSR JIT builds on CUDA 13 nvcc without parsing PyTorch headers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ipiszy

ipiszy commented Jul 25, 2026

Copy link
Copy Markdown
Author

Closing in favor of a PR targeting the fireworks-msa integration branch (not main). Upstream needs a fireworks-msa branch first; see follow-up PR/issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant