mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #199] [MERGED] [BugFix][Ascend] Gate RoPE tests on operator capabilities and clarify support #214
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#214
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/199
Author: @Big2Wheel
Created: 9/25/2026
Status: ✅ Merged
Merged: 10/2/2026
Merged by: @comfyanonymous
Base:
main← Head:fix/ascend-rope-capability-gates📝 Commits (3)
85870f6fix(ascend): gate RoPE tests on operator capabilities28b7f85fix(ascend): sort backend imports to unblock CIf28f13eFix import order.📊 Changes
2 files changed (+33 additions, -18 deletions)
View changed files
📝
README.md(+13 -10)📝
tests/test_ascend_rope.py(+20 -8)📄 Description
Summary
Follow-up to merged #198, which consolidated #153, #154, #155 and #161 on top of #151. This PR changes tests, documentation, and backend import ordering to satisfy repository-wide lint; it does not change backend registration rules or inference implementations.
Addresses the two remaining review findings:
Changes
Fix the entry-point import-order lint error inherited from merged main, which blocked Linux and Windows CI before pytest. Full-repository
ruff check .now passes.Retain the Ascend-device gate and add separate RoPE / RMS-RoPE capability marks to execution, alias-safety and selection tests.
Mark unsupported-contract parameter cases individually: ordinary rotary cases require RoPE;
bad_scalerequires RMS-RoPE.Keep operator-schema detection tests active when applicable rather than skipping the whole module because rotary support is missing.
Mark all eight Ascend RoPE/RMS-RoPE README rows as conditional; explain the rotary schema and RMSNorm requirements.
Name both
npu_dynamic_quantandnpu_quant_matmulin the INT8 linear description.Validation of this follow-up
Single Ascend 910B3, physical card 4, same environment as the report below.
npu_rotary_mulrotary_modenpu_rms_norm, rotary still availableThe compatibility scenarios ran in separate Python processes. The relevant torch-npu attribute was removed (or the rotary schema replaced with a minimal schema lacking
rotary_mode) before importing comfy_kitchen and collecting tests. The no-torch-npu case usedTORCH_DEVICE_BACKEND_AUTOLOAD=0andsys.modules["torch_npu"] = None; nothing was uninstalled from the shared container. These are simulations on the current runtime, not tests on separately installed older torch-npu releases.Normal regression command:
Additional validation evidence for merged #198
We attempted to post the report below as a follow-up comment on #198, but GitHub rejected the comment because that discussion is locked. It is included here to keep the completed workflow and CPU-fallback evidence accessible to reviewers. These performance measurements validate the earlier #198 implementation, not a new speedup introduced by this maintenance PR.
Repeated warm workflow timings, pre-PR baseline, CPU fallback evidence, and W4A4 ablation
Follow-up validation: repeated warm workflows and pre-PR CPU fallback
Thanks for merging! Here are the subsequent single-NPU measurements, including a pre-PR baseline and a W4A4-only ablation. These supplement the original smoke-test table; the old smoke times should not be used for performance comparisons.
Environment and timing protocol
8cb9fdac282aee8f5bcdcb444a5f4000e17bbd27. Pre-PR baseline:d86e8d71cc3f1aeeaa0fbbe31bf993405a27643d(already includes #151). The merged revision isd16dfcf812d27b8b353b312f7ba7472928f79068; its Ascend implementations and tests are identical to the tested PR revision. These are not newly rerun measurements of the merge commit.45b3121ccff27bc6020985738ad999b96b4b9a02.ASCEND_RT_VISIBLE_DEVICES=4 OMP_NUM_THREADS=4,--cache-none --disable-pinned-memory; fixed prompts/seeds/settings. No other validation jobs ran concurrently on the test card.execution_start→execution_success, including request-time model loading/transfers, text encoding, sampling, decoding and saving, but excluding service startup and client polling. Denoising-loop time uses NPU synchronization aroundKSAMPLER.sample; it includes host dispatch/callback overhead and is not pure device-kernel time.--cache-none, model-load calls still occur each run. This is a warmed runtime/filesystem benchmark, not an entirely model-resident benchmark.PR-enabled results: all four workflows
All 16 runs (4 warm-ups + 12 measured runs) completed successfully. Times are seconds.
Exact main checkpoints and output settings:
z_image_turbo_int8_convrot.safetensorsz_image_turbo_bf16.safetensorswan2.2_t2v_high_noise_14B_fp16.safetensors+wan2.2_t2v_low_noise_14B_fp16.safetensorskrea2_turbo_int4_mixed.safetensorsSupporting weights are unchanged from the PR description: Z-Image uses
qwen_3_4b.safetensors/ae.safetensors; Wan usesumt5_xxl_fp16.safetensors/wan_2.1_vae.safetensorsand matching high/lowwan2.2_t2v_lightx2v_4steps_lora_v1.1_*.safetensorsat strength 1; Krea usesqwen3vl_4b_bf16.safetensors/qwen_image_vae.safetensors.The INT8-vs-BF16 rows compare different checkpoint configurations; their difference is not a same-checkpoint PR speedup measurement.
Complete pre-PR baseline: BF16 and Wan
Both workflows already complete on NPU before this PR. No CPU-fallback warning was observed in these baseline runs.
Pre-PR vs PR denoising-loop medians: Z-Image BF16 7.701 → 6.779 s; Wan 57.779 → 55.360 s. These are observed small-sample differences, not claims of statistical significance or universal gains.
INT8 baseline: confirmed CPU fallback, not a complete workflow timing
On the pre-PR revision, real Z-Image INT8 and Krea mixed-precision requests selected eager INT8 linear and reached
aten::_int_mm. The runtime explicitly warned that this operator is unsupported on NPU and falls back to CPU. A separate profiler probe also recordedaten::_to_cpuand copies; dispatch checks found no PrivateUse1 kernel for_int_mm, while ordinarymmhad one.[32,3840] × [3840,11520][4135,6144] × [6144,1536]After allowing that real call to finish, the diagnostic deliberately stopped each request (
VALIDATION_PROBE_COMPLETE). These are not complete baseline workflow times, steady-state operator benchmarks, or native model failures. No end-to-end speedup ratio is calculated for these two workflows. Only some integer operations were confirmed to run on CPU—not the entire model. NPU input/output tensor devices alone do not rule out an internal CPU fallback. The PR INT8 path uses native NPU quant matmul.Krea W4A4-only ablation
To isolate W4A4 without reintroducing the mixed-INT8 CPU fallback, a separate configuration retained the PR's INT8/RoPE/etc. but disabled only Ascend
convrot_w4a4_linearregistration. This is not the full pre-PR baseline.Observed workflow latency reduction is only 0.95%. With three runs per arm and non-interleaved groups, this is insufficient to claim a meaningful/general W4A4 end-to-end speedup.
The profiler confirmed that eager W4A4's floating-point matmul already runs on NPU (
aclnnMatmul_MatMulCommon_MatMulV2); the PR uses INT32 quant matmul (aclnnQuantMatmulV5_QuantBatchMatmulV3_QuantBatchMatmulV3). Eager W4A4 must not be described as a CPU implementation. The previously withdrawn 134 s / 2.73x result from the numerically different implementation remains inapplicable.Output checks and scope
rtol=0, atol=0. This is not a guarantee for every input, intermediate tensor or seed.ComfyUI-INT4-Fastmixed-INT8 routing shim was kept unchanged in both arms and is not part of this PR. These results do not imply that every unmodified third-party ComfyUI node works merely by installing this backend.In short: this validation supports native NPU execution instead of INT8 CPU fallback, modest observed BF16/Wan latency reductions, and correctness of the tested W4A4 path—not a large W4A4 speedup claim.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.