Skip to content

[Cpp API Compatibility] Support Compat tests on Windows#78670

Merged
SigureMo merged 9 commits intoPaddlePaddle:developfrom
youge325:cWin
Apr 19, 2026
Merged

[Cpp API Compatibility] Support Compat tests on Windows#78670
SigureMo merged 9 commits intoPaddlePaddle:developfrom
youge325:cWin

Conversation

@youge325
Copy link
Copy Markdown
Contributor

@youge325 youge325 commented Apr 14, 2026

PR Category

Execute Infrastructure

PR Types

New features

Description

在 Windows 平台编译兼容层测试,全都是符号导出问题,不确定要不要合入,暂时没有这个需求

是否引起精度变化

Copilot AI review requested due to automatic review settings April 14, 2026 06:49
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 14, 2026

你的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 Apr 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables building the C++ compat-layer unit tests under test/cpp/compat on Windows by removing the NOT WIN32 gate in the compat test CMake config, aligning with the goal of compiling compat tests on the Windows platform.

Changes:

  • Removed the global if(NOT WIN32) guard so compat cc_test(...) targets are registered on Windows as well.
  • Kept existing conditional logic for ROCm (WITH_ROCM) and CUDA nvcc-based tests (WITH_GPU + nv_test(...)) unchanged.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@youge325
Copy link
Copy Markdown
Contributor Author

youge325 commented Apr 15, 2026

编译过了,后面修复测试

@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@5651a4b). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #78670   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         4           
  Lines              ?        21           
  Branches           ?         0           
===========================================
  Hits               ?        21           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@SigureMo
Copy link
Copy Markdown
Member

在 Windows 平台编译兼容层测试,全都是符号导出问题,不确定要不要合入,暂时没有这个需求

有的,这个很有用,比如 paddlecodec 之前就因为符号导出问题暂时不考虑 windows 发包

@youge325
Copy link
Copy Markdown
Contributor Author

/re-run all-failed


TEST(GeneratorImplTest, ConstructWithNullptrCreatesDefaultGen) {
c10::GeneratorImpl impl(c10::Device(c10::kCPU));
c10::GeneratorImpl impl{c10::Device(c10::kCPU)};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块修改是合理的是么?之前的写法不需要了?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSVC编译器解析语法的时候有点问题

[24/1616] Building CXX object test\cpp\compat\CMakeFiles\c10_generator_impl_test.dir\c10_generator_impl_test.cc.obj
FAILED: test/cpp/compat/CMakeFiles/c10_generator_impl_test.dir/c10_generator_impl_test.cc.obj
"D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe"  /nologo /TP -DCUDA_TOOLKIT_ROOT_DIR="\"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0\"" -DCUDA_VERSION_MAJOR=\"13\" -DCUDA_VERSION_MINOR=\"0\" -DCUDNN_MAJOR_VERSION=\"9\" -DEIGEN_STRONG_INLINE=inline -DEIGEN_USE_GPU -DGLOG_NO_ABBREVIATED_SEVERITIES -DGOOGLE_GLOG_DLL_DECL="" -DLAPACK_FOUND -DNOMINMAX -DPADDLE_DISABLE_PROFILER -DPADDLE_DLL_INFERENCE -DPADDLE_ON_INFERENCE -DPADDLE_VERSION=3.4.0.dev20260414 -DPADDLE_VERSION_INTEGER=3004000 -DPADDLE_WITH_AVX -DPADDLE_WITH_CCCL -DPADDLE_WITH_CRYPTO -DPADDLE_WITH_CUDA -DPADDLE_WITH_DNNL -DPADDLE_WITH_MKLML -DPADDLE_WITH_PIP_CUDA_LIBRARIES -DPADDLE_WITH_POCKETFFT -DPADDLE_WITH_SSE3 -DPADDLE_WITH_TENSORRT -DPADDLE_WITH_TESTING -DPHI_INNER -DPHI_SHARED -DSTATIC_IR -DSTATIC_PADDLE -DUTF8PROC_STATIC -DWIN32_LEAN_AND_MEAN -DYAML_CPP_STATIC_DEFINE -D_XKEYCHECK_H -ID:\Lenovo\Paddle\third_party\cccl\thrust -ID:\Lenovo\Paddle\third_party\cccl\libcudacxx\include -ID:\Lenovo\Paddle\third_party\cccl\cub -ID:\Lenovo\Paddle\build -ID:\Lenovo\Paddle\paddle\fluid\framework\io -ID:\Lenovo\Paddle\patches\thrust -ID:\TensorRT-10.14.1.48\include -ID:\Lenovo\Paddle\build\third_party\install\zlib\include -ID:\Lenovo\Paddle\build\third_party\install -ID:\Lenovo\Paddle\build\third_party\install\gflags\include -ID:\Lenovo\Paddle\build\third_party\install\glog\include -ID:\Lenovo\Paddle\third_party\eigen3 -ID:\Lenovo\Paddle\third_party\threadpool -ID:\Lenovo\Paddle\third_party\dlpack\include -ID:\Lenovo\Paddle\build\third_party\install\xxhash\include -ID:\Lenovo\Paddle\build\third_party\install\warpctc\include -ID:\Lenovo\Paddle\build\third_party\install\warprnnt\include -ID:\Lenovo\Paddle\build\third_party\install\utf8proc\include -ID:\Lenovo\Paddle\build\third_party\install\mklml\include -ID:\Lenovo\Paddle\build\third_party\install\onednn\include -ID:\Lenovo\Paddle\build\third_party\install\protobuf\include -ID:\Lenovo\Paddle\third_party\nlohmann_json\include -ID:\Lenovo\Paddle\build\third_party\install\yaml-cpp\include -ID:\Users\Lenovo\AppData\Local\Programs\Python\Python311\include -ID:\Users\Lenovo\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\_core\include -ID:\Lenovo\Paddle\build\third_party\pybind\src\extern_pybind\include -ID:\Lenovo\Paddle\build\third_party\install\gtest\include -ID:\Lenovo\Paddle\build\third_party\install\libuv\include -ID:\Lenovo\Paddle\third_party\cccl -ID:\Lenovo\Paddle\build\third_party\install\cryptopp\include -ID:\Lenovo\Paddle\build\third_party\pocketfft\src -ID:\Lenovo\Paddle\build\third_party\dirent\src\extern_dirent\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -ID:\Lenovo\Paddle -ID:\Lenovo\Paddle\paddle\phi\api\include\compat -ID:\Lenovo\Paddle\paddle\phi\api\include\compat\torch\csrc\api\include -ID:\Lenovo\Paddle\build\..\paddle\fluid\framework\io /DWIN32 /D_WINDOWS  /W0  /GR /EHsc /w /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838  /arch:AVX /MT /O2 /Ob2 /DNDEBUG /bigobj /Zc:inline -std:c++17 /showIncludes /Fotest\cpp\compat\CMakeFiles\c10_generator_impl_test.dir\c10_generator_impl_test.cc.obj /Fdtest\cpp\compat\CMakeFiles\c10_generator_impl_test.dir\ /FS -c D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(30): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(31): error C2660: “testing::internal::CmpHelperNE”: 函数不接受 3 个参数
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1573): note: 参见“testing::internal::CmpHelperNE”的声明
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1573): note: 可能是“testing::AssertionResult testing::internal::CmpHelperNE(const char *,const char *,const T1 &,const T2 &)”
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(31): note: “testing::AssertionResult testing::internal::CmpHelperNE(const char *,const char *,const T1 &,const T2 &)”: 应输入 4 个参数,却提供了 3 个
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(31): note: 尝试匹配参数列表“(const char [24], const char [8], nullptr)”时
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(44): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(46): error C2660: “testing::internal::EqHelper<false>::Compare”: 函数不接受 3 个参数
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1481): note: 参见“testing::internal::EqHelper<false>::Compare”的声明
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1468): note: 可能是“testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(46): note: “testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”: 应输入 4 个参数,却提供了 3 个
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(46): note: 尝试匹配参数列表“(const char [20], const char [7], unsigned int)”时
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(50): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(55): error C2660: “testing::internal::EqHelper<false>::Compare”: 函数不接受 3 个参数
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1481): note: 参见“testing::internal::EqHelper<false>::Compare”的声明
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1468): note: 可能是“testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(55): note: “testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”: 应输入 4 个参数,却提供了 3 个
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(55): note: 尝试匹配参数列表“(const char [20], const char [9], uint64_t)”时
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(59): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(60): error C2660: “testing::internal::EqHelper<false>::Compare”: 函数不接受 3 个参数
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1481): note: 参见“testing::internal::EqHelper<false>::Compare”的声明
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1468): note: 可能是“testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(60): note: “testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”: 应输入 4 个参数,却提供了 3 个
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(60): note: 尝试匹配参数列表“(const char [18], const char [3], unsigned int)”时
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(100): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(140): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(141): error C2660: “testing::internal::EqHelper<false>::Compare”: 函数不接受 3 个参数
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1481): note: 参见“testing::internal::EqHelper<false>::Compare”的声明
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1468): note: 可能是“testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(141): note: “testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”: 应输入 4 个参数,却提供了 3 个
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(141): note: 尝试匹配参数列表“(const char [13], const char [8], nullptr)”时
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(145): error C2751: “c10::kCPU”: 无法限定函数参数的名称
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(152): error C2660: “testing::internal::EqHelper<false>::Compare”: 函数不接受 3 个参数
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1481): note: 参见“testing::internal::EqHelper<false>::Compare”的声明
D:\Lenovo\Paddle\build\third_party\install\gtest\include\gtest/gtest.h(1468): note: 可能是“testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(152): note: “testing::AssertionResult testing::internal::EqHelper<false>::Compare(const char *,const char *,const T1 &,const T2 &)”: 应输入 4 个参数,却提供了 3 个
D:\Lenovo\Paddle\test\cpp\compat\c10_generator_impl_test.cc(152): note: 尝试匹配参数列表“(const char [13], const char [11], PyObject *)”时
[25/1616] Linking CXX shared library paddle\phi\phi.dll
ninja: build stopped: subcommand failed.

在 MSVC 的解析路径里, c10::GeneratorImpl impl(c10::Device(c10::kCPU)); 被当成了“声明一个名为 impl 的函数”,而不是“构造一个 impl 对象”,所以直接用花括号初始化来消除歧义

#else
return GetDsoHandleFromSearchPath(
FLAGS_cuda_dir, win_cublas_lib, true, {cuda_lib_path});
FLAGS_cuda_dir, win_cublaslt_lib, true, {cuda_lib_path});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swgu98 这块之前是不是写错了,之前从来没跑到这里所以没暴露出来,怎么在 GetCublasLtDsoHandle 里找 win_cublas_lib

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

啊,没猫帮我 review 了,难受

@SigureMo SigureMo merged commit d53a047 into PaddlePaddle:develop Apr 19, 2026
120 of 126 checks passed
@youge325 youge325 deleted the cWin branch April 19, 2026 10:53
@risemeup1111
Copy link
Copy Markdown

✅ Cherry-pick successful! Created PR: #78769


/// Returns default dtype as caffe2::TypeMeta (the canonical form, mirrors
/// PyTorch).
inline caffe2::TypeMeta get_default_dtype() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最近发现用最新 develop 编译的包(比如 paddlecodec 0.2)给 release/3.4 会出现 get_default_dtype 之类的符号缺失的问题,其实就是 ABI 兼容问题,按我理解只有编译到 libpaddle.so/libphi.so.cc 文件对应接口变动才会有这类问题,.h 文件应该不会导致这类问题,后面修改相关 .cc 接口需要多留意下潜在的 ABI 兼容性问题

cc @BingooYang

sneaxiy pushed a commit that referenced this pull request Apr 24, 2026
)

Co-authored-by: Runming Xie <146702037+youge325@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants