Skip to content

[Bug fix] Fix missing instantiation of isfinite/isinf/isnan kernels on Windows#75817

Merged
luotao1 merged 1 commit intoPaddlePaddle:developfrom
youge325:isfinite_kernel
Oct 14, 2025
Merged

[Bug fix] Fix missing instantiation of isfinite/isinf/isnan kernels on Windows#75817
luotao1 merged 1 commit intoPaddlePaddle:developfrom
youge325:isfinite_kernel

Conversation

@youge325
Copy link
Copy Markdown
Contributor

@youge325 youge325 commented Oct 13, 2025

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

三处改动都是为了解决 Windows 平台上 isfinite 系列算子在编译/链接阶段缺失实例化的问题,让 CPU/GPU 的显式模板实例都能正常生成:

  • isfinite_kernel.h:在 _WIN32 分支补充了 INSTANTIATE_ISFINITE_KERNEL_Isfinite 宏定义。之前只有 isinfisnan 的显式实例化宏,Windows 链接时会缺少 IsfiniteKernel 的实例。
  • isfinite_kernel.cc:在 Windows 条件编译区新增了 IsfiniteKernel 对各数据类型(包含 float/bfloat16 与复数)的显式模板实例化,避免 Windows 链接缺符号;顺带补齐了 Isinf/Isnan 的复数类型实例。
  • isfinite_kernel.cu:同样在 Windows 分支补充了 GPU 侧 IsfiniteKernel 的显式实例化,确保在 GPU 后端也不会漏掉相应符号。

整体效果是在 Windows 编译器不会自动生成这些内联模板的场景下,手动提供所需实例,消除 isfinite/isinf/isnan 内核的链接缺失问题。

从以下PR拆分出来:

…n Windows

三处改动都是为了解决 Windows 平台上 `isfinite` 系列算子在编译/链接阶段缺失实例化的问题,让 CPU/GPU 的显式模板实例都能正常生成:

- isfinite_kernel.h:在 `_WIN32` 分支补充了 `INSTANTIATE_ISFINITE_KERNEL_Isfinite` 宏定义。之前只有 `isinf` 和 `isnan` 的显式实例化宏,Windows 链接时会缺少 `IsfiniteKernel` 的实例。
- isfinite_kernel.cc:在 Windows 条件编译区新增了 `IsfiniteKernel` 对各数据类型(包含 float/bfloat16 与复数)的显式模板实例化,避免 Windows 链接缺符号;顺带补齐了 `Isinf/Isnan` 的复数类型实例。
- isfinite_kernel.cu:同样在 Windows 分支补充了 GPU 侧 `IsfiniteKernel` 的显式实例化,确保在 GPU 后端也不会漏掉相应符号。

整体效果是在 Windows 编译器不会自动生成这些内联模板的场景下,手动提供所需实例,消除 `isfinite`/`isinf`/`isnan` 内核的链接缺失问题。
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Oct 13, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot Bot added the contributor External developers label Oct 13, 2025
@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

1 similar comment
@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Oct 14, 2025
@luotao1
Copy link
Copy Markdown
Contributor

luotao1 commented Oct 14, 2025

#75684 (review) approved by @swgu98
image

@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@luotao1 luotao1 merged commit 16e0275 into PaddlePaddle:develop Oct 14, 2025
103 of 112 checks passed
@youge325 youge325 deleted the isfinite_kernel branch October 14, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants