Skip to content

[Docs][BugFix] fix mla log#7243

Merged
chang-wenbin merged 2 commits intoPaddlePaddle:developfrom
chang-wenbin:FIX_MLA_LOG
Apr 13, 2026
Merged

[Docs][BugFix] fix mla log#7243
chang-wenbin merged 2 commits intoPaddlePaddle:developfrom
chang-wenbin:FIX_MLA_LOG

Conversation

@chang-wenbin
Copy link
Copy Markdown
Collaborator

Motivation

fix mla log

💡 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.

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Apr 8, 2026

Thanks for your contribution!

PaddlePaddle-bot

This comment was marked as outdated.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7243   +/-   ##
==========================================
  Coverage           ?   73.88%           
==========================================
  Files              ?      383           
  Lines              ?    53510           
  Branches           ?     8377           
==========================================
  Hits               ?    39537           
  Misses             ?    11207           
  Partials           ?     2766           
Flag Coverage Δ
GPU 73.88% <ø> (?)

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.

zhoutianzi666
zhoutianzi666 previously approved these changes Apr 9, 2026
@EmmonsCurse
Copy link
Copy Markdown
Collaborator

/skip-ci all for only logger change~

Copy link
Copy Markdown
Collaborator

@EmmonsCurse EmmonsCurse left a comment

Choose a reason for hiding this comment

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

LGTM~ Skip check for Docs.

@EmmonsCurse EmmonsCurse changed the title [BugFix]fix mla log [Docs][BugFix] fix mla log Apr 13, 2026
@chang-wenbin chang-wenbin merged commit 6213ad5 into PaddlePaddle:develop Apr 13, 2026
37 of 38 checks passed
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.

🤖 AI Code Review | 2026-04-13 12:17 CST

📋 Review 摘要

PR 概述:修改 MLA attention backend 的日志格式(参数化 → f-string)

变更范围model_executor/layers/attention/

影响面 Tag[OP]

📝 PR 规范检查

检查项 问题
标题 Tag 使用了 [Docs] tag,但此 PR 修改的是代码日志格式,非文档变更
Motivation 仅写 "fix mla log",未说明为何需要修改日志格式
Modifications 未填写

标题建议(可直接复制):

  • [BugFix][OP] 优化 MLA attention 日志格式

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

## Motivation
将 logger.warning 从参数化格式改为 f-string 格式,[请说明原因]

## Modifications
- 修改 `mla_attention_backend.py` 中的日志格式

问题

级别 文件 概述
🟡 建议 mla_attention_backend.py:279-282 使用 f-string 替代参数化日志,会降低性能

总体评价

此变更将日志从参数化格式改为 f-string 格式,属于性能回退

  • 参数化日志 logger.warning("val=%d", val) 在日志级别不匹配时(如 INFO 级别运行)会跳过字符串格式化,性能更优
  • f-string 始终执行字符串拼接,即使日志不会被输出

建议:恢复参数化格式,或说明为何必须使用 f-string(如需要更复杂的格式化逻辑)。

@@ -277,10 +277,8 @@ def __init__(
self.padding_num_heads = 64 - self.num_heads
self.heads_need_padding = True
logger.warning(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议 使用 f-string 替代参数化日志会降低性能。

原因

  • logger.warning("format %d", val) - 参数化格式,日志级别不匹配时跳过格式化,性能更优
  • logger.warning(f"format {val}") - f-string 始终执行字符串拼接

建议修复方式
恢复参数化格式,或说明为何必须使用 f-string。

logger.warning(
    "MLA num_attention_heads is less than 64, force to use 64 num_heads. "
    "current num_heads=%d, tp_size=%d",
    self.num_heads,
    fd_config.parallel_config.tensor_parallel_size,
)

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