mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #172] Use int64 offsets in the Triton INT8 GEMM kernels #192
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#192
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/172
Author: @neuregex
Created: 9/11/2026
Status: 🔄 Open
Base:
main← Head:fix/int8-gemm-int64-offsets📝 Commits (1)
525c1ffUse int64 offsets in the Triton INT8 GEMM kernels📊 Changes
2 files changed (+42 additions, -4 deletions)
View changed files
📝
comfy_kitchen/backends/triton/quantization.py(+6 -4)📝
tests/test_int8.py(+36 -0)📄 Description
Fixes #136
Both Triton INT8 GEMM kernels (
_int8_matmul_dequant_kerneland_int8_matmul_dequant_per_row_kernel) compute the output offsetstride_cm * offs_amin int32, so it wraps oncem * n >= 2**31and the kernel hits an illegal memory access. This castsoffs_am/offs_bnto int64 in both kernels, as @mjungnickel18 suggested in the issue.Test:
test_triton_int8_linear_output_offsets_past_int32(per-tensor and per-row weight scale). With m=32769, n=65536, k=16 the last row starts at offset 2**31; it checks the last two rows against a float32 reference. Needs ~6 GiB of free VRAM, markedslow.Checked on an RTX 3090 Ti (WSL2, torch 2.11.0+cu128, triton 3.6.0):
tests/test_int8.py: 64 passed, 39 skipped, no new failuresThroughput (the open question in the issue): median int64/int32 time over 30 interleaved batches, with an identical int32 copy as control (within ±0.4%):
So gating the int64 path on
m * ndoesn't seem necessary.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.