Skip to content

ARM build on gcc-13 failed with src/reference/unary-elementwise.cc:125:14: error: invalid ‘static_cast’ from type ‘xnn_bfloat16’ to type ‘_Float16’ #7489

Open
@xwang233

Description

Original issue from pytorch: pytorch/pytorch#141083

The XNNPACK commit is at 4ea82e5

Build error:

[3174/5315] Building CXX object confu-deps/XNNPACK/CMakeFiles/reference-ukernels.dir/src/reference/unary-elementwise.cc.o
FAILED: confu-deps/XNNPACK/CMakeFiles/reference-ukernels.dir/src/reference/unary-elementwise.cc.o
/usr/bin/c++ -DCAFFE2_PERF_WITH_SVE=1 -DXNN_ENABLE_ARM_BF16=0 -DXNN_ENABLE_ARM_DOTPROD=1 -DXNN_ENABLE_ARM_FP16_SCALAR=1 -DXNN_ENABLE_ARM_FP16_VECTOR=1 -DXNN_ENABLE_ARM_I8MM=0 -DXNN_ENABLE_ARM_SME2=1 -DXNN_ENABLE_ARM_SME=1 -DXNN_ENABLE_ASSEMBLY=1 -DXNN_ENABLE_AVX256SKX=1 -DXNN_ENABLE_AVX256VNNI=1 -DXNN_ENABLE_AVX256VNNIGFNI=1 -DXNN_ENABLE_AVX512AMX=1 -DXNN_ENABLE_AVX512F=1 -DXNN_ENABLE_AVX512FP16=1 -DXNN_ENABLE_AVX512SKX=1 -DXNN_ENABLE_AVX512VBMI=1 -DXNN_ENABLE_AVX512VNNI=1 -DXNN_ENABLE_AVX512VNNIGFNI=1 -DXNN_ENABLE_AVXVNNI=0 -DXNN_ENABLE_AVXVNNIINT8=0 -DXNN_ENABLE_CPUINFO=1 -DXNN_ENABLE_DWCONV_MULTIPASS=0 -DXNN_ENABLE_GEMM_M_SPECIALIZATION=1 -DXNN_ENABLE_HVX=1 -DXNN_ENABLE_KLEIDIAI=0 -DXNN_ENABLE_MEMOPT=1 -DXNN_ENABLE_RISCV_VECTOR=1 -DXNN_ENABLE_SPARSE=1 -DXNN_ENABLE_VSX=1 -I/opt/pytorch/pytorch/third_party/XNNPACK/include -I/opt/pytorch/pytorch/third_party/XNNPACK/src -I/opt/pytorch/pytorch/third_party/pthreadpool/include -isystem /opt/pytorch/pytorch/third_party/protobuf/src -DNO_CUDNN_DESTROY_HANDLE -fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -O3 -DNDEBUG -std=c++14 -fPIC -Wno-psabi -O2 -pthread -MD -MT confu-deps/XNNPACK/CMakeFiles/reference-ukernels.dir/src/reference/unary-elementwise.cc.o -MF confu-deps/XNNPACK/CMakeFiles/reference-ukernels.dir/src/reference/unary-elementwise.cc.o.d -o confu-deps/XNNPACK/CMakeFiles/reference-ukernels.dir/src/reference/unary-elementwise.cc.o -c /opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc
/opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc: In instantiation of ‘TOut {anonymous}::ConvertOp<TIn, TOut>::operator()(TIn) const [with TIn = xnn_bfloat16; TOut = _Float16]’:
/opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc:39:32:   required from ‘void {anonymous}::unary_ukernel_unquantized(size_t, const TIn*, TOut*, const xnn_unary_uparams*) [with TIn = xnn_bfloat16; TOut = _Float16; Operator = ConvertOp<xnn_bfloat16, _Float16>; size_t = long unsigned int]’
/opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc:167:7:   required from ‘const xnn_unary_elementwise_config* {anonymous}::get_convert_config(std::false_type, std::false_type) [with TIn = xnn_bfloat16; TOut = _Float16; std::false_type = std::integral_constant<bool, false>]’
/opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc:183:50:   required from ‘const xnn_unary_elementwise_config* {anonymous}::get_convert_config(xnn_datatype, InputQuantized) [with TIn = xnn_bfloat16; InputQuantized = std::integral_constant<bool, false>]’
/opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc:217:46:   required from here
/opt/pytorch/pytorch/third_party/XNNPACK/src/reference/unary-elementwise.cc:125:14: error: invalid ‘static_cast’ from type ‘xnn_bfloat16’ to type ‘_Float16’
  125 |       return static_cast<TOut>(x);
      |              ^~~~~~~~~~~~~~~~~~~~

Environment:

  • ubuntu 24.04
  • gcc 13.2.0

CPU is neoverse-v2, or Nvidia Grace

It was reported that gcc-11 builds ok in the original pytorch issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions