Skip to content

[Others] update flash mask version#7819

Open
BingooYang wants to merge 4 commits into
PaddlePaddle:developfrom
BingooYang:up_flashmaske
Open

[Others] update flash mask version#7819
BingooYang wants to merge 4 commits into
PaddlePaddle:developfrom
BingooYang:up_flashmaske

Conversation

@BingooYang
Copy link
Copy Markdown
Contributor

@BingooYang BingooYang commented May 14, 2026

Motivation

flashinfer升级到0.6.11版本要求nvidia-cutlass-dsl>=4.4.2(https://github.com/PaddlePaddle/FastDeploy/pull/7799),flash mask旧版本锁死了nvidia-cutlass-dsl==4.4.2,产生冲突,因此升级一下flash mask版本

Modifications

删除flash mask依赖,直接使用paddlefleet中的flashmask
升级flash mask版本
版本信息记录在:https://ku.baidu-int.com/knowledge/HFVrC7hq1Q/pKzJfZczuc/YeqWcBGW4m/EUBpKxHfTurV5G

Usage or Command

NA

Accuracy Tests

NA

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 14, 2026

Thanks for your contribution!

PaddlePaddle-bot

This comment was marked as outdated.

@PaddlePaddle-bot
Copy link
Copy Markdown

PaddlePaddle-bot commented May 14, 2026

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-05-20 13:55:27

CI报告基于以下代码生成(30分钟更新一次):


1 任务总览

⚠️ Required 失败任务 1 个,需优先处理后方可合并。

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
42(0) 42 40 1 1 0 0

2 任务状态汇总

2.1 Required任务 : 9/10 通过

必选任务阻塞合并,失败需优先处理。

状态 任务 耗时 根因 修复建议 日志 重跑
Approval 9s PR问题:新增logger.info行,触发RD审批要求 @xyxinyang@zyyzghb 审批此 PR Job -
其余 9 个必选任务通过 - - - - -

2.2 可选任务 — 31/32 通过

可选任务不阻塞合并,失败仅供参考。

状态 任务 耗时 日志 重跑
CI_HPU - Job -
其余 31 个可选任务通过 - - -

3 失败详情(仅 required)

Approval — 代码规范(置信度: 高)

Approval

  • 状态: ❌ 失败
  • 错误类型: 代码规范
  • 置信度: 高
  • 根因摘要: PR新增 logger.info 日志行,触发 RD 审批要求
  • 分析器: 通用分析(fallback)

根因详情:
PR 在 diff 中新增了一行日志:logger.info(f"The current platform[sm{get_sm_version()}] can't import Flash Attention V4.")check_approval.sh 脚本检测到此修改触发了审批规则 0:修改 logging 行为(.info/.debug/.error/log_request)必须获得 FastDeploy RD 审批。当前尚未有相关审批人批准,因此以 exit code 6 退出。

修复建议:

  1. @xyxinyang(zhouchong)或 @zyyzghb(zhangyongyue)在此 PR 上进行 Approve Review
  2. 审批后 Approval workflow 将自动重跑并通过

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@dad5a43). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7819   +/-   ##
==========================================
  Coverage           ?   63.35%           
==========================================
  Files              ?      462           
  Lines              ?    64371           
  Branches           ?     9872           
==========================================
  Hits               ?    40780           
  Misses             ?    20825           
  Partials           ?     2766           
Flag Coverage Δ
GPU 72.46% <100.00%> (?)
XPU 7.12% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

zoooo0820
zoooo0820 previously approved these changes May 14, 2026
Copy link
Copy Markdown
Collaborator

@zoooo0820 zoooo0820 left a comment

Choose a reason for hiding this comment

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

LGTM

PaddlePaddle-bot

This comment was marked as outdated.

@PaddlePaddle-bot
Copy link
Copy Markdown

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-05-18 10:27:43

CI报告基于以下代码生成(30分钟更新一次):


1 任务总览

⏳ Required 任务进行中:5 个运行中,1 个等待中,暂无 Required 失败。

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
37(0) 37 27 1 7 2 0

2 任务状态汇总

2.1 Required任务 : 3/9 通过

必选任务阻塞合并,失败需优先处理。

状态 任务 耗时 根因 修复建议 日志 重跑
Extracted partial CE model tasks to run in CI. / run_ce_cases - 运行中 - Job -
Run Base Tests / base_tests - 运行中 - Job -
Run FastDeploy Unit Tests and Coverage / run_tests_with_coverage - 运行中 - Job -
xpu_4cards_case_test / run_xpu_4cards_cases - 运行中 - Job -
xpu_8cards_case_test / run_xpu_8cards_cases - 运行中 - Job -
⏸️ Run Four Cards Tests / run_4_cards_tests - 等待中 - - -
其余 3 个必选任务通过 - - - - -

2.2 可选任务 — 24/28 通过

可选任务不阻塞合并,失败仅供参考。

状态 任务 耗时 日志 重跑
Trigger Jenkins for PR 10m44s Job -
Run iluvatar Tests / run_iluvatar_cases - Job -
xpu_unit_test / run_xpu_unit_test - Job -
⏸️ CI_HPU - - -
其余 24 个可选任务通过 - - -

3 失败详情(仅 required)

无 required 失败任务。

PaddlePaddle-bot

This comment was marked as outdated.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 19, 2026

CLA assistant check
All committers have signed the CLA.

PaddlePaddle-bot

This comment was marked as outdated.

paddle.enable_compat(scope={"cutlass"})
from flash_mask.cute.interface import flashmask_attention as fa4
try:
from paddlefleet.ops import is_flash_mask_available
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.

最近paddlefleet有名称变更,如果不太着急的话可以关注下这个PR 的修改同步也适配下 #7859

PaddlePaddle-bot

This comment was marked as outdated.

Copy link
Copy Markdown

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Choose a reason for hiding this comment

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

🤖 Paddle-CI-Agent | pr_review | 2026-05-20 14:47:17

📋 Review 摘要

PR 概述:将 flash_mask 从独立包迁移至 paddlefleet_ops 内置模块,解决 nvidia-cutlass-dsl 版本冲突问题。
变更范围fastdeploy/model_executor/layers/attention/requirements.txttests/layers/
影响面 Tag[OP]

问题

级别 文件 概述
🔴 Bug flash_attn_backend.py:102 内层 except 静默后 fa4 未绑定,NameError 不被外层 except ImportError 捕获,模块级 import 在 SM≥100 无 paddlefleet_ops 时崩溃

📝 PR 规范检查

PR 标题格式合规([Others] 在官方 Tag 列表中),描述各段(Motivation / Modifications / Usage or Command / Accuracy Tests / Checklist)均已填写,结构完整,无需修改。

总体评价

依赖迁移思路正确,但引入了一个关键异常处理缺陷:内层 except 静默异常后 fa4 未绑定,导致模块在 SM≥100 平台上若未安装 paddlefleet_ops 则无法 import,需修复后合入。

logger.info(f"The current platform[sm{get_sm_version()}] can't import Flash Attention V4.")

global flashmask_attention_v4
flashmask_attention_v4 = fa4
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Bug fa4 在内层 except 执行后为未绑定变量,此行会抛出 NameError: name 'fa4' is not defined

根因:当 paddlefleet_ops 不可用(ImportError)或 is_flash_mask_available() 返回 FalseModuleNotFoundError)时,内层 except 捕获并静默,但 fa4 从未被赋值。外层 except ImportError 仅捕获 ImportError,无法捕获 NameError,异常因此向上传播。

影响init_flash_attn_version() 在模块顶层被调用(line 124),在任何 SM≥100 且未安装 paddlefleet_ops 的机器上,import 该模块即会崩溃。测试中 test_fa4_flash_mask_unavailabletest_fa4_paddlefleet_import_error 均通过 except NameError: pass 掩盖了这个问题。

建议修复:将成功路径的赋值移入 if is_flash_mask_available(): 块内:

try:
    from paddlefleet_ops import is_flash_mask_available
    if is_flash_mask_available():
        from paddlefleet_ops.flash_mask.cute.interface import (
            flashmask_attention as fa4,
        )
        global flashmask_attention_v4
        flashmask_attention_v4 = fa4
        FLASH_ATTN_VERSION = 4
        logger.info("The current platform supports Flash Attention V4.")
    else:
        raise ModuleNotFoundError("flash_mask not available.")
except (ImportError, ModuleNotFoundError):
    logger.info(f"The current platform[sm{get_sm_version()}] can't import Flash Attention V4.")

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.

6 participants