#7950·verl

[Ascend] fused linear_cross_entropy Triton kernel UB overflow on 910B

Author: RitianDCreated Sep 20, 2026Updated Sep 30, 2026

System Info

  • Device: Ascend 910B (A2)
  • CANN: 9.0.0
  • Training uses triton-ascend to compile verl fused kernels
  • Triggered by actor_rollout_ref.model.use_fused_kernels=True (fused linear_cross_entropy / efficient_entropy path)

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder
  • My own task or dataset (Ascend NPU RL training with fused kernels enabled)

Reproduction

Enable fused kernels on Ascend 910B so that verl.utils.kernel.linear_cross_entropy is used. Compilation fails in Triton/BiShengHIR for efficient_entropy_kernel_general_mainloop in verl/utils/kernel/kernels.py:

loc(".../verl/utils/kernel/kernels.py":188:0): error: Failed to run BiShengHIR pipeline
loc(".../verl/utils/kernel/kernels.py":188:0): error: ub overflow, requires 8577280 bits while 1572864 bits available!
(possible reason: tiling basic block is too large or block number is more than what user expect due to multi-buffer feature is enabled and some ops need extra local buffer.)
[ERROR] Failed to run BiShengIR pipeline
Job entrypoint command failed with exit code 1

Relevant autotune config (GPU-oriented):

python
triton.Config(
    {"BLOCK_SIZE_M": 128, "BLOCK_SIZE_N": 256, "BLOCK_SIZE_K": 32},
    num_stages=3,
    num_warps=8,
)

Additional NPU friction in the same path:

  • Host asserts require tensor.is_cuda
  • Wrapper uses torch.cuda.nvtx
  • Triton-Ascend does not support num_warps / num_stages the same way as NVIDIA Triton; Ascend 910B UB is ~192KB (1572864 bits)

Expected behavior

  • Fused linear cross-entropy + token entropy kernels either:
    1. compile and run on Ascend with NPU-safe tiling / launch params, or
    2. are clearly documented as CUDA-only, with a safe fallback when use_fused_kernels=True on NPU

NVIDIA GPU behavior should remain unchanged.

Proposed direction (willing to contribute)

Short-term (Triton NPU adaptation):

  • When is_npu_available, use smaller tiles (e.g. up to ~32×64) and omit num_warps / num_stages
  • Allow cuda/npu tensors; keep TMA CUDA-only
  • Make NVTX a no-op on NPU

Longer-term: optional CANN fused linear CE (aclnnFusedLinearOnlineMaxSum etc. on CANN 9.0+) for CE/logprobs; token entropy still needs a separate path or custom op.

I can open a PR with the Triton tiling adaptation after discussion.