intel / intel-graphics-compiler

Other
609 stars 158 forks source link

clang-tool: command not found #240

Closed alucryd closed 2 years ago

alucryd commented 2 years ago

Hi guys, I'm trying to build the latest release from source with everything in-tree. I've set up my workspace following the documentation. One particularity I have is that I use a local toolchain instead of my system tools because I want to produce generic binaries with an older glibc, so even if I'm on the same architecture, I'm technically cross-compiling, and IGC rightfully thinks so.

Even though I've got everything in-tree, the build insists on using llvm/clang from my system and I had to procure 11.1.0 builds. Even then, the build ends up failing with the following error:

[3056/3625] BiF: "IGCsize_t_64_int.bc": Compiling OpenCL source: "IBiF_size_t.cl"
FAILED: IGC/Release/bif/IGCsize_t_64_int.bc_IBiF_size_t__cl__0.bc.tmp /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif/IGCsize_t_64_int.bc_IBiF_size_t__cl__0.bc.tmp 
cd /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/BiFModule && /usr/bin/cmake -E make_directory /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif && clang-tool -cc1 -x cl -fblocks -fpreserve-vec3-type -opencl-builtins -triple=spir64 -w -emit-llvm-bc -o /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif/IGCsize_t_64_int.bc_IBiF_size_t__cl__0.bc.tmp -include /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/llvm-deps/src/clang/tools/driver/../../lib/Headers/opencl-c.h -include /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif/opencl_cth.h -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Languages/OpenCL -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Languages/OpenCL/PointerSize -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Headers -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/../AdaptorOCL/ocl_igc_shared/device_enqueue -D__EXECUTION_MODEL_DEBUG=1 -D__OPENCL_C_VERSION__=200 -D__IGC_BUILD__ -Dcl_khr_f16 -Dcl_khr_fp64 -Dcl_khr_gl_msaa_sharing -Dcl_khr_mipmap_image -Dcl_khr_depth_images -Dcl_intel_subgroups_short -Dcl_intel_subgroups_char -Dcl_intel_subgroups_long -Dcl_intel_subgroup_local_block_io -Dcl_intel_64bit_global_atomics_placeholder -Dcl_khr_subgroup_extended_types -Dcl_khr_subgroup_non_uniform_vote -Dcl_khr_subgroup_ballot -Dcl_khr_subgroup_shuffle -Dcl_khr_subgroup_shuffle_relative -Dcl_khr_subgroup_non_uniform_arithmetic -Dcl_khr_subgroup_clustered_reduce -Dcl_intel_bit_instructions -Dcl_intel_global_float_atomics -Dcl_intel_subgroup_matrix_multiply_accumulate -Dcl_intel_subgroup_split_matrix_multiply_accumulate -Dcl_intel_pvc_rt_validation -Dcl_intel_subgroup_matrix_multiply_accumulate_tf32 -Dcl_intel_subgroup_extended_block_read -D__VME_TYPES_DEFINED__ -cl-std=CL2.0 /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Languages/OpenCL/PointerSize/IBiF_size_t.cl
/bin/sh: line 1: clang-tool: command not found
[3057/3625] BiF: "IBiF_Impl_int_spirv.bc": Compiling OpenCL source: "IBiF_Impl.cl"
FAILED: IGC/Release/bif/IBiF_Impl_int_spirv.bc_IBiF_Impl__cl__0.bc.tmp /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif/IBiF_Impl_int_spirv.bc_IBiF_Impl__cl__0.bc.tmp 
cd /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/BiFModule && /usr/bin/cmake -E make_directory /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif && clang-tool -cc1 -x cl -fblocks -fpreserve-vec3-type -opencl-builtins -triple=spir64 -w -emit-llvm-bc -o /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif/IBiF_Impl_int_spirv.bc_IBiF_Impl__cl__0.bc.tmp -include /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/llvm-deps/src/clang/tools/driver/../../lib/Headers/opencl-c.h -include /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/build/IGC/Release/bif/opencl_cth.h -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Implementation -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Headers -I /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/../AdaptorOCL/ocl_igc_interface/device_enqueue -D__EXECUTION_MODEL_DEBUG=1 -D__OPENCL_C_VERSION__=200 -D__IGC_BUILD__ -Dcl_khr_f16 -Dcl_khr_fp64 -Dcl_khr_gl_msaa_sharing -Dcl_khr_mipmap_image -Dcl_khr_depth_images -Dcl_intel_subgroups_short -Dcl_intel_subgroups_char -Dcl_intel_subgroups_long -Dcl_intel_subgroup_local_block_io -Dcl_intel_64bit_global_atomics_placeholder -Dcl_khr_subgroup_extended_types -Dcl_khr_subgroup_non_uniform_vote -Dcl_khr_subgroup_ballot -Dcl_khr_subgroup_shuffle -Dcl_khr_subgroup_shuffle_relative -Dcl_khr_subgroup_non_uniform_arithmetic -Dcl_khr_subgroup_clustered_reduce -Dcl_intel_bit_instructions -Dcl_intel_global_float_atomics -Dcl_intel_subgroup_matrix_multiply_accumulate -Dcl_intel_subgroup_split_matrix_multiply_accumulate -Dcl_intel_pvc_rt_validation -Dcl_intel_subgroup_matrix_multiply_accumulate_tf32 -Dcl_intel_subgroup_extended_block_read -D__VME_TYPES_DEFINED__ -cl-std=CL2.0 /home/embybuilder/Buildbot/x64/libopencl-intel-graphics-compiler-x64/build/intel-graphics-compiler-igc-1.0.10988/IGC/BiFModule/Implementation/IBiF_Impl.cl
/bin/sh: line 1: clang-tool: command not found

Any idea? I would assume clang-tool would be built in-tree but it doesn't seem to be the case. I can find some clang binary in a weird place, but it doesn't seem right: ./build/llvm-project/clang/test/Tooling/Inputs/mock-libcxx/bin/clang.

I'll try symlinking the clang 11 binary I had to build on the host system, but I assume this command will need opencl-clang for this :/

Here's the full configure output: https://paste.xinu.at/WaSGxxloU3iB3PcT/

pszymich commented 2 years ago

Hi @alucryd,

Can you try adding -DCCLANG_BUILD_INTREE_LLVM=1 -DLLVM_ENABLE_PROJECTS=\"clang\" CMake flags to your configuration config?

alucryd commented 2 years ago

Thanks for the suggestion. I already had the first param but not the second one. It didn't help though unfortunately. Also symlinking my system clang to clang-tool didn't work as expected.

eero-t commented 2 years ago

What is "clang-tool"? There does not seem to be any such thing in whole Ubuntu (and IGC builds fine with Ubuntu system clang): https://packages.ubuntu.com/search?searchon=contents&mode=&suite=impish&arch=any&keywords=clang-tool

There's clang-tools package, but even that does not contain binary called clang-tool: https://packages.ubuntu.com/impish/amd64/clang-tools-12/filelist

alucryd commented 2 years ago

Yeah, it seems to be an alias created in the IGC build system, probably to avoid conflicting with system clang, but the problem is this clang aka clang-tool is never actually built.

softworkz commented 2 years ago

@eero-t

References to clang-tool:

https://github.com/intel/intel-graphics-compiler/blob/77af69c509916dfaefb1d7fa4549492824ecf606/IGC/cmake/igc_find_opencl_clang.cmake#L97

https://github.com/intel/intel-graphics-compiler/blob/9451137bbb5dd021432fa6944c7528211866619e/IGC/VectorCompiler/lib/BiF/CMakeLists.txt#L92

https://github.com/intel/intel-graphics-compiler/blob/9451137bbb5dd021432fa6944c7528211866619e/IGC/BiFModule/CMakeLists.txt#L252

eero-t commented 2 years ago

I'm not seeing such issue when doing build on Ubuntu, like this:

$ git clone --branch 22.20.23198 --depth 1 https://github.com/intel/compute-runtime.git
$ cd compute-runtime  &&  mkdir build  &&  cd build
$ cmake -LH -Wno-dev -G Ninja \
      -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_BUILD_TYPE=Release \
      -DSUPPORT_GEN8=0 -DSUPPORT_GEN9=1 -DSUPPORT_GEN11=1 \
      -DSUPPORT_TGLLP=1 -DSUPPORT_DG1=1 -DSUPPORT_XE_HP_SDV=1 \
      -DSUPPORT_DG2=1 -DSUPPORT_PVC=1 \
      -DNEO_DISABLE_LD_GOLD=1 \
      -DDO_NOT_RUN_AUB_TESTS=1 -DDONT_CARE_OF_VIRTUALS=1 \
      ../
$ ninja  &&  ninja install

Could you include "-LH" to your CMake options and paste CMake config output here?

mnaczk commented 2 years ago

No submitter response for the last 2 weeks. @alucryd If the issue still exists, please reopen the issue.

th0ma7 commented 2 months ago

was there ever a solution on this?

alucryd commented 2 months ago

was there ever a solution on this?

No, been patching the cmake files ever since to use clang instead of clang-tool.