【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3)#7502
Conversation
|
Thanks for your contribution! |
01b76a3 to
c19ef9d
Compare
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-20 18:42:10\n\n## 📋 Review 摘要\n\nPR 概述:为 Windows 平台添加构建支持,包括setup_ops.py平台条件链接参数和build.bat构建脚本\n变更范围:custom_ops/setup_ops.py、build.bat\n影响面 Tag:OPDocs/CI\n\n### 📝 PR 规范检查\n\nPR 标题缺少官方 Tag 前缀。当前标题:「【Hackathon 10th Spring No.46】Add Windows build system support (Part 2/3)」\n\n标题建议(可直接复制):\n-[Feature] Add Windows build system support (Part 2/3)\n\n另外,PR 描述中 Motivation 部分提到原代码 "unconditionally passes-lcudaand-lcudartlinker flags",但实际原代码是-lcuda和-lnvidia-ml(非-lcudart),建议修正描述以避免误导 reviewer。\n\n### 问题\n\n未发现阻塞性问题。\n\n### 总体评价\n\n代码变更整体合理:setup_ops.py的平台判断逻辑正确(sys模块已在文件头部导入,Windows 使用/DEFAULTLIB:MSVC 语法对应 Linux 的-l标志);build.bat结构清晰,错误处理到位(使用enabledelayedexpansion+!ERRORLEVEL!),TODO 注释明确标注了后续需要补充的步骤(init/cleanup/copy_ops 等)。作为 Part 2/3 的增量 PR,范围适当。"
|
Re: review 4139266332
|
Motivation
FastDeploy's
custom_ops/setup_ops.pyunconditionally passes-lcudaand-lnvidia-mllinker 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-lnvidia-mlflags 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