mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #153] [CLOSED] [Feat][Ascend] Add Ascend INT8 linear backend #179
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#179
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/153
Author: @Big2Wheel
Created: 9/4/2026
Status: ❌ Closed
Base:
main← Head:codex/ascend-int8-linear📝 Commits (5)
5942faefeat(npu): add Ascend quantization backend1ecb943test(npu): include NPU in supported devices0bccee7refactor(ascend): clarify backend naming6ab910afeat(ascend): add INT8 linear backend91a5a3ftest(ascend): handle optional quant matmul📊 Changes
7 files changed (+674 additions, -41 deletions)
View changed files
📝
README.md(+56 -38)📝
comfy_kitchen/__init__.py(+1 -0)➕
comfy_kitchen/backends/ascend/__init__.py(+331 -0)📝
comfy_kitchen/registry.py(+1 -1)📝
tests/conftest.py(+2 -2)➕
tests/test_ascend_backend.py(+268 -0)📝
tests/test_backends.py(+15 -0)📄 Description
What this PR does
Adds an Ascend implementation of Comfy Kitchen's
int8_linearcapability.torch_npu.npu_dynamic_quanttorch_npu.npu_quant_matmulgelu_tanh/swigluinput activationsint8_linearwhen the installed torch-npu exposesnpu_quant_matmulThis avoids the eager
aten::_int_mmpath, which falls back to CPU on the tested Ascend stack.Relationship to #151
This is a stacked follow-up to #151 and intentionally builds on its three commits.
#151 introduces the optional
ascendbackend, its registration/availability handling, the shared INT8 quantize/dequantize capabilities, and NPU device discovery. This PR adds the first compute-heavy consumer of that foundation: Ascend-native INT8 linear/ConvRot execution.Please review and merge #151 first. Until #151 lands, GitHub shows those base commits in this PR as well; after #151 is merged, this branch can be rebased/updated so the remaining diff contains only the INT8-linear-specific commits.
User-facing change
On supported Ascend NPU environments, Comfy Kitchen can automatically select the
ascendbackend for compatible INT8 linear layers. Other devices and unsupported Ascend calls retain the existing fallback behavior.How this was tested
Environment:
Unit/regression tests:
End-to-end validation:
ascendbackend selections forint8_linearper runaten::_int_mmor CPU fallback428c244502d03e9c7f99431e2d1070f1The eager baseline was also checked: it explicitly fell back from
aten::_int_mmto CPU and processed only about 10 INT8 linear calls in roughly 55 seconds, so it was stopped rather than presented as a misleading full-workflow comparison.Representative real-layer operator measurements (
M=8352):Numerical comparison against a dequantized reference produced cosine similarity around 0.999958 and relative MAE around 0.89%. These benchmark figures document the tested setup and are not intended as a universal performance guarantee.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.