Skip to content

v1.3.9

Choose a tag to compare

@github-actions github-actions released this 12 Jul 13:10
· 618 commits to main since this release

Features

  • CUDA kernel system (csrc/) — optional build, auto-detects sm_80+ for MMA tensor-core paths. Adds fused GQA decode attention, tensor-core prefill/decode MMA kernels, paged decode attention (scalar + MMA), split-KV (FlashDecoding). Fallback to torch SDPA when .so missing
  • MuonMix optimizer — Muon for 2D weight matrices, AdamW for 1D params (bias, norm, embedding, LM head). Replaces plain AdamW
  • DPO / GRPO data pipeline — MultiOutputMaskBuilder splits preprocessing into single-output (SFT/pretrain) and multi-output (DPO/GRPO), with "value" action section type for scalar rewards
  • HEAD_DIM=32 support added to all attention kernels
  • Paged decode CUDA kernel wired to Python extension via ops.py

Performance

  • Double-buffered KV pipeline + Q direct-to-register in decode MMA kernel (~1.27× on L20)
  • cp.async K/V loads + XOR swizzle + pre-scaled Q in both prefill and decode MMA kernels
  • Fused decode combine kernel: single-pass online-rescale reduction (halves expf calls)
  • Split-K (FlashDecoding) for decode MMA — fills idle SMs, 2.1–2.5× vs torch SDPA on low-parallelism workloads
  • Enlarged prefill KV tile to BC=32 for D≤128 (~6-8% faster)
  • Post-multiply attention scale in float (reduces causal max error 2^-6 → 2^-8)
  • Fast-math + vectorization nvcc/host build flags
  • Increased decode split-K parallelism for short sequences

Refactors

  • Unified gqa_* → attn_* naming with _split_q / _split_kv / _mma strategy suffixes
  • Template AttentionParams, extracted shared MMA utils
  • Split extension into loader.py (.so discovery) + ops.py (wrapper + fallback)
  • Removed ineffective __launch_bounds__ from prefill kernel

Fixes

  • Auto-assign free port in spawn_parallel_fn to avoid EADDRINUSE
  • Restore resident Qa register to fix sQ overwrite bug in prefill MMA
  • Exclude embedding/LM head/bias/norm from Muon optimizer
  • MuonMix inherits from torch.optim.Optimizer
  • Correct prefill mask index (batch×q_len×kv_len → batch×kv_len)
  • Support single .h5 file in load_h5
  • tqdm postfix set before first update so step 1 shows metrics

Docs

  • Full sync of 6 doc files to actual code
  • Fix errors across README, architecture.md, inference.md, dataflow.md, training.md, params.md, preprocessing.md
  • Update install instructions (EN/CN)

Tests

  • Standalone CUDA tests: attn_prefill_test.cu, attn_decode_test.cu, attn_paged_decode_test.cu
  • Benchmark for production MMA attention paths (FLOP/s + bandwidth)
  • Parity tests for single/multi output mask builders