Skip to content

Commit db9afd6

Browse files
Fix acc mismatch for GCU (Enflame) (#330)
<!-- Copyright 2026 FlagOS Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> ### PR Category <!-- One of [Core | Vendor | OP | Tools | Others] --> ### PR Type <!-- One of [User Experience | New Features | Bug Fixes | Improvements | Performance | Breaking Change | Deprecations | Test Case | Docs | Others] --> ### Description <!-- Describe what this PR does and why. --> ### Related Issues <!-- Link any related issues: Fixes #issue, Closes #issue, or Related to #issue --> ### Changes <!-- List the key changes made in this PR. --> - ### Testing <!-- How has this change been tested? Include test commands, hardware used, etc. --> - note: need flaggems commit id :c080be72c7a81772a61b3bad301cb4ec458ee6db ### Checklist - [ ] I have run the existing tests and they pass - [ ] I have added tests for my changes (if applicable) - [ ] I have updated the documentation (if applicable) --------- Co-authored-by: cyber-pioneer <116002591+cyber-pioneer@users.noreply.github.com>
1 parent 43edeb6 commit db9afd6

4 files changed

Lines changed: 980 additions & 8 deletions

File tree

vllm_fl/dispatch/backends/vendor/gcu/gcu.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,11 @@ def rotary_embedding(
7373
)
7474

7575
def attention_backend(self, use_mla: bool = False, use_sparse: bool = False) -> str:
76-
from vllm.v1.attention.backends.registry import AttentionBackendEnum
77-
7876
if use_mla:
7977
if use_sparse:
8078
raise NotImplementedError("GCU does not support sparse attention yet")
8179
raise NotImplementedError("GCU does not support MLA yet")
82-
83-
import flash_attn.vllm_flash_attn
84-
85-
sys.modules["vllm.vllm_flash_attn"] = flash_attn.vllm_flash_attn
86-
87-
return AttentionBackendEnum.FLASH_ATTN.get_path()
80+
# GCU uses a standalone flash_attn backend (AttentionGCUBackend) that calls
81+
# Enflame's native flash_attn_varlen_func directly, without depending on
82+
# vllm upstream FlashAttentionBackend / FlashAttentionImpl.
83+
return "vllm_fl.dispatch.backends.vendor.gcu.impl.attention.AttentionGCUBackend"

0 commit comments

Comments
 (0)