Skip to content

[Fix] [MUSA] vision: define flash_attn_func for the fa3 mm attention … - #50068

Closed
Haozon wants to merge 2 commits into
sgl-project:mainfrom
Haozon:musa-vlm-vision-flash-attn
Closed

Haozon wants to merge 2 commits into
sgl-project:mainfrom
Haozon:musa-vlm-vision-flash-attn

Conversation

@Haozon

@Haozon Haozon commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

…backend

VisionFlash3Attention unconditionally calls flash_attn_func, but the wrapper was only defined under if _is_cuda:; the MUSA branch imported just flash_attn_varlen_func. Any VL model on MUSA (mm backend defaults to fa3 at capability >= 3.1) died in the vision tower with

NameError: name 'flash_attn_func' is not defined

Define the wrapper for MUSA too, forwarding to flash_attn_interface's fa3-style varlen entry (ver=4 stays CUDA-only behind VisionFlash4Attention).

Verified on an MTT S5000: Qwen3-VL-4B-Instruct serves end to end with pure defaults and answers an image prompt correctly; the new unit test fails on the pre-fix code (hasattr guard red) and passes with the fix.

Motivation

Modifications

Accuracy Tests

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #43196980004
Latest PR Test (Extra): ❌ Run #43196979655
Latest PR Test (AMD ROCm 10): ❌ Run #43196979951

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

…backend

VisionFlash3Attention unconditionally calls flash_attn_func, but the
wrapper was only defined under `if _is_cuda:`; the MUSA branch imported
just flash_attn_varlen_func. Any VL model on MUSA (mm backend defaults
to fa3 at capability >= 3.1) died in the vision tower with

    NameError: name 'flash_attn_func' is not defined

Define the wrapper for MUSA too, forwarding to flash_attn_interface's
fa3-style varlen entry (ver=4 stays CUDA-only behind
VisionFlash4Attention).

Verified on an MTT S5000: Qwen3-VL-4B-Instruct serves end to end with
pure defaults and answers an image prompt correctly; the new unit test
fails on the pre-fix code (hasattr guard red) and passes with the fix.

Co-Authored-By: Claude Code <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the Multi-modal multi-modal language model label Nov 12, 2026
@yeahdongcn

Copy link
Copy Markdown
Collaborator

Merged to #50275

@yeahdongcn yeahdongcn closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Multi-modal multi-modal language model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants