Skip to content

fix(npu): pin triton-ascend 3.6.0 and fix the Ascend Triton faults - #1567

Merged
Tcc0403 merged 2 commits into
linkedin:mainfrom
zheliuyu:upgrade/triton-ascend-3.6.0
Nov 6, 2026
Merged

Tcc0403 merged 2 commits into
linkedin:mainfrom
zheliuyu:upgrade/triton-ascend-3.6.0

Conversation

@zheliuyu

@zheliuyu zheliuyu commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pin the Ascend NPU install to Triton-Ascend 3.6.0 and cap CV workspace slots to one. CANN stays 9.1.0. torch, torch_npu, and torchvision move together so the stack stays installable. Kernels that already had a Triton implementation stay on Triton-Ascend. No PyTorch stand-in was added.

Package Before After
torch 2.9.0 2.10.0
torch_npu 2.9.0 2.10.0.post7
torchvision unpinned 0.25.0
triton-ascend 3.2.2 3.6.0
CANN 9.1.0 9.1.0

Details

Triton-Ascend 3.6.0 ships BiShengIR 2.0, which pipelines mix kernels with a 4-slot CV workspace by default. A2 and A3 have a 192KB unified buffer, so four slots overflow (ub overflow, requires 2883840 bits while 1572864 bits available, multi-buffer enabled). install_ascend_compile_kwargs() sets set_workspace_multibuffer=1 when NPUOptions has that field. Triton-Ascend 3.2.x does not have the field, so those launches stay unchanged. An explicit caller value is kept.

Two Triton lowerings also change on 3.6.0:

  • A masked wide tl.cumsum no longer assigns unique MoE ranks. The permutation stops being invertible, and the next launch stores an out-of-range index (vector core 507035). The rank is now a scalar tl.atomic_add. GEMM and SwiGLU are unchanged. tl.sort is not used.
  • tl.static_range unrolls into the same 192KB buffer. AttnRes backward used to cap that loop at 32 blocks, so N=40 dropped the tail. The loop is now tl.range(0, n_blocks). Forward stays tl.static_range because n_blocks is constexpr there.

Host-side adjustments still call the existing Triton kernels:

  • RoPE forwards rotary_dim and rotates only that prefix. An explicit width is not inferred from a narrower cos/sin table (GPT-OSS).
  • TVD uses an integer reduction constexpr. torch.compile re-emits a string constexpr as a bare name. A tie subgradient is 0, and an all-ignored batch does not divide.
  • LUSPO materializes a (B, 1) scale as (B, L) so the kernel does not read off the row.

These tests are skipped on NPU. They are not replaced with PyTorch:

  • MLP. On the 3.2.2 pin (fbdea0ff) the file passed only because pytest.importorskip("triton.tools.tensor_descriptor") skipped it. 3.2.2 does not ship that module. 3.6.0 does, the tests actually run, and the CUDA TMA kernel hits assert is_cuda. There was no NPU MLP kernel in that 3.2.2 run.
  • Fused CE/TVD and fused linear score-centering have no Ascend backend. The shared files are unchanged.

mHC still disables auto-multi-buffer, and neighborhood attention still synchronizes between forwards. setup.py and the README list the new pins. docs/index.md is unchanged. Existing NPU environments need to reinstall.

Testing Done

  • Hardware Type: Ascend NPU, CANN 9.1.0
  • pytest test/transformers/
  • pytest test/transformers/test_attn_res.py test/transformers/test_fused_moe.py after the final trim (52 passed, including N=40 and the routing invariants)
  • ruff check on the touched files
  • make test-convergence

@zheliuyu zheliuyu changed the title misc(npu): pin triton-ascend 3.6.0 and cap CV workspace to one slot misc(npu): pin triton-ascend 3.6.0 and cap cv workspace to one slot Oct 27, 2026
@zheliuyu
zheliuyu force-pushed the upgrade/triton-ascend-3.6.0 branch from c992dc1 to 0580b43 Compare October 27, 2026 08:44
@zheliuyu
zheliuyu force-pushed the upgrade/triton-ascend-3.6.0 branch 6 times, most recently from 5b34958 to c2f3b94 Compare November 5, 2026 08:35
@zheliuyu zheliuyu changed the title misc(npu): pin triton-ascend 3.6.0 and cap cv workspace to one slot fix(npu): pin triton-ascend 3.6.0 and fix the Ascend Triton faults Nov 5, 2026
@zheliuyu
zheliuyu force-pushed the upgrade/triton-ascend-3.6.0 branch from c2f3b94 to cd9c73d Compare November 5, 2026 09:10
@zheliuyu

zheliuyu commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author
 pytest test/transformers/
image

@zheliuyu

zheliuyu commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

fb903ad

pytest test/transformers/
image

@Tcc0403 Tcc0403 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zheliuyu

zheliuyu commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@Tcc0403 Benchmarks for swiglu, rms_norm, rope, cross_entropy, and fused_linear_cross_entropy are done on CANN 9.1.0 (Ascend910_9382). No significant regression compared with triton-ascend 3.2.2. Results are below.

triton-ascend 3.2.2: #1426

Benchmark — CANN 9.1.0, Ascend910_9382

Token-length sweep: 1024 / 2048 / 4096 / 8192.

SwiGLU

Speed · forward
swiglu_speed_forward_token_length
Speed · backward
swiglu_speed_backward_token_length
Speed · full
swiglu_speed_full_token_length
Memory · full
swiglu_memory_full_token_length

RMSNorm

Speed · forward
rms_norm_speed_forward_token_length
Speed · backward
rms_norm_speed_backward_token_length
Speed · full
rms_norm_speed_full_token_length
Memory · full
rms_norm_memory_full_token_length

RoPE

Speed · forward
rope_speed_forward_token_length
Speed · backward
rope_speed_backward_token_length
Speed · full
rope_speed_full_token_length
Memory · full
rope_memory_full_token_length

Cross Entropy

Speed · forward
cross_entropy_speed_forward_token_length
Speed · backward
cross_entropy_speed_backward_token_length
Speed · full
cross_entropy_speed_full_token_length
Speed · no-grad forward
cross_entropy_speed_no-grad-forward_token_length
Memory · full
cross_entropy_memory_full_token_length

Fused Linear Cross Entropy

Speed · forward
fused_linear_cross_entropy_speed_forward_token_length
Speed · backward
fused_linear_cross_entropy_speed_backward_token_length
Speed · full
fused_linear_cross_entropy_speed_full_token_length
Memory · full
fused_linear_cross_entropy_memory_full_token_length

@Tcc0403
Tcc0403 added this pull request to the merge queue Nov 6, 2026
Merged via the queue into linkedin:main with commit 3760705 Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants