Skip to content

[Cherry-Pick][RL]Remove extra argument from per_token_quant calls in deepgemm MoE backend, fix #6850#7258

Merged
zoooo0820 merged 1 commit intoPaddlePaddle:release/2.5from
zhanghonggeng:cherry-pick-fix_q
Apr 9, 2026
Merged

[Cherry-Pick][RL]Remove extra argument from per_token_quant calls in deepgemm MoE backend, fix #6850#7258
zoooo0820 merged 1 commit intoPaddlePaddle:release/2.5from
zhanghonggeng:cherry-pick-fix_q

Conversation

@zhanghonggeng
Copy link
Copy Markdown
Contributor

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

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.

Copilot AI review requested due to automatic review settings April 8, 2026 13:35
@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Apr 8, 2026

Thanks for your contribution!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 旨在修复 DeepGEMM MoE 后端中对 per_token_quant 自定义 GPU op 的错误调用方式,移除多余的入参以匹配当前算子签名,避免运行时因参数不匹配而报错。

Changes:

  • 在 DeepGEMM MoE 后端两处 per_token_quant 调用中移除多余的第三个参数。
  • 统一 FD_USE_PHI_FP8_QUANT=False 分支下的量化调用方式,仅传递 (input, block_size)

Comment on lines 120 to 124
# down_proj
if not fastdeploy.envs.FD_USE_PHI_FP8_QUANT:
ffn_in_x, ffn_in_x_scale_tensor = fastdeploy.model_executor.ops.gpu.per_token_quant(
ffn_out, quant_config_weight_block_size_0, not disable_ue8m0_cast
ffn_out, quant_config_weight_block_size_0
)
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

该 PR 标题作为 Cherry-Pick 仍未满足仓库约定格式:需要在标题末尾追加原 develop PR 编号(例如 ...(#xxxx))。当前标题缺少原始 PR ID,可能触发 CI 的 Cherry-Pick 校验失败。

Copilot uses AI. Check for mistakes.
Comment on lines 473 to 477
# down_proj
if not fastdeploy.envs.FD_USE_PHI_FP8_QUANT:
ffn_in_x, ffn_in_x_scale_tensor = fastdeploy.model_executor.ops.gpu.per_token_quant(
ffn_out, self.quant_config.weight_block_size[0], self.quant_config.deepgemm_scale_ue8m0
ffn_out, self.quant_config.weight_block_size[0]
)
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

PR 描述的 Motivation/Modifications/Accuracy Tests 等关键字段目前为空,且 Checklist 中未解释为何不补充单测与精度结果。该改动涉及量化/后端调用(可能影响运行与数值路径),建议补充:1) 修改动机与影响范围;2) 至少给出相关单测/命令或说明为何无需;3) 如适用提供精度对比结果。

Copilot uses AI. Check for mistakes.
@zhanghonggeng zhanghonggeng changed the title [Cherry-Pick][RL]Remove extra argument from per_token_quant calls in deepgemm MoE backend [RL]Remove extra argument from per_token_quant calls in deepgemm MoE backend Apr 8, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/2.5@7af95be). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             release/2.5    #7258   +/-   ##
==============================================
  Coverage               ?   68.51%           
==============================================
  Files                  ?      390           
  Lines                  ?    54405           
  Branches               ?     8577           
==============================================
  Hits                   ?    37276           
  Misses                 ?    14435           
  Partials               ?     2694           
Flag Coverage Δ
GPU 68.51% <ø> (?)

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 changed the title [RL]Remove extra argument from per_token_quant calls in deepgemm MoE backend [Cherry-Pick][RL]Remove extra argument from per_token_quant calls in deepgemm MoE backend, fix #6850 Apr 9, 2026
@zoooo0820 zoooo0820 merged commit 6b53bbb into PaddlePaddle:release/2.5 Apr 9, 2026
36 of 42 checks passed
Copy link
Copy Markdown

@fastdeploy-bot fastdeploy-bot left a comment

Choose a reason for hiding this comment

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

🤖 AI Code Review | 2026-04-09

📋 Review 摘要

PR 概述:修复 deepgemm MoE backend 中 per_token_quant 函数调用时传入多余的第三个参数

变更范围fastdeploy/model_executor/layers/moe/fused_moe_deepgemm_backend.py

影响面 Tag[RL]

📝 PR 规范检查

PR 描述中的 MotivationModifications 部分为空,建议补充:

描述模板(可直接复制):

## Motivation

`per_token_quant` 函数签名只接受两个参数(`input``block_size`),但代码中传入了第三个参数导致运行时报错。

## Modifications

移除 `per_token_quant` 函数调用中的第三个参数:
- `m_grouped_fp8_gemm_nt_contiguous_custom_python_op` 函数中的调用
- `apply_ep_prefill` 方法中的调用

问题

未发现阻塞性问题。

总体评价

✅ 修改正确。已验证 per_token_quant 函数签名(来自 cpp_extensions.cc)只接受 inputblock_size 两个参数,其他调用点(测试文件、triton_backend 等)也都使用两个参数。建议补充 PR 描述以提高可追溯性。

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.

5 participants