[CI]【Hackathon 10th Spring No.46】Windows build system guards (2/3)#7328
[CI]【Hackathon 10th Spring No.46】Windows build system guards (2/3)#7328r-cloudforge wants to merge 12 commits intoPaddlePaddle:developfrom
Conversation
|
cloudforge1 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Thanks for your contribution! |
fastdeploy-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-11
📋 Review 摘要
PR 概述: 为 Windows 添加构建系统支持,修复 CUDA 链接参数的平台兼容性问题
变更范围: custom_ops/setup_ops.py、build.bat
影响面 Tag: [CI]
📝 PR 规范检查
PR 标题和描述整体符合规范,仅有一处疑问:
❓ 疑问 - PR 描述与实际变更不一致
PR 描述中提到:
FastDeploy's
custom_ops/setup_ops.pyunconditionally passes-lcudaand-lcudartlinker flags
但根据 diff,实际原参数是 -lcuda 和 -lnvidia-ml,而非 -lcudart。请确认描述是否需要更新。
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | build.bat:16 |
缺少关键环境变量传递 |
| 🟡 建议 | build.bat:16 |
缺少 Python 版本检查 |
| 🟡 建议 | build.bat:16 |
缺少帮助信息 |
总体评价
setup_ops.py 的平台条件判断是正确的修复,解决了 Windows MSVC 无法解析 GCC 风格链接参数的问题。build.bat 提供了基础的 Windows 构建支持,但相比 build.sh 功能较为简化,建议进一步完善以保持跨平台功能对等性。
| REM See the License for the specific language governing permissions and | ||
| REM limitations under the License. | ||
|
|
||
| REM FastDeploy Windows build script |
There was a problem hiding this comment.
🟡 建议 缺少关键环境变量传递
build.bat 调用 setup_ops.py install 时没有传递 FD_BUILDING_ARCS 和 FD_CPU_USE_BF16 环境变量。与 build.sh 不一致,Windows 用户无法自定义 CUDA 架构或启用 CPU BF16。
建议添加类似 build.sh 的环境变量支持。
| REM See the License for the specific language governing permissions and | ||
| REM limitations under the License. | ||
|
|
||
| REM FastDeploy Windows build script |
There was a problem hiding this comment.
🟡 建议 缺少 Python 版本检查
build.sh 有 Python 版本检查(确保 >= 3.9),build.bat 缺少此检查。
建议添加版本验证以避免兼容性问题。
| REM See the License for the specific language governing permissions and | ||
| REM limitations under the License. | ||
|
|
||
| REM FastDeploy Windows build script |
There was a problem hiding this comment.
🟡 建议 缺少帮助信息
build.sh 有完整的 show_help() 函数,build.bat 只有简单的头部注释。
建议添加 /? 或 -h 支持,输出详细的参数说明和示例。
Motivation
FastDeploy's
custom_ops/setup_ops.pyunconditionally passes-lcudaand-lcudartlinker flags, which are GCC/Linux-style and invalid on MSVC(Windows uses
.liblinking via the CUDA Toolkit paths).Additionally,
build.shexists for Linux but there is no Windows equivalent.This is Part 2 of 3 for 【Hackathon 10th Spring No.46】(Windows Build Support):
#ifndef _WIN32guards on POSIX-only includessetup_ops.pyplatform-conditional link args +build.bat/dev/shm,os.killpg,os.setsid,forkModifications
setup_ops.py: Wrapped-lcudaand-lcudartflags insys.platform != "win32"check. On Windows, MSVC finds CUDA librariesvia
CUDA_PATHenvironment variable without explicit-lflags.build.bat(new): Windows-native build script matchingbuild.shstructure. Supports
BUILD_MODE=0(custom_ops only) andBUILD_MODE=1(full wheel build). Uses
setlocal EnableDelayedExpansionfor propererror handling.
Usage or Command
On Linux, no change — the
sys.platformcheck is only active on Windows.Accuracy Tests
Not applicable — build system changes only.
Verified on Windows Server 2022 with MSVC 14.44:
python setup_ops.py installparses correctly (full build requires CUDA toolkit).Pipeline Evidence:
Checklist
sys.platformguard only affects Windowsbuild.batmirrorsbuild.shstructurepre-commithooks pass