llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.66k stars 11.85k forks source link

Tests for libclc failing with CMake errors #101154

Closed tru closed 2 months ago

tru commented 2 months ago

Many of the CI runs for libclc fails with the following error:

CMake Error at /mnt/build/lib/cmake/llvm/AddLLVM.cmake:1029 (add_executable):
  add_executable cannot create target "prepare_builtins" because an imported
  target with the same name already exists.
Call Stack (most recent call first):
  CMakeLists.txt:170 (add_llvm_executable)

CMake Error at /mnt/build/lib/cmake/llvm/LLVM-Config.cmake:110 (target_link_libraries):
  IMPORTED library can only be used with the INTERFACE keyword of
  target_link_libraries
Call Stack (most recent call first):
  /mnt/build/lib/cmake/llvm/LLVM-Config.cmake:98 (explicit_llvm_config)
  /mnt/build/lib/cmake/llvm/AddLLVM.cmake:1089 (llvm_config)
  CMakeLists.txt:170 (add_llvm_executable)

I haven't had time to bisect or dig deeper, but maybe anyone know what this is related to. It would be nice to have the CI working before we release 19. final.

tru commented 2 months ago

Here is an example failure: https://github.com/llvm/llvm-project/actions/runs/10158052620/job/28089321312

tru commented 2 months ago

@AnastasiaStulova Since you are the code maintainer for OpenCL - do you know what can have caused this or maybe can point me to a person that can help get this fixed, since it currently blocks CI testing for LLVM 19.x

tru commented 2 months ago

@tstellar worked around this and it's working now.

satmandu commented 1 month ago

What was the workaround for this issue?

I see the same problem when trying to build a standalone libclc:

-- Found LibXml2: /usr/local/lib64/libxml2.so (found version "2.13.3")
-- Linker detection: GNU ld
-- libclc LLVM version: 19.1.0
CMake Error at /usr/local/lib64/cmake/llvm/AddLLVM.cmake:1029 (add_executable):
  add_executable cannot create target "prepare_builtins" because an imported
  target with the same name already exists.
Call Stack (most recent call first):
  CMakeLists.txt:170 (add_llvm_executable)

CMake Error at /usr/local/lib64/cmake/llvm/LLVM-Config.cmake:95 (target_link_libraries):
  IMPORTED library can only be used with the INTERFACE keyword of
  target_link_libraries
Call Stack (most recent call first):
  /usr/local/lib64/cmake/llvm/AddLLVM.cmake:1089 (llvm_config)
  CMakeLists.txt:170 (add_llvm_executable)

CMake Error at /usr/local/lib64/cmake/llvm/AddLLVM.cmake:1106 (target_link_libraries):
  IMPORTED library can only be used with the INTERFACE keyword of
  target_link_libraries
Call Stack (most recent call first):
  CMakeLists.txt:170 (add_llvm_executable)

CMake Error at CMakeLists.txt:177 (target_compile_definitions):
  target_compile_definitions may only set INTERFACE properties on IMPORTED
  targets

-- Found Python3: /usr/local/bin/python3.12 (found version "3.12.6") found components: Interpreter
-- libclc target 'amdgcn--' is enabled
satmandu commented 1 month ago

Is the understanding that libclc should no longer be built standalone?

satmandu commented 1 month ago

The build of libclc within llvm 19.1 doesn't appear to generate the same files as the prior standalone libclc build, as our mesa build gives us this:

[2339*6/3037] Generating src/intel/vulkan/grl/gfx125_bvh...ed.h with a custom command (wrapped by meson to set env)
FAILED: src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_indexed.h
env MESA_SHADER_CACHE_DISABLE=true MESA_SPIRV_LOG_LEVEL=error /usr/local/tmp/crew/mesa.20240921133637.dir/builddir/src/intel/compiler/intel_clc -p dg2 --prefix gfx125_bvh_build_BFS_BFS_pass1_indexed -e BFS_pass1_indexed --in ../src/intel/vulkan/grl/gpu/bvh_build_BFS.cl --in /usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu/libs/lsc_intrinsics_fallback.cl -o src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_indexed.h -- -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -DMAX_HW_SIMD_WIDTH=16 -DMAX_WORKGROUP_SIZE=16 -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/include
ERROR: libclc shader missing. Consider installing the libclc package
[2340*5/3037] Generating src/intel/vulkan/grl/gfx125_bvh...al.h with a custom command (wrapped by meson to set env)
FAILED: src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_initial.h
env MESA_SHADER_CACHE_DISABLE=true MESA_SPIRV_LOG_LEVEL=error /usr/local/tmp/crew/mesa.20240921133637.dir/builddir/src/intel/compiler/intel_clc -p dg2 --prefix gfx125_bvh_build_BFS_BFS_pass1_initial -e BFS_pass1_initial --in ../src/intel/vulkan/grl/gpu/bvh_build_BFS.cl --in /usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu/libs/lsc_intrinsics_fallback.cl -o src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_initial.h -- -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -DMAX_HW_SIMD_WIDTH=16 -DMAX_WORKGROUP_SIZE=16 -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/include
ERROR: libclc shader missing. Consider installing the libclc package
[2341*4/3037] Generating src/intel/vulkan/grl/gfx125_bvh...le.h with a custom command (wrapped by meson to set env)
FAILED: src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_indexed_batchable.h
env MESA_SHADER_CACHE_DISABLE=true MESA_SPIRV_LOG_LEVEL=error /usr/local/tmp/crew/mesa.20240921133637.dir/builddir/src/intel/compiler/intel_clc -p dg2 --prefix gfx125_bvh_build_BFS_BFS_pass1_indexed_batchable -e BFS_pass1_indexed_batchable --in ../src/intel/vulkan/grl/gpu/bvh_build_BFS.cl --in /usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu/libs/lsc_intrinsics_fallback.cl -o src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_indexed_batchable.h -- -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -DMAX_HW_SIMD_WIDTH=16 -DMAX_WORKGROUP_SIZE=16 -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/include
ERROR: libclc shader missing. Consider installing the libclc package
[2342*3/3037] Generating src/intel/vulkan/grl/gfx125_bvh...le.h with a custom command (wrapped by meson to set env)
FAILED: src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_initial_batchable.h
env MESA_SHADER_CACHE_DISABLE=true MESA_SPIRV_LOG_LEVEL=error /usr/local/tmp/crew/mesa.20240921133637.dir/builddir/src/intel/compiler/intel_clc -p dg2 --prefix gfx125_bvh_build_BFS_BFS_pass1_initial_batchable -e BFS_pass1_initial_batchable --in ../src/intel/vulkan/grl/gpu/bvh_build_BFS.cl --in /usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu/libs/lsc_intrinsics_fallback.cl -o src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass1_initial_batchable.h -- -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -DMAX_HW_SIMD_WIDTH=16 -DMAX_WORKGROUP_SIZE=16 -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/include
ERROR: libclc shader missing. Consider installing the libclc package
[2343*2/3037] Generating src/intel/vulkan/grl/gfx125_bvh...ed.h with a custom command (wrapped by meson to set env)
FAILED: src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass2_indexed.h
env MESA_SHADER_CACHE_DISABLE=true MESA_SPIRV_LOG_LEVEL=error /usr/local/tmp/crew/mesa.20240921133637.dir/builddir/src/intel/compiler/intel_clc -p dg2 --prefix gfx125_bvh_build_BFS_BFS_pass2_indexed -e BFS_pass2_indexed --in ../src/intel/vulkan/grl/gpu/bvh_build_BFS.cl --in /usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu/libs/lsc_intrinsics_fallback.cl -o src/intel/vulkan/grl/gfx125_bvh_build_BFS_BFS_pass2_indexed.h -- -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -DMAX_HW_SIMD_WIDTH=16 -DMAX_WORKGROUP_SIZE=16 -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/gpu -I/usr/local/tmp/crew/mesa.20240921133637.dir/src/intel/vulkan/grl/include
ERROR: libclc shader missing. Consider installing the libclc package
[2343*1/3037] Linking target src/gallium/targets/dri/libgallium-24.2.3.so