mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #220] Add projection-ready BSHD output to prequantized INT8 attention #232
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#232
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/220
Author: @Tokha233
Created: 9/30/2026
Status: 🔄 Open
Base:
main← Head:cuda/prequantized-bshd-output📝 Commits (5)
e931351Pipeline SM120 D128 dense INT8 attention with TMA and cached Q2eb97e0Validate TMA against math SDPA and fix nonpositive scales2a1650bAdd contiguous BSHD output to prequantized attention9f70304Bind benchmark operands per case13bbea6Cover BSHD TMA streams graphs and nonpositive scales📊 Changes
21 files changed (+2032 additions, -15 deletions)
View changed files
📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+14 -0)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+13 -6)➕
comfy_kitchen/backends/cuda/sage_attention/dense_tma_sm120.cu(+97 -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)📝
comfy_kitchen/sage_attention.py(+21 -9)➕
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/layout-benchmark.json(+186 -0)➕
docs/benchmarks/layout.md(+30 -0)➕
docs/benchmarks/source-sha256.json(+12 -0)➕
tests/benchmark_attention_tma.py(+59 -0)➕
tests/benchmark_layout.py(+59 -0)➕
tests/test_int8_attention_layout.py(+54 -0)...and 1 more files
📄 Description
Adds an explicit
output_layout="BSHD"option to prequantized INT8 attention, so output projections can consume contiguous BSHD storage without a separate transpose/copy. BHSD remains the default. Native CUDA uses output strides; HIP retains a conversion fallback.Depends on #218. This branch includes #218; the additional layout-only diff is https://github.com/Tokha233/comfy-kitchen/compare/cuda/sm120-dense-tma...cuda/prequantized-bshd-output . Please review the layout-only comparison as the incremental contribution; #218 must merge first.
Validation on RTX 5090 D v2 / Torch 2.12.0+cu130: 37 tests passed (layout, batch 2, GQA, masks, D64/96/128/256, BF16/FP16/FP32, streams and CUDA Graphs, plus #218 accuracy regressions). All benchmark outputs are bitwise equal.
Eight alternating groups, four graph replays per sample. These are attention-plus-layout timings, not whole-model/serving speedups. Raw samples and reproduction:
docs/benchmarks/layout.md,tests/benchmark_layout.py. The separate ComfyUI consumer in Comfy-Org/ComfyUI#16678 completed four alternating full-sampler pairs: 15.778404 → 15.713747 s (−0.410%), with equal video/audio latent hashes. Both arms used the same TMA build. Other GPUs/HIP are not tested here.Prepared with AI assistance; tests and measurements were executed on the stated hardware. DCO signed off.
Latest combined validation and per-PR fixes: https://github.com/Tokha233/ComfyUI-H3-SpeedKit/blob/main/docs/UPSTREAM-RECOVERY-TESTS-20261001.zh-CN.md . Combined gains overlap and must not be added to the single-operation timings above.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.