mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #276] Issue HIP INT8 attention K/V staging loads together #276
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#276
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/276
Author: @qweqweewqe7-create
Created: 10/23/2026
Status: 🔄 Open
Base:
main← Head:optimize-hip-int8-attn-staging📝 Commits (1)
370901dIssue INT8 attention K/V staging loads together📊 Changes
1 file changed (+19 additions, -7 deletions)
View changed files
📝
comfy_kitchen/backends/hip/sage_attention/int8_attn.hip(+19 -7)📄 Description
Summary
The INT8 attention body copies each K/V tile with
for (idx = tid; idx < N; idx += kThreads)loops. The compiler cannot tell that every trip runs. So each global load sits behind its own exec branch and is waited on before the next one: load ->s_wait_loadcnt 0->ds_store, four times per tile.This change counts trips from zero with a fixed trip count, so all four loads issue before the first store. It also gives each thread one K base pointer per tile with constant row offsets.
D128 interior loop: staging goes from 58 to 16 instructions, VALU from 266 to 256, and VGPR from 178 to 174, with no spills. Outputs are bit-identical.
Performance
RX 9070 XT (gfx1201) and RX 9060 XT (gfx1200), PyTorch
2.16.0a0+rocm10.3.0a20261023, HIP 7.17.26423. Timings are wall-clock medians over windows of calls, averaged over two alternating runs. Measured at the shapes ComfyUI issues for each model,main-> this PR:int8_attention_from_prequantizedOn both GPUs, output hashes are identical to
mainat every shape.Validation
Tests on both GPUs (
test_hip_wmma,test_hip_dispatch,test_gemm_bias_contract,test_int8*,test_adaln,test_rms_rope,test_int8_attention,test_sol_attn,test_convrot_unpacked_quantization,test_w4a8_mma,test_w6a8) show the same failures as unmodifiedmain: 18 triton rope cases andtest_int8_linear_correctness[hip].🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.