iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.82k stars 608 forks source link

Build failure: error: __float128 is not supported on this target #15435

Open yifeihe007 opened 12 months ago

yifeihe007 commented 12 months ago

What happened?

I'm building IREE from source using the following instructions:

Configure

cmake -G Ninja -B ../iree-build/ .

Build

cmake --build ../iree-build/

I got errors:

[17/1842] Compiling ukernel.cu to cuda_ukernel_ukernel.cu.bc FAILED: samples/custom_dispatch/cuda/kernels/cuda_ukernel_ukernel.cu.bc /ireen/iree-build/samples/custom_dispatch/cuda/kernels/cuda_ukernel_ukernel.cu.bc cd /ireen/iree-build/samples/custom_dispatch/cuda/kernels && /ireen/iree-build/llvm-project/bin/clang-18 -x cuda --cuda-gpu-arch=sm_60 --cuda-path=/apps/Common/software/CUDA/12.0.0 -Wno-unknown-cuda-version -nocudalib --cuda-device-only -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH -O3 -c -emit-llvm /ireen/iree/samples/custom_dispatch/cuda/kernels/ukernel.cu -o cuda_ukernel_ukernel.cu.bc In file included from :1: In file included from /ireen/iree-build/llvm-project/lib/clang/18/include/clang_cuda_runtime_wrapper.h:41: In file included from /ireen/iree-build/llvm-project/lib/clang/18/include/cuda_wrappers/cmath:27: In file included from /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/cmath:47: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_abs.h:102:7: error: float128 is not supported on this target 102 | abs(float128 x) | ^ /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_abs.h:101:3: error: float128 is not supported on this target 101 | float128 | ^ /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_abs.h:102:18: note: 'x' defined here 102 | abs(float128 x) | ^ /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_abs.h:102:18: note: 'x' defined here /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_abs.h:102:18: note: 'x' defined here In file included from :1: In file included from /ireen/iree-build/llvm-project/lib/clang/18/include/__clang_cuda_runtime_wrapper.h:41: In file included from /ireen/iree-build/llvm-project/lib/clang/18/include/cuda_wrappers/cmath:27: In file included from /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/cmath:1892: In file included from /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/specfun.h:45: In file included from /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/stl_algobase.h:64: In file included from /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/stl_pair.h:59: In file included from /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/move.h:55: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/type_traits:335:39: error: float128 is not supported on this target 335 | struct __is_floating_point_helper<__float128> | ^ 3 errors generated when compiling for sm_60.

It used the clang compiled in the iree-build/llvm-project/lib/clang/18, I tried to used older clang build by my self, the error dismissed.

Steps to reproduce your issue

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What component(s) does this issue relate to?

MLIR

Version information

No response

Additional context

No response

ScottTodd commented 12 months ago

As a workaround, you could turn off the samples build with -DIREE_BUILD_SAMPLES=OFF.

I only see regular float data types used in that sample, so not sure where __float128 is coming from... maybe something about how clang is used in https://github.com/openxla/iree/blob/main/samples/custom_dispatch/cuda/kernels/CMakeLists.txt ? There is a comment in there "This sample should probably just invoke nvcc directly."

yifeihe007 commented 12 months ago

As a workaround, you could turn off the samples build with -DIREE_BUILD_SAMPLES=OFF.

I only see regular float data types used in that sample, so not sure where __float128 is coming from... maybe something about how clang is used in https://github.com/openxla/iree/blob/main/samples/custom_dispatch/cuda/kernels/CMakeLists.txt ? There is a comment in there "This sample should probably just invoke nvcc directly."

Hi @ScottTodd !

Thanks for your reply! According to the CMakeLists file, the related cuda file ukernel.cu is compiled using "iree_cuda_bitcode_library" function, which will use the clang built by iree.

ScottTodd commented 12 months ago

Right, the comment is noting that the sample should do something differently than what it currently does. Making that change may help in cases like yours.