Skip to content

[NPU] avoid HiFT linear interpolation device fault - #1937

Open
TKevin0v0 wants to merge 1 commit into
QwenAudio:mainfrom
TKevin0v0:fix/npu-hift-linear-interpolate
Open

[NPU] avoid HiFT linear interpolation device fault#1937
TKevin0v0 wants to merge 1 commit into
QwenAudio:mainfrom
TKevin0v0:fix/npu-hift-linear-interpolate

Conversation

@TKevin0v0

Copy link
Copy Markdown

[NPU] avoid HiFT linear interpolation device fault

Motivation

CosyVoice3 HiFT inference fails on Ascend NPU with a 507015 AI Vector
exception. Device slog identifies the first failing kernel as
UpsampleLinear1d_*_high_performance_2 with VEC instruction error: the ub address out of bounds.

The failing call is the SineGen2 phase downsampling used by 24 kHz
CosyVoice3:

input=(1, 9, 6720), float32, scale_factor=1/480, output=(1, 9, 14)

Making the input contiguous does not avoid the device fault.

Modifications

  • Keep the existing native F.interpolate(..., mode="linear") path for CPU,
    CUDA, and other devices.
  • On NPU, express the same align_corners=False source coordinates using
    index_select and interpolation weights.
  • Keep the entire fallback computation on the NPU; there is no CPU compute
    fallback.
  • Add coordinate-equivalence tests for the real 6720 -> 14 downsampling and
    the reverse 14 -> 6720 scale.

Correctness and runtime validation

  • 6720 -> 14: max absolute difference vs. CPU reference = 0.
  • 14 -> 6720: max absolute difference = 1.19e-7.
  • Standalone HiFT with a real Flow mel tensor succeeds and returns
    (1, 6720) float32.
  • SGLang-Omni /v1/audio/speech returns HTTP 200 and a valid PCM16 mono
    24 kHz WAV.
  • Focused unit tests: 2 passed.
  • Repository flake8 configuration and git diff --check: passed.

Scope

This is a model-side workaround for an Ascend built-in operator fault. It does
not claim to patch the internal CANN kernel implementation.

Related: sgl-project/sglang-omni#1652

@TKevin0v0
TKevin0v0 force-pushed the fix/npu-hift-linear-interpolate branch from 053acb7 to be8579e Compare August 24, 2026 10:37
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.

1 participant