Skip to content

Conversation

@youge325
Copy link
Contributor

@youge325 youge325 commented Oct 18, 2025

PR Category

Environment Adaptation

PR Types

Bug fixes

Description

  • 加入了 CastDataTypeFunctorfloat8_e4m3fnfloat8_e5m2bfloat16float16complex64/complex128 的专门实现;这些组合之前没有合法的 static_cast,会在模版实例化时报错或导致转换缺失。编译时的错误日志如下:
[283/3505] Building CXX object paddle\phi\CMakeFiles\phi.dir\core\framework\data_type_transform.cc.obj
FAILED: paddle/phi/CMakeFiles/phi.dir/core/framework/data_type_transform.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_EXPORT -DPADDLE_DLL_INFERENCE -DPADDLE_ON_INFERENCE -DPADDLE_VERSION=0.0.0 -DPADDLE_VERSION_INTEGER=0 -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 -DPHI_INNER -DPHI_SHARED -DSTATIC_IR -DTRT_PLUGIN_FP16_AVAILABLE -DUTF8PROC_STATIC -DWIN32_LEAN_AND_MEAN -DYAML_CPP_STATIC_DEFINE -D_XKEYCHECK_H -Dphi_EXPORTS -ID:\Paddle\third_party\cccl\thrust -ID:\Paddle\third_party\cccl\libcudacxx\include -ID:\Paddle\third_party\cccl\cub -ID:\Paddle\build -ID:\Paddle\paddle\fluid\framework\io -ID:\Paddle\patches\thrust -ID:\TensorRT-10.13.3.9\include -ID:\Paddle\build\third_party\install\zlib\include -ID:\Paddle\build\third_party\install -ID:\Paddle\build\third_party\install\gflags\include -ID:\Paddle\build\third_party\install\glog\include -ID:\Paddle\third_party\eigen3 -ID:\Paddle\third_party\threadpool -ID:\Paddle\third_party\dlpack\include -ID:\Paddle\build\third_party\install\xxhash\include -ID:\Paddle\build\third_party\install\warpctc\include -ID:\Paddle\build\third_party\install\warprnnt\include -ID:\Paddle\build\third_party\install\utf8proc\include -ID:\Paddle\build\third_party\install\mklml\include -ID:\Paddle\build\third_party\install\onednn\include -ID:\Paddle\build\third_party\install\protobuf\include -ID:\Paddle\third_party\nlohmann_json\include -ID:\Paddle\build\third_party\install\yaml-cpp\include -ID:\Users\Lenovo\AppData\Local\Programs\Python\Python310\include -ID:\Users\Lenovo\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\core\include -ID:\Paddle\build\third_party\pybind\src\extern_pybind\include -ID:\Paddle\build\third_party\install\libuv\include -ID:\Paddle\third_party\cccl -ID:\Paddle\build\third_party\install\cryptopp\include -ID:\Paddle\build\third_party\pocketfft\src -ID:\Paddle\build\third_party\dirent\src\extern_dirent\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -ID:\Paddle -ID:\Paddle\paddle\phi\api\include\compat -ID:\Paddle\paddle\phi\api\include\compat\torch\csrc\api\include -ID:\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 /Fopaddle\phi\CMakeFiles\phi.dir\core\framework\data_type_transform.cc.obj /Fdpaddle\phi\CMakeFiles\phi.dir\ /FS -c D:\Paddle\paddle\phi\core\framework\data_type_transform.cc
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): error C2440: 'static_cast': cannot convert from 'InType' to 'OutType'
        with
        [
            InType=phi::dtype::float8_e5m2
        ]
        and
        [
            OutType=phi::dtype::complex<double>
        ]
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): note: 'phi::dtype::complex<double>::complex': no overloaded function could convert all the argument types
D:\Paddle\paddle/phi/common/complex.h(127): note: could be 'phi::dtype::complex<double>::complex<T>(const phi::dtype::complex<float> &)'
        with
        [
            T=double
        ]
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): note: 'phi::dtype::complex<double>::complex<T>(const phi::dtype::complex<float> &)': cannot convert argument 1 from 'InType' to 'const phi::dtype::complex<float> &'
        with
        [
            T=double
        ]
        and
        [
            InType=phi::dtype::float8_e5m2
        ]
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): note: Reason: cannot convert from 'InType' to 'const phi::dtype::complex<float>'
        with
        [
            InType=phi::dtype::float8_e5m2
        ]
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\Paddle\paddle/phi/common/complex.h(140): note: or       'phi::dtype::complex<double>::complex(const std::complex<_Other> &)'
D:\Paddle\paddle/phi/common/complex.h(119): note: or       'phi::dtype::complex<double>::complex(const std::enable_if<std::is_same<T1,float>::value,phi::dtype::complex<double>>::type &)'
D:\Paddle\paddle/phi/common/complex.h(113): note: or       'phi::dtype::complex<double>::complex(const T1 &)'
D:\Paddle\paddle/phi/common/complex.h(79): note: or       'phi::dtype::complex<double>::complex(const cuda::std::__4::complex<_Xp> &)'
D:\Paddle\paddle/phi/common/complex.h(72): note: or       'phi::dtype::complex<double>::complex(const thrust::THRUST_200200___CUDA_ARCH_LIST___NS::complex<U> &)'
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): note: while trying to match the argument list '(InType)'
        with
        [
            InType=phi::dtype::float8_e5m2
        ]
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(33): note: the template instantiation context (the oldest one first) is
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(207): note: see reference to function template instantiation 'void phi::VisitDataType<phi::CastDataType<phi::dtype::float8_e5m2>>(paddle::framework::proto::VarType::Type,Visitor)' being compiled
        with
        [
            Visitor=phi::CastDataType<phi::dtype::float8_e5m2>
        ]
D:\Paddle\paddle/phi/core/framework/var_type_helper.h(156): note: see reference to function template instantiation 'void phi::CastDataType<phi::dtype::float8_e5m2>::apply<phi::dtype::complex<double>>(void)' being compiled
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(106): note: see reference to class template instantiation 'phi::CastDataTypeFunctor<InType,OutType>' being compiled
        with
        [
            InType=phi::dtype::float8_e5m2,
            OutType=phi::dtype::complex<double>
        ]
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(32): note: while compiling class template member function 'OutType phi::CastDataTypeFunctor<InType,OutType>::operator ()(InType) const'
        with
        [
            OutType=phi::dtype::complex<double>,
            InType=phi::dtype::float8_e5m2
        ]
D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\algorithm(3799): note: see the first reference to 'phi::CastDataTypeFunctor<InType,OutType>::operator ()' in 'std::transform'
        with
        [
            InType=phi::dtype::float8_e5m2,
            OutType=phi::dtype::complex<double>
        ]
D:\Paddle\paddle/phi/common/transform.h(78): note: see the first reference to 'std::transform' in 'phi::Transform<phi::CPUContext>::operator ()'
D:\Paddle\paddle\phi\core\framework\data_type_transform.cc(102): note: see the first reference to 'phi::Transform<phi::CPUContext>::operator ()' in 'phi::CastDataType<phi::dtype::float8_e5m2>::apply'
D:\Paddle\paddle/phi/core/framework/var_type_helper.h(156): note: see the first reference to 'phi::CastDataType<phi::dtype::float8_e5m2>::apply' in 'phi::VisitDataType'
[290/3505] Building CXX object paddle\phi\CMakeFiles\phi.dir\core\vocab\string_array.cc.obj
ninja: build stopped: subcommand failed.

@paddle-bot
Copy link

paddle-bot bot commented Oct 18, 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 18, 2025
@youge325
Copy link
Contributor Author

/re-run all-failed

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@3a94489). Learn more about missing BASE report.

Files with missing lines Patch % Lines
paddle/phi/core/framework/data_type_transform.cc 0.00% 16 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #75929   +/-   ##
==========================================
  Coverage           ?    0.00%           
==========================================
  Files              ?        1           
  Lines              ?       16           
  Branches           ?        0           
==========================================
  Hits               ?        0           
  Misses             ?       16           
  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
Contributor Author

/re-run all-failed

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

/re-run all-failed

@youge325
Copy link
Contributor Author

/re-run all-failed

@youge325
Copy link
Contributor Author

/re-run all-failed

@youge325
Copy link
Contributor Author

/re-run all-failed

@luotao1
Copy link
Contributor

luotao1 commented Oct 24, 2025

单侧覆盖率不够,需要补充单侧。#75929 (comment)

@youge325
Copy link
Contributor Author

单侧覆盖率不够,需要补充单侧。#75929 (comment)

明白了,之前强推的含单测的提交 6aae326 流水线没过,可能是因为我之前有个对cast_impl.h修改的pr #75930 没有合入,导致单测没有生效,我这次再试试

@youge325
Copy link
Contributor Author

/re-run all-failed

@youge325 youge325 marked this pull request as draft November 3, 2025 15:43
@youge325
Copy link
Contributor Author

youge325 commented Nov 5, 2025

#76185 已经解决该问题

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