Skip to content

[NPU]: remove num_stages and num_warps from NPU Triton kernels#1111

Merged
Tcc0403 merged 3 commits into
linkedin:mainfrom
noemotiovon:fix_num_stage
Mar 2, 2026
Merged

[NPU]: remove num_stages and num_warps from NPU Triton kernels#1111
Tcc0403 merged 3 commits into
linkedin:mainfrom
noemotiovon:fix_num_stage

Conversation

@noemotiovon

Copy link
Copy Markdown
Contributor

Triton-Ascend does not support num_warps and num_stages due to hardware architecture differences; autotune only supports block size and multibuffer. Remove these parameters from all Ascend NPU kernels and kernel launches to avoid no-op / misleading config.

Changes:

  • geglu: drop NUM_STAGES and num_warps from forward/backward kernels
  • embedding: drop NUM_STAGES from forward/backward kernels
  • fused_add_rms_norm: drop NUM_STAGES from all 4 kernels (no-tiling/tiled, forward/backward)
  • llama4_rope: add docstring (kernel already did not use num_stages/num_warps)
  • qwen2vl_mrope: drop NUM_STAGES from kernel and forward/backward launches
  • rms_norm: drop NUM_STAGES from all 4 kernels and launches
  • rope: drop NUM_STAGES from kernel and forward/backward launches
  • swiglu: drop NUM_STAGES and num_warps from forward/backward kernels
  • tvd: drop NUM_STAGES from kernel and launch

Hardware Type: Atlas 800I A2(32GB)

  • run make test to ensure correctness
  • run make checkstyle to ensure code style
  • run make test-convergence to ensure convergence

Triton-Ascend does not support num_warps and num_stages due to hardware
architecture differences; autotune only supports block size and multibuffer.
Remove these parameters from all Ascend NPU kernels and kernel launches to
avoid no-op / misleading config.

Changes:
- geglu: drop NUM_STAGES and num_warps from forward/backward kernels
- embedding: drop NUM_STAGES from forward/backward kernels
- fused_add_rms_norm: drop NUM_STAGES from all 4 kernels (no-tiling/tiled,
  forward/backward)
- llama4_rope: add docstring (kernel already did not use num_stages/num_warps)
- qwen2vl_mrope: drop NUM_STAGES from kernel and forward/backward launches
- rms_norm: drop NUM_STAGES from all 4 kernels and launches
- rope: drop NUM_STAGES from kernel and forward/backward launches
- swiglu: drop NUM_STAGES and num_warps from forward/backward kernels
- tvd: drop NUM_STAGES from kernel and launch
@noemotiovon

Copy link
Copy Markdown
Contributor Author

Hi @Tcc0403, could you please help review my code?

Comment on lines +20 to +22
"""
Triton-Ascend does not support num_warps/num_stages due to hardware differences.
"""

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.

Thanks for the clarification! imo, we don't have to keep the reminder in every docstring, better only leave it on the npu triton kernel developement guideline somehwere. wdyt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree with your suggestion. We will consolidate everything and document it uniformly in the Ascend documentation later.

Llama4 RoPE on Ascend NPU for interleaved complex layout:
- q/k shape: (bs, sl, n_heads, hd)
- freqs_complex_ptr: (sl, hd//2, 2)
Triton-Ascend does not support num_warps/num_stages; this kernel does not use them.

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.

missed this one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry! I overlooked it.

@Tcc0403 Tcc0403 added this pull request to the merge queue Mar 2, 2026
Merged via the queue into linkedin:main with commit 8b965b9 Mar 2, 2026
5 of 7 checks 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