[Windows] export operator kernel registry#79419
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-specific kernel registry visibility issue across DLL boundaries by moving OperatorWithKernel::AllOpKernels() from a header inline implementation to an exported out-of-line definition in operator.cc, ensuring the registry is shared between libpaddle.dll and test executables.
Changes:
- Replaces the header-inline local static op kernel registry with an exported (
PADDLE_API)OperatorWithKernel::AllOpKernels()declaration. - Adds the out-of-line
OperatorWithKernel::AllOpKernels()definition inoperator.ccso Windows uses a single registry instance across module boundaries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| paddle/fluid/framework/operator.h | Changes AllOpKernels() from header-inline to PADDLE_API declaration to avoid per-module static registry duplication on Windows. |
| paddle/fluid/framework/operator.cc | Adds the out-of-line AllOpKernels() definition hosting the single function-local static registry instance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
risemeup1111
left a comment
There was a problem hiding this comment.
代码层面未发现需要阻塞合入的问题。这个改动把 OperatorWithKernel::AllOpKernels() 从 header inline 挪到 operator.cc 并加上导出声明,和 PR 描述里的 Windows DLL registry 共享问题一致;我没有看到需要行级修改的缺陷。
CI 方面仍需等待:Windows 相关 build/test 还在运行,另外当前有 clone/构建链路失败。其中两个 clone 失败是 third_party/pocketfft submodule 403,Inference build 失败停在下载/更新测试分支阶段,暂未看到和本次代码改动直接相关的编译错误。
|
@ShigureNyako 看看 CI 里又是什么奇奇怪怪的报错?sleef?最近没动过吧? |
|
看了当前 head 证据:
建议:这个 PR 暂时不需要改代码。优先重新触发一次会重新生成 |
|
@ShigureNyako 可是 #79422 也挂了,就很奇怪 |
|
更新:#79422 这边看起来不是反例,反而更支持“clone/submodule/source artifact 链路异常”。 我核了 PaddlePaddle/Paddle#79422 当前失败:
另外 #79422 的 Clone-linux / Clone Paddle 虽然是 success,但在打包上传 所以我会把结论收敛成:#79419 的 SLEEF 不是 PR 代码问题;#79422 说明更像是 #79420 这组“延迟到 merge PR 后再递归 submodule update/打包”的 clone workflow 改动引入/暴露了脏 worktree 或不完整 submodule 被打包的问题。建议优先修 clone job:submodule/tag 处理失败不要继续打包;merge 后对 submodule 做强制 deinit/clean + |
|
@ShigureNyako 这个 PR rerun clone 后过了,但 #79422 并没有,我怀疑是某个 runner / 机器出了问题,你看看呢? |
|
按 runner / 机器再看了一轮,基本同意“某个 runner/workspace 状态有问题”的方向,但更具体地说像是 clone runner slot 的脏 workspace + workflow 没有强制重建 submodule,不是某个下游 build runner 单机坏了。 关键对比:
所以建议先处理 |
|
@ShigureNyako 你不用看下游的 runner,就看 clone 流水线,整理一个表格,对应这两个 PR 的几次 rerun,哪次跑的是哪个 runner,是否成功 |
|
只看
结论只针对 clone:这几次 clone job 本身都是 |
|
@ShigureNyako 好, |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #79419 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 1
Lines ? 3
Branches ? 0
===========================================
Hits ? 3
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CI报告基于以下代码生成(30分钟更新一次): 1 Required任务 : 44/49 通过
2 失败详情🔴 Build Fleet whl — 环境问题(置信度: 高)错误类型: 环境问题 | 置信度: 高
关键日志:
修复建议:
关联变更: 未发现与本 PR 修改文件直接关联。 🔴 Mac-CPU / Build and test — 未知(置信度: 低)错误类型: 未知 | 置信度: 低
关键日志:
单 Job 深度日志只返回失败步骤 修复建议:
关联变更: 未发现与本 PR 修改文件直接关联。 |
|
观察更新(还是只聚焦 clone / source artifact):
结论:目前 clone 问题看起来已经通过避开 |
|
新 head
这次还是没有跑到前面下线等待清理的 当前几个新失败和之前
结论:新 head 的 Linux clone job 都是绿的;之前的 submodule/pathspec 问题没有复现。当前需要继续观察下游 rerun,以及等 |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-07-06 21:08:12 Asia/Shanghai
📋 Review 摘要
PR 概述:将 OperatorWithKernel::AllOpKernels() 的 legacy Fluid kernel registry 从 header inline 局部静态移动到 operator.cc,并放开 Windows-Inference 的 operator_test。
变更范围:paddle/fluid/framework/operator.*、tools/windows/run_unittests.sh
影响面 Tag:Operator Mechanism Execute Infrastructure
问题
未发现阻塞性问题。PR 规范问题在下面章节报,不要在这里重复
📝 PR 规范检查
标题当前使用 [Windows],该 Tag 不在 Paddle PR 模板枚举中;描述结构和“是否引起精度变化”字段符合规范。
标题建议(可直接复制):
[Operator Mechanism] export operator kernel registry
PR 描述建议(点击展开,可直接复制)
### PR Category
<!-- One of [ User Experience | Execute Infrastructure | Operator Mechanism | CINN | Custom Device | Performance Optimization | Distributed Strategy | Parameter Server | Communication Library | Auto Parallel | Inference | Environment Adaptation ] -->
Operator Mechanism
### PR Types
<!-- One of [ New features | Bug fixes | Improvements | Performance | BC Breaking | Deprecations | Docs | Devs | Not User Facing | Security | Others ] -->
Bug fixes
### Description
<!-- Describe what you’ve done -->
将 `OperatorWithKernel::AllOpKernels()` 从 `operator.h` 的 header inline 实现移动到 `operator.cc`,并在声明处使用 `PADDLE_API` 导出,避免 Windows DLL 边界下测试 exe 与 `libpaddle.dll` 各自持有一份 Fluid op kernel registry。
影响范围:legacy Fluid `OperatorWithKernel` kernel registry。
验证方式:`prek --files paddle/fluid/framework/operator.h paddle/fluid/framework/operator.cc`
### 是否引起精度变化
<!-- one of the following [ 是 | 否 ]-->
否总体评价
本轮按 diff 回溯了 legacy kernel registry 的注册/查询路径、TEST_API 条件展开和 Windows skip list 使用点,未发现需要阻塞合入的代码问题。建议按 Paddle PR 标题 Tag 规范调整标题。
|
@ShigureNyako 来 review 一下这个 pr |
|
你的PR提交成功,感谢你对开源项目的贡献! |
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
从 Windows VS2022 CI 修复中拆出
OperatorWithKernel::AllOpKernels()的单独修复。Windows 下 header inline 函数里的局部静态 registry 可能在测试 exe 和
libpaddle.dll中各有一份,导致REGISTER_OP_CPU_KERNEL写入的 Fluid op kernel 在OperatorWithKernel::ChooseKernel()查询时不可见,进而触发operator_test中kernels_iter == all_op_kernels.end()的错误。本 PR 将
AllOpKernels()从 header inline 实现改为operator.cc中的TEST_API导出函数,保证 Windows 测试构建跨 DLL 边界使用同一份 op kernel registry;普通非测试构建中TEST_API为空,不新增PADDLE_APIruntime 导出符号。同时从 Windows-Inference skip list 中放出
operator_test,让该 CI 直接验证上述 registry 修复。关联拆分来源:#79381
验证:
git diff --checkprek --files paddle/fluid/framework/operator.h paddle/fluid/framework/operator.cc tools/windows/run_unittests.shbash -n tools/windows/run_unittests.sh是否引起精度变化
否