Paddle compile error when -DWITH_CINN=ON on Hygon DCU

z9gpfhce  于 5个月前  发布在  Go
关注(0)|答案(3)|浏览(63)

bug描述 Describe the Bug

海光DCU上设置-DWITH_CINN=ON,Paddle编译错误。
编译命令:cmake .. -DWITH_GPU=ON -DWITH_CINN=ON -DPY_VERSION=3.x
错误消息

/workspace/Paddle/paddle/phi/kernels/gpu/truncated_gaussian_random_kernel.cu:55:17: error: no member named 'clamp' in namespace 'std'
    return std::clamp(ret, a, b);
           ~~~~~^
/workspace/Paddle/paddle/phi/kernels/gpu/truncated_gaussian_random_kernel.cu:89:17: error: no member named 'clamp' in namespace 'std'
    return std::clamp(ret, a, b);
           ~~~~~^
6 warnings generated when compiling for gfx926.
2 errors generated when compiling for gfx906.

其他补充信息 Additional Supplementary Information

No response

vof42yt1

vof42yt11#

这个是C17标准的用法,std::clamp,检查下你编译的时候是不是用的C14?

2sbarzqh

2sbarzqh2#

@risemeup1 确实是因为c版本,不过改成c17还是出错。
原因在cmake/hip.cmake

if(WITH_CINN)
  list(APPEND HIP_CXX_FLAGS -std=c++14)
else()
  list(APPEND HIP_CXX_FLAGS -std=c++17)
endif()

改成-std=c++17,出现了另一个错误:

[ 97%] Building CXX object paddle/fluid/inference/analysis/passes/CMakeFiles/convert_to_mixed_precision.dir/convert_to_mixed_precision.cc.o
/usr/bin/ld: ../../../../libcinnapi.so: undefined reference to `absl::lts_20210324::strings_internal::CalculateBase64EscapedLenInternal(unsigned long, bool)'
/usr/bin/ld: ../../../../libcinnapi.so: undefined reference to `absl::lts_20210324::raw_logging_internal::RawLog(absl::lts_20210324::LogSeverity, char const*, int, char const*, ...)'
/usr/bin/ld: ../../../../libcinnapi.so: undefined reference to `absl::lts_20210324::strings_internal::kBase64Chars'
/usr/bin/ld: ../../../../libcinnapi.so: undefined reference to `absl::lts_20210324::strings_internal::Base64EscapeInternal(unsigned char const*, unsigned long, char*, unsigned long, char const*, bool)'
/usr/bin/ld: ../../../../libcinnapi.so: undefined reference to `absl::lts_20210324::strings_internal::EncodeUTF8Char(char*, char32_t)
ckx4rj1h

ckx4rj1h3#

CINN目前开源的代码还未支持DCU编译,后续功能会开源,请关注,谢谢

相关问题