mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #218] Pipeline SM120 D128 dense INT8 attention with TMA and cached Q #230
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-kitchen#230
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/Comfy-Org/comfy-kitchen/pull/218
Author: @Tokha233
Created: 9/30/2026
Status: 🔄 Open
Base:
main← Head:cuda/sm120-dense-tma📝 Commits (2)
e931351Pipeline SM120 D128 dense INT8 attention with TMA and cached Q2eb97e0Validate TMA against math SDPA and fix nonpositive scales📊 Changes
15 files changed (+1661 additions, -0 deletions)
View changed files
📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+14 -0)➕
comfy_kitchen/backends/cuda/sage_attention/dense_tma_sm120.cu(+94 -0)➕
comfy_kitchen/backends/cuda/sage_attention/dense_tma_sm120.cuh(+363 -0)➕
comfy_kitchen/backends/cuda/sage_attention/dense_tma_sm120.h(+16 -0)📝
comfy_kitchen/backends/cuda/sage_attention/sage_attn_launcher.cu(+19 -0)➕
comfy_kitchen/backends/cuda/sage_attention/tma_pipeline.cuh(+44 -0)➕
docs/benchmarks/attention-post-review-benchmark.json(+143 -0)➕
docs/benchmarks/attention-public-benchmark.json(+142 -0)➕
docs/benchmarks/attention-reference-regression.json(+467 -0)➕
docs/benchmarks/dense-tma-sm120.md(+91 -0)➕
docs/benchmarks/full-dit-post-review.json(+39 -0)➕
docs/benchmarks/full-dit.json(+82 -0)➕
docs/benchmarks/source-sha256.json(+12 -0)➕
tests/benchmark_attention_tma.py(+59 -0)➕
tests/test_int8_attention_tma.py(+76 -0)📄 Description
This adds a narrow SM120 path for long unmasked D128 INT8 attention: a three-slot TMA K/V ring and producer warpgroup overlap operand movement with cached-Q computation. For positive scales, it reuses main's quantization, QK/PV MMA order, online-softmax helpers and last-tile masking. A separate nonpositive-scale specialization applies scaling before the maximum and padding mask; the independent reference tests uncovered that the initial implementation inherited main's incorrect negative-scale behavior.
Main's cached-Q path is currently enabled on Ada. This is a separate SM120 implementation, selected only for contiguous BHSD, BF16 output, CTA128, Lq/Lkv>=8192 and uint32-safe offsets. Other inputs retain the ordinary launcher. The specialized object is compiled for SM120a; TMA entry points are resolved through the runtime without a new libcuda link dependency.
RTX 5090 D v2 measurements
Baseline
19ea55b(Kitchen 0.2.36), CUDA13.0.88, PyTorch2.12.0+cu130. Eight groups of ten warmed CUDA Graph replays, separate baseline/PR extensions. All default-positive-scale benchmark output tensors match exactly.Raw samples, exact A/B output procedure and benchmark script are in
docs/benchmarks/dense-tma-sm120.md. The large H3 shape has only a small gain; no broad deployment-speed claim is intended. A three-run public H3 DiT smoke test averaged 15.860485 → 15.839752 s (0.131%, too small for a reliable end-to-end claim), with identical video/audio latent SHA256.Validation and known baseline issues
docs/benchmarks/attention-reference-regression.json.attention-post-review-benchmark.json. Small timing differences remain subject to clock/run-order noise.full-dit-post-review.json.This preserves dense semantics. No sparsity, cache approximation or probability precision change is introduced. DCO signed off. Prepared with AI assistance and measured on the stated hardware. Broader SM120 cards and Windows are not yet benchmarked; feedback on the initial dispatch range is welcome.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.