Skip to content

c++ code format#4527

Merged
zhupengyang merged 1 commit intoPaddlePaddle:developfrom
zhupengyang:format_code
Oct 22, 2025
Merged

c++ code format#4527
zhupengyang merged 1 commit intoPaddlePaddle:developfrom
zhupengyang:format_code

Conversation

@zhupengyang
Copy link
Copy Markdown
Collaborator

@zhupengyang zhupengyang commented Oct 21, 2025

Motivation

自定义算子代码格式和paddle主框架对齐

(暂时跳过 custom_ops/gpu_ops 下的代码,格式调整会对部分头文件重新排序,可能导致编译依赖错误)

Modifications

Usage or Command

  • pre-commit已增加格式化c++代码的功能,会在提交代码时自动格式化

  • 手动格式化

set -ex

readonly VERSION="13.0.0"
version=$(clang-format -version)

if ! [[ $version == *"$VERSION"* ]]; then
    pip install clang-format==13.0.0
fi

files=$(find ./custom_ops/xpu_ops -type f \( -name "*.cc" -o -name "*.h" -o -name "*.xpu" \))

clang-format -i $files

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 Oct 21, 2025

Thanks for your contribution!

hong19860320
hong19860320 previously approved these changes Oct 21, 2025
Copy link
Copy Markdown
Collaborator

@hong19860320 hong19860320 left a comment

Choose a reason for hiding this comment

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

LGTM

Language: Cpp
BasedOnStyle: Google
IndentWidth: 4
IndentWidth: 2
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.

这个是不是也影响其它硬件?是不是让qingqing 也 review一下?

qingqing01
qingqing01 previously approved these changes Oct 22, 2025
@zhupengyang zhupengyang changed the title [XPU] c++ code format c++ code format Oct 22, 2025
@zhupengyang zhupengyang force-pushed the format_code branch 4 times, most recently from 835650c to 51f6de0 Compare October 22, 2025 02:37
iosmers
iosmers previously approved these changes Oct 22, 2025
Copy link
Copy Markdown

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhupengyang zhupengyang merged commit 3a6883a into PaddlePaddle:develop Oct 22, 2025
15 of 18 checks passed
@zhupengyang zhupengyang deleted the format_code branch October 23, 2025 01:46
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