Repository navigation
Add Volta (SM70) kernels for compensated FP32 inference - #10
Open
chris-edstrom wants to merge 2 commits into
Open
chris-edstrom wants to merge 2 commits into
chris-edstrom wants to merge 2 commits into
Conversation
On compute capability 7.x with --tensor-core-fp32 --flash-fp32, select dedicated kernels adapted from the Flash-V100 design: - Flash attention with FP16 WMMA, FP32 accumulation and an FP32 online softmax. Both operands are compensated (hi*hi + hi*lo + lo*hi), and local layers visit only key tiles inside the +/-64 window. This replaces the FP32 SGEMM/softmax/SGEMM path used for sequences over 128 tokens. - Fused residual merge, LayerNorm split and merged rotary packing, so compensated products stay unmerged until their consumer. - Per-shape GEMM tuning over cuBLAS tensor-op algorithms and cuBLASLt candidates, timed from a flushed L2 on the first eager run and pinned before CUDA graph capture. Selection happens at runtime; other GPUs keep the existing graph. LAYA_SM70=0/1 overrides the selection and LAYA_SM70_GEMM_TUNE=0 keeps the default GEMM algorithm. The attention test covers the new kernel up to 1024 keys in global and local modes. Tesla V100, all three models pass validation at batch sizes 1-8 (the multilingual fraud-08 difference is pre-existing). Throughput improves 12-56% on the acceptance corpus, and 8 x 1024-token batches run 29-42% faster. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Timed per-process tuning could pin different cuBLAS algorithms in the HTTP server and the CLI, breaking exact HTTP/CLI parity in benchmarks/http_validate.py (multilingual, batch 1). Select the algorithm from the shape instead: CUBLAS_GEMM_ALGO3_TENSOR_OP for 2048+ columns when M <= 4096, where the default choice regresses by up to 50% on V100, and the default algorithm otherwise. Timed tuning remains available with LAYA_SM70_GEMM_TUNE=1 and is documented as reproducible only within one process. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Adds Volta-specific kernels for
--tensor-core-fp32 --flash-fp32, selected at runtime on compute capability 7.x (LAYA_SM70=0/1overrides). Other GPUs keep the existing graph. The kernels are compensated FP16-WMMA flash attention with local-window tile skipping, fused residual/LayerNorm/rotary kernels, and a shape-based cuBLAS algorithm choice.Verification (Tesla V100, CUDA 12.9): CTest passes, including extended attention tests up to 1024 keys. The CPU-only build and Python tests also pass. Acceptance at batch 1–8 and the edge cases in
tests/model-requests.jsonpass for english and typed-decisions. HTTP/CLI parity passes for english and typed-decisions. Paired sweep: english +12–32%, typed-decisions +18–44%.Limitations: the baseline was PyPI
laya0.3.6 with its temperature clamp removed to match native calibration, not the recorded baseline revision. Multilingualfraud-08differs by 0.0002 at batch ≥2 in the base build too, so multilingual acceptance, the paired sweep and HTTP validation can't complete; CLI timing shows +32–47%. Not run on Blackwell or Vulkan.🤖 Generated with Claude Code