Skip to content

[Feature]【Hackathon 10th Spring No.46】MSVC/CMake Windows build fix [cf]#7700

Open
ghost wants to merge 1 commit intoPaddlePaddle:developfrom
CloudForge-Solutions:task/h10-46-msvc-cmake-fix-v3
Open

[Feature]【Hackathon 10th Spring No.46】MSVC/CMake Windows build fix [cf]#7700
ghost wants to merge 1 commit intoPaddlePaddle:developfrom
CloudForge-Solutions:task/h10-46-msvc-cmake-fix-v3

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented May 2, 2026

Motivation

Modifications

Usage or Command

Accuracy Tests

Checklist

  • I have submitted the CLA (only first PR)
  • My PR title follows the convention
  • My changes pass all tests

@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:14 — with GitHub Actions Inactive
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 2, 2026

CLA assistant check
All committers have signed the CLA.

@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:14 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:14 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@ghost ghost temporarily deployed to Metax_ci May 2, 2026 17:15 — with GitHub Actions Inactive
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 2, 2026

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label May 2, 2026
PaddlePaddle-bot

This comment was marked as outdated.

@PaddlePaddle-bot
Copy link
Copy Markdown

PaddlePaddle-bot commented May 2, 2026

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-05-03 21:55:02

CI报告基于以下代码生成(30分钟更新一次):


1 任务总览

当前 CI 尚未完全执行:6个核心 Workflow 处于 action_required 状态(等待人工审批),目前已执行任务中无失败。待审批工作流执行后才能完整评估 CI 状态。

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
2(0) 2 1 0 1 0 0

⚠️ 注意:以下 6 个 Workflow 处于 action_required 状态(等待审批后才会执行):Codestyle-Check、Approval、CI_HPU、CI_XPU、Check PR Template、PR Build and Test。这些 Workflow 需人工审批触发。

注意:action_required workflows 不计入上表的任务统计。


2 任务状态汇总

2.1 Required 任务:0/0 通过

未检测到必选任务(GitHub Branch Protection Rules 未配置或 API 权限不足),当前所有任务均视为可选。

2.2 可选任务 — 1/2 通过

可选任务不阻塞合并,失败仅供参考。

状态 任务 耗时 日志 重跑
Trigger Jenkins for PR - Job -
其余 1 个可选任务通过 - - -

3 失败详情(仅 required)

无 required 失败任务。


⚠️ 数据说明:有 1 个 Workflow(run_id: 25280826880)因网络 TLS 握手超时无法获取状态,建议手动查看 CI 详情 核实。

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.

🤖 Paddle-CI-Agent | pr_review | 2026-05-03 22:07:43

📋 Review 摘要

PR 概述:新增 Windows MSVC/CMake 构建支持,包括一键构建脚本 build.batsetup_ops.py 的平台差异化链接参数
变更范围build.bat(新增)、custom_ops/setup_ops.py
影响面 Tag[OP] [Feature]

📝 PR 规范检查

标题末尾附有非官方标签 [cf],且 【Hackathon 10th Spring No.46】 为非标准格式;PR 描述中所有 section 内容均为 TODO 占位符,且 Checklist 结构与模板不符,需要补充完整。

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

  • [Feature] Add Windows MSVC/CMake build support (build.bat + setup_ops.py cross-platform link args)

PR 描述建议(可直接复制):

## Motivation
在 Windows 平台上使用 MSVC 编译器构建 FastDeploy custom ops 时,原有链接参数 `-lcuda``-lnvidia-ml` 为 Linux/GCC 格式,在 Windows 下编译失败。本 PR 修复了跨平台链接参数问题,并新增 Windows 一键构建脚本 `build.bat`## Modifications
- `custom_ops/setup_ops.py`:根据 `sys.platform` 区分 Windows(`/DEFAULTLIB:cuda.lib``/DEFAULTLIB:nvml.lib`)和 Linux(`-lcuda``-lnvidia-ml`)的 CUDA 链接参数
- `build.bat`:新增 Windows 批处理构建脚本,支持构建 custom ops、打包 wheel 和 pip 安装;通过 BUILD_MODE 参数控制范围(0=仅 ops,1=完整构建);支持 `FD_BUILDING_ARCS``FD_CPU_USE_BF16` 环境变量

## Usage or Command

在 Developer Command Prompt(已配置 MSVC 编译环境)中执行:

    # 完整构建(custom ops + wheel + pip install)
    build.bat 1 python

    # 仅构建 custom ops
    build.bat 0

    # 指定 CUDA 架构后仅构建 ops
    set FD_BUILDING_ARCS=[90]
    build.bat 0

## Accuracy Tests
N/A(构建脚本与链接参数变更,不影响模型精度)

## Checklist

- [x] 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.

问题

级别 文件 概述
🟡 建议 build.bat:1 @echo off 应置于文件第一行,否则首行 REM 注释会被打印到控制台
🟡 建议 build.bat:83 wheel 安装 for 循环缺少未匹配任何 .whl 时的保护,可能导致误报成功
🟡 建议 custom_ops/setup_ops.py:14 模块文档字符串改为 Hackathon 任务引用,移除了有效模块描述,建议恢复

总体评价

setup_ops.py 中平台差异化链接参数的修改方向正确,可以解决 Windows MSVC 构建问题;build.bat 结构清晰,功能覆盖基本完整。存在批处理脚本小逻辑缺陷(@echo off 位置、wheel 安装循环无保护)、模块文档字符串退化以及 PR 描述未填充等问题,建议修正后合入。

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