Skip to content

【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3)#7502

Open
bobby-cloudforge wants to merge 1 commit intoPaddlePaddle:developfrom
CloudForge-Solutions:task/h10-046-win-build-system-1
Open

【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3)#7502
bobby-cloudforge wants to merge 1 commit intoPaddlePaddle:developfrom
CloudForge-Solutions:task/h10-046-win-build-system-1

Conversation

@bobby-cloudforge
Copy link
Copy Markdown

Motivation

Document Windows build-system notes and add minimal clarifying comments to build.bat and setup_ops.py.

Modifications

  • Small comments added to build.bat and custom_ops/setup_ops.py to clarify Windows-specific steps. No functional changes.

Checklist

  • Comments only; no behavioral changes.

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Apr 20, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Apr 20, 2026
@bobby-cloudforge bobby-cloudforge changed the title 【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3) 【Hackathon 10th Spring No.46】[Build] Windows build system -part Apr 20, 2026
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-20 13:54 CST

📋 Review 摘要

PR 概述:新增 Windows 构建脚本 build.bat,并为 setup_ops.py 添加 Windows 平台链接器配置
变更范围build.bat(新增)、custom_ops/setup_ops.py
影响面 TagOP CI

📝 PR 规范检查

PR 标题缺少官方 Tag,且描述与实际变更不一致(描述称"仅添加注释",但实际新增了 build.bat 文件并修改了 setup_ops.py 的链接逻辑)。

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

  • [Feature] Add Windows build script (build.bat) and platform-specific linker config (Part 2/3)

问题

级别 文件 概述
🔴 Bug build.bat:62 setup_ops.py install 缺少 --install-libcopy_ops 步骤,wheel 不包含 custom ops
🟡 建议 build.bat:18 注释写 "Python 3.10+" 但代码检查的是 >= 3.9
🟡 建议 build.bat:80 缺少 init/version_info/cleanup 等构建步骤

总体评价

setup_ops.py 的平台适配逻辑正确,Windows MSVC 链接器 flag 符合规范。但 build.bat 存在关键流程缺失——custom ops 编译产物未拷贝至 fastdeploy 源码目录,导致最终打包的 wheel 不包含 ops,使用该脚本构建的产物功能不完整。建议参考 build.shbuild_and_install_ops + copy_ops 流程补全。

Comment thread build.bat

REM FastDeploy Windows build script
REM Mirrors build.sh for Windows environments.
REM Requires: Visual Studio Build Tools, CUDA Toolkit, Python 3.10+
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议 注释写的是 Python 3.10+,但下方第 36-43 行的版本检查逻辑实际要求的是 >= 3.9,与 build.sh 一致。

建议保持一致:

REM Requires: Visual Studio Build Tools, CUDA Toolkit, Python 3.9+

Comment thread build.bat
if !ERRORLEVEL! neq 0 (
echo [FAIL] Custom ops build failed.
popd
exit /b 1
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 此处直接调用 setup_ops.py install 没有指定 --install-lib 参数,编译产物会安装到 Python 的 site-packages 而不是临时目录。

对比 build.sh 的流程:

  1. setup_ops.py install --install-lib ${tmp_dir} → 安装到临时目录
  2. copy_ops → 将产物拷贝到 fastdeploy/model_executor/ops/gpu
  3. setup.py bdist_wheel → 打包 wheel(包含 ops)

当前 build.bat 缺少这两个关键步骤,导致后续 setup.py bdist_wheel 打出的 wheel 不会包含编译好的 custom ops,最终 wheel 功能不完整。

建议参考 build.shbuild_and_install_ops + copy_ops 逻辑补全:

pushd custom_ops
set OPS_TMP_DIR=tmp
%PYTHON% setup_ops.py install --install-lib %OPS_TMP_DIR%
REM ... copy ops to fastdeploy\model_executor\ops\gpu
popd

Comment thread build.bat
if !ERRORLEVEL! neq 0 (
echo [FAIL] Wheel build failed.
exit /b 1
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议 对比 build.sh,当前 build.bat 缺少以下构建步骤,可能导致构建流程不完整:

  1. init:清理旧构建目录(build/*.egg-info)、安装 setuptools_scm
  2. version_info:写入 fastdeploy/version.txt(包含 git commit、Paddle 版本、CUDA 版本等)
  3. cleanup:构建完成后清理中间文件

如果这些步骤计划在 Part 3 中补充,建议在此处添加 REM TODO(Part 3) 注释说明。

@bobby-cloudforge bobby-cloudforge changed the title 【Hackathon 10th Spring No.46】[Build] Windows build system -part [CI]【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3) Apr 20, 2026
@bobby-cloudforge bobby-cloudforge changed the title [CI]【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3) 【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3) Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants