intel / intel-graphics-compiler

Other
606 stars 158 forks source link

Building "compute-runtime" releases fails to ocloc errors with all IGC releases after "igc-1.0.9636" #224

Closed eero-t closed 2 years ago

eero-t commented 2 years ago

When trying to build latest compute-runtime "21.52.22081" release, after building:

I get following errors:

...
[338/2454] Building CXX object shared/source/CMakeFiles/neo_shared.dir/program/sync_buffer_handler.cpp.o
[339/2454] Generating ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.spv-cl-kernel-arg-info, ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.bin-cl-kernel-arg-info, ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.gen-cl-kernel-arg-info
FAILED: bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.spv-cl-kernel-arg-info bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.bin-cl-kernel-arg-info bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.gen-cl-kernel-arg-info 
cd /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files && LD_LIBRARY_PATH=/home/nobody/source/compute-runtime/build/bin /home/nobody/source/compute-runtime/build/bin/ocloc -file /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files/CopyBuffer_simd16.cl -device tgllp -64 -out_dir /home/nobody/source/compute-runtime/build/bin/Gen12LPlp/0/test_files/x64/ -revision_id 0 -options -cl-kernel-arg-info -options_name
: CommandLine Error: Option 'spirv-expand-step' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted (core dumped)
[340/2454] Building CXX object shared/source/CMakeFiles/neo_shared.dir/os_interface/windows/os_environment_win.cpp.o
[341/2454] Generating ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.spv-cl-finite-math-only, ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.bin-cl-finite-math-only, ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.gen-cl-finite-math-only
FAILED: bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.spv-cl-finite-math-only bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.bin-cl-finite-math-only bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.gen-cl-finite-math-only 
cd /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files && LD_LIBRARY_PATH=/home/nobody/source/compute-runtime/build/bin /home/nobody/source/compute-runtime/build/bin/ocloc -file /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files/CopyBuffer_simd16.cl -device tgllp -64 -out_dir /home/nobody/source/compute-runtime/build/bin/Gen12LPlp/0/test_files/x64/ -revision_id 0 -options -cl-finite-math-only -options_name
: CommandLine Error: Option 'spirv-expand-step' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted (core dumped)
[342/2454] Generating ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.spv-cl-fast-relaxed-math, ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.bin-cl-fast-relaxed-math, ../../../bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.gen-cl-fast-relaxed-math
FAILED: bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.spv-cl-fast-relaxed-math bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.bin-cl-fast-relaxed-math bin/Gen12LPlp/0/test_files/x64/CopyBuffer_simd16_Gen12LPlp.gen-cl-fast-relaxed-math 
cd /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files && LD_LIBRARY_PATH=/home/nobody/source/compute-runtime/build/bin /home/nobody/source/compute-runtime/build/bin/ocloc -file /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files/CopyBuffer_simd16.cl -device tgllp -64 -out_dir /home/nobody/source/compute-runtime/build/bin/Gen12LPlp/0/test_files/x64/ -revision_id 0 -options -cl-fast-relaxed-math -options_name
: CommandLine Error: Option 'spirv-expand-step' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted (core dumped)

Googling shows this to happen when components have been built against different LLVM versions. However, above is built in a Ubuntu 21.04 container which has only (Ubuntu) LLVM v11 installed.

eero-t commented 2 years ago

CMake options and resulting config it shows:

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_GEN12LP=1 -DSUPPORT_DG1=1 -DSUPPORT_XE_HP_SDV=0 -DSUPPORT_XE_HP_CORE=0  -DNEO_DISABLE_LD_GOLD=1       -DDO_NOT_RUN_AUB_TESTS=1 -DDONT_CARE_OF_VIRTUALS=1 ../
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- branch dir list: /
-- WDK include paths: /home/nobody/source/compute-runtime/third_party/DirectX-Headers/include/wsl;/home/nobody/source/compute-runtime/third_party/DirectX-Headers/include/wsl/stubs;/home/nobody/source/compute-runtime/third_party/DirectX-Headers/include/directx;/home/nobody/source/compute-runtime/third_party/DirectX-Headers/include/dxguids;/home/nobody/source/compute-runtime/third_party/libdxg/include/
-- Driver model : drm_or_wddm
-- Host processor: x86_64
-- Target processor: x86_64
-- Neo target processor: x86_64
-- Performing Test COMPILER_SUPPORTS_LLD
-- Performing Test COMPILER_SUPPORTS_LLD - Success
-- Performing Test COMPILER_SUPPORTS_GOLD
-- Performing Test COMPILER_SUPPORTS_GOLD - Success
-- Using linker: default
-- Release build configuration
-- Computed OpenCL version major is: 21
-- Computed OpenCL version minor is: 52
-- GTest repeat count set to 1
-- GTest shuffle set to --gtest_shuffle;--gtest_random_seed=0
-- Source Level Debugger headers dir: /home/nobody/source/compute-runtime/third_party/source_level_debugger
-- Aub Stream Headers dir: /home/nobody/source/compute-runtime/third_party/aub_stream/headers
-- Metrics Library dir: /home/nobody/source/compute-runtime/third_party/metrics_library
-- Metrics Discovery dir: /home/nobody/source/compute-runtime/third_party/metrics_discovery
-- Khronos OpenCL headers dir: /home/nobody/source/compute-runtime/third_party/opencl_headers
-- Khronos OpenGL headers dir: /home/nobody/source/compute-runtime/third_party/opengl_headers
-- Third party dir: /home/nobody/source/third_party
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'igc-opencl'
--   Found igc-opencl, version 1.0.1
-- IGC include dirs: /usr/local/include/igc;/usr/local/include/igc/cif;/usr/local/include/igc/ocl_igc_shared/executable_format;/usr/local/include/igc/ocl_igc_shared/device_enqueue
-- VISA Dir: /usr/local/include/visa
-- IGA Includes dir: /usr/local/include/iga
-- Checking for module 'igdgmm'
--   Found igdgmm, version 12.0.0
-- GmmLib include dirs: /usr/local/include/igdgmm;/usr/local/include/igdgmm/GmmLib;/usr/local/include/igdgmm/GmmLib/inc;/usr/local/include/igdgmm/inc;/usr/local/include/igdgmm/inc/common;/usr/local/include/igdgmm/util
-- Checking for module 'libva>=1.0.0'
--   No package 'libva' found
-- AUB_STREAM_DIR = 
-- Engine node dir: /home/nobody/source/compute-runtime/third_party/aub_stream/headers
-- Auto-Enabling GEN12LP tests for DG1
-- All supported platforms:  TGLLP DG1 RKL ADLS ADLP ICLLP LKF EHL SKL KBL GLK CFL BXT
-- All tested platforms:  TGLLP DG1 RKL ADLS ADLP ICLLP LKF EHL SKL KBL GLK CFL BXT
-- Default supported platform: SKL
-- Default tested platform: SKL
-- All supported core families: GEN9;GEN11;GEN12LP
-- All tested core families: GEN9;GEN11;GEN12LP
-- Default tested family name: SKLFamily
-- i915 includes dir: /home/nobody/source/compute-runtime/third_party/uapi

-- Performing Test COMPILER_SUPPORTS_INDIRECT_BRANCH_THUNK
-- Performing Test COMPILER_SUPPORTS_INDIRECT_BRANCH_THUNK - Failed
CMake Warning at CMakeLists.txt:595 (message):
  Spectre mitigation -mindirect-branch=thunk flag is not supported by the
  compiler

-- Performing Test COMPILER_SUPPORTS_FUNCTION_RETURN_THUNK
-- Performing Test COMPILER_SUPPORTS_FUNCTION_RETURN_THUNK - Failed
CMake Warning at CMakeLists.txt:601 (message):
  Spectre mitigation -mfunction-return=thunk flag is not supported by the
  compiler

-- Performing Test COMPILER_SUPPORTS_INDIRECT_BRANCH_REGISTER
-- Performing Test COMPILER_SUPPORTS_INDIRECT_BRANCH_REGISTER - Success
-- Performing Test COMPILER_SUPPORTS_SSE42
-- Performing Test COMPILER_SUPPORTS_SSE42 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- All targets will use virtuals
-- GTest exception options set to --gtest_catch_exceptions=1
-- Level Zero driver version: 1.2.0
-- Found LevelZero: /usr/local/include  
-- LevelZero_INCLUDE_DIRS: /usr/local/include
-- LibGenl headers not available. Building without
CMake Warning at level_zero/CMakeLists.txt:84 (find_package):
  By not providing "Findigsc.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "igsc", but
  CMake did not find one.

  Could not find a package configuration file provided by "igsc" with any of
  the following names:

    igscConfig.cmake
    igsc-config.cmake

  Add the installation prefix of "igsc" to CMAKE_PREFIX_PATH or set
  "igsc_DIR" to a directory containing one of the above files.  If "igsc"
  provides a separate development package or SDK, be sure it has been
  installed.

-- igsc Library headers not available. Building without
Prebuilt kernels are linked to Level Zero.
-- Configuring done

-- Generating done
-- Build files have been written to: /home/nobody/source/compute-runtime/build
-- Cache values
// allow use of AppVerifier
APPVERIFIER_ALLOWED:BOOL=OFF

// allow use of ccache
CCACHE_ALLOWED:BOOL=ON

// Path to a program.
CCACHE_EXE_FOUND:FILEPATH=CCACHE_EXE_FOUND-NOTFOUND

// OpenCL program binary cache location
CL_CACHE_LOCATION:STRING=cl_cache

// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=Release

// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local

// Enable built-in kernels compilation
COMPILE_BUILT_INS:BOOL=TRUE

// Path to a program.
GIT:FILEPATH=/usr/bin/git

// generate gcov report
IGDRCL_GCOV:BOOL=OFF

// Install udev rules. An attempt to automatically determine the proper location will be made if UDEV_RULES_DIR is not set.
L0_INSTALL_UDEV_RULES:BOOL=OFF

// Use the default/verbose test output
L0_ULT_VERBOSE:BOOL=OFF

// Path to a file.
LIBGENL_INCLUDE_DIR:PATH=LIBGENL_INCLUDE_DIR-NOTFOUND

// Path to a file.
LevelZero_INCLUDE_DIR:PATH=/usr/local/include

// Use the default/verbose test output
NEO_SHOW_VERBOSE_ULT_RESULTS:BOOL=OFF

// Path to a program.
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3

// Support ADLP
SUPPORT_ADLP:BOOL=TRUE

// Support ADLS
SUPPORT_ADLS:BOOL=TRUE

// Support BXT
SUPPORT_BXT:BOOL=TRUE

// Support CFL
SUPPORT_CFL:BOOL=TRUE

// Support GEN11 for device side enqueue
SUPPORT_DEVICE_ENQUEUE_GEN11:BOOL=TRUE

// Disabled support GEN12LP for device side enqueue
SUPPORT_DEVICE_ENQUEUE_GEN12LP:BOOL=FALSE

// Disabled support GEN8 for device side enqueue
SUPPORT_DEVICE_ENQUEUE_GEN8:BOOL=FALSE

// Support GEN9 for device side enqueue
SUPPORT_DEVICE_ENQUEUE_GEN9:BOOL=TRUE

// Disabled support XE_HPC_CORE for device side enqueue
SUPPORT_DEVICE_ENQUEUE_XE_HPC_CORE:BOOL=FALSE

// Disabled support XE_HPG_CORE for device side enqueue
SUPPORT_DEVICE_ENQUEUE_XE_HPG_CORE:BOOL=FALSE

// Disabled support XE_HP_CORE for device side enqueue
SUPPORT_DEVICE_ENQUEUE_XE_HP_CORE:BOOL=FALSE

// Support DG1
SUPPORT_DG1:BOOL=1

// Support EHL
SUPPORT_EHL:BOOL=TRUE

// Support GEN11 devices
SUPPORT_GEN11:BOOL=1

// Support GEN12LP devices
SUPPORT_GEN12LP:BOOL=1

// Support GEN8 devices
SUPPORT_GEN8:BOOL=0

// Support GEN9 devices
SUPPORT_GEN9:BOOL=1

// default value for SUPPORT_COREx
SUPPORT_GEN_DEFAULT:BOOL=TRUE

// Support GLK
SUPPORT_GLK:BOOL=TRUE

// Support ICLLP
SUPPORT_ICLLP:BOOL=TRUE

// Support KBL
SUPPORT_KBL:BOOL=TRUE

// Support LKF
SUPPORT_LKF:BOOL=TRUE

// default value for support platform
SUPPORT_PLATFORM_DEFAULT:BOOL=TRUE

// Support RKL
SUPPORT_RKL:BOOL=TRUE

// Support SKL
SUPPORT_SKL:BOOL=TRUE

// Support TGLLP
SUPPORT_TGLLP:BOOL=TRUE

// Support XE_HP_CORE devices
SUPPORT_XE_HP_CORE:BOOL=0

// Build ULTs for ADLP
TESTS_ADLP:BOOL=TRUE

// Build ULTs for ADLS
TESTS_ADLS:BOOL=TRUE

// Build ULTs for BXT
TESTS_BXT:BOOL=TRUE

// Build ULTs for CFL
TESTS_CFL:BOOL=TRUE

// Build ULTs for DG1
TESTS_DG1:BOOL=1

// Build ULTs for EHL
TESTS_EHL:BOOL=TRUE

// Build ULTs for GEN11 devices
TESTS_GEN11:BOOL=1

// Build ULTs for GEN12LP devices
TESTS_GEN12LP:BOOL=TRUE

// Build ULTs for GEN8 devices
TESTS_GEN8:BOOL=0

// Build ULTs for GEN9 devices
TESTS_GEN9:BOOL=1

// Build ULTs for GLK
TESTS_GLK:BOOL=TRUE

// Build ULTs for ICLLP
TESTS_ICLLP:BOOL=TRUE

// Build ULTs for KBL
TESTS_KBL:BOOL=TRUE

// Build ULTs for LKF
TESTS_LKF:BOOL=TRUE

// Build ULTs for RKL
TESTS_RKL:BOOL=TRUE

// Build ULTs for SKL
TESTS_SKL:BOOL=TRUE

// Build ULTs for TGLLP
TESTS_TGLLP:BOOL=TRUE

// Build ULTs for XE_HP_CORE devices
TESTS_XE_HP_CORE:BOOL=0

// Link with address sanitization support
USE_ASAN:BOOL=OFF

// Use OpenCL program binary cache
USE_CL_CACHE:BOOL=ON

// Path to a program.
__LD_GOLD_FOUND:FILEPATH=/usr/bin/ld.gold

// Path to a program.
__LD_LLD_FOUND:FILEPATH=__LD_LLD_FOUND-NOTFOUND

// The directory containing a CMake configuration file for igsc.
igsc_DIR:PATH=igsc_DIR-NOTFOUND

// Build unit tests.
level-zero-gpu_BUILD_TESTS:BOOL=ON

(XEHP* stuff is disabled as its unit tests have been failing in my Xeon build machine.)

eero-t commented 2 years ago

Exactly same container build works fine if I downgrade IGC to previous release tag: "igc-1.0.9636".

So this seems like a regression in IGC. Can you move this to IGC, or do I need to file a new bug against it?

IGC build options (working for previous IGC release) and resulting config are following:

cmake -LH -Wno-dev -G Ninja       -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}       -DCMAKE_BUILD_TYPE=Release       -DIGC_OPTION__LLVM_PREFERRED_VERSION=11       -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Source       -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR=ON ./
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at IGC/CMakeLists.txt:159 (message):
  IGC_OPTION__ARCHITECTURE_TARGET: Target architecture is not specified.
  Trying to deduce it from context.

-- ================================ IGC Project ================================
-- Build type:  Release (single-configuration generator)
-- Build tools: OFF
-- 
-- Output directory:
--    "/home/nobody/source/intel-graphics-compiler/IGC/Release"
-- Install root directory:
--    "/usr/local"
-- Architecture:
--  - target: Linux64    (detected: Linux64)
--  - host:   Linux64    (detected: Linux64)
-- 
-- Cross-compilation needed: NO
-- Cross-compilation set:    FALSE
-- 
-- Advanced:
--  - Link BiF resources:              ON
--  - Building Windows Universal:      
-- =============================================================================
-- [Clang] No mode was specified, searching for Clang
-- [SPIRV] SPIRV translator will be built from sources
-- [SPIRV] Using SPIRV sources: /home/nobody/source/llvm-spirv
-- [lld] No mode was specified, searching for lld
-- [LLVM] No LLVM mode was selected explicitly
-- [LLVM] Search will be performed for LLVM sources first, then for prebuilds (including system LLVM)
-- [SPIRV] Building SPIRV with prebuilt LLVM
-- [SPIRV] Found LLVM: /usr/lib/llvm-11/cmake
-- Linker detection: GNU ld
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
-- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS
-- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS - Success
-- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS
-- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS - Success
-- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS
-- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS - Success
-- Performing Test C_SUPPORTS_FDATA_SECTIONS
-- Performing Test C_SUPPORTS_FDATA_SECTIONS - Success
-- Performing Test CXX_SUPPORTS_FDATA_SECTIONS
-- Performing Test CXX_SUPPORTS_FDATA_SECTIONS - Success
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- [SPIRV] Clearing build system compilation flags
-- [SPIRV] PYTHON_EXECUTABLE = 
-- [IGC] IGC will take prebuilt LLVM
-- [IGC] Searching for prebuilt LLVM in /home/nobody/source/intel-graphics-compiler/IGC/../../prebuild-llvm/Release and system directories
-- [IGC] Found LLVM: /usr/lib/llvm-11/cmake
-- [IGC] Using LLVMSPIRVLib that comes with LLVM
CMake Warning at IGC/cmake/igc_find_protobuf.cmake:25 (message):
  Cannot find Protoc program or library for Protobuf, please visit
  https://github.com/protocolbuffers/protobuf/releases and install - disable
  of IGC Metrics
Call Stack (most recent call first):
  IGC/CMakeLists.txt:1362 (include)

-- ============================ SPIRV-Tools project ============================
-- SPIRV-Tools source directory: /home/nobody/source/intel-graphics-compiler/external/SPIRV-Tools/../../../SPIRV-Tools
-- SPIRV-Headers source directory: /home/nobody/source/intel-graphics-compiler/external/SPIRV-Tools/../../../SPIRV-Headers
-- SPIRV-Tools output directory: /home/nobody/source/intel-graphics-compiler/IGC/Release/external/SPIRV-Tools/build
-- Option SKIP_SPIRV_TOOLS_INSTALL: ON
-- Option SPIRV_SKIP_TESTS: ON
-- Option SPIRV_SKIP_EXECUTABLES: ON
-- Option SPIRV_HEADERS_SKIP_INSTALL: ON
-- Option SPIRV_HEADERS_SKIP_EXAMPLES: ON
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.9.5", minimum required is "3") 
-- =============================================================================
-- [IGC] : opencl-clang will be taken from system
-- [IGC] Found clang-11 executable: /usr/bin/clang-11
-- [CMFE] CM Frontend headers are taken from: /home/nobody/source/intel-graphics-compiler/IGC/CMFE/AdaptorCM
-- [CMFE] Using CMFE library name: libclangFEWrapper.so
-- +++ Source/IGC/VectorCompiler +++
-- [VC] Build proj: VectorCompiler
-- [VC] Using vc-intrinsics source from: /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/../../../vc-intrinsics/GenXIntrinsics
 >>/home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/Utils/../<<  ->  /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/Utils
 COMMAND ->  /usr/bin/python3 /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/Utils/cisa_gen_intrinsics.py /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/Utils/cisa_gen_intrinsics.json /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/Utils/../ <-
 /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/Utils
vc_embed_bif - VCBiFPrintfOCL32 has extra dependencies: /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_embed_bif - VCBiFPrintfOCL64 has extra dependencies: /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_embed_bif - VCBiFPrintfZE32 has extra dependencies: /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_embed_bif - VCBiFPrintfZE64 has extra dependencies: /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_embed_bif - VCEmulation64 has extra dependencies: /home/nobody/source/intel-graphics-compiler/IGC/VectorCompiler/lib/BiF/Utils/emulation_divrem_boilerplate.h
Use InstCombiner from LLVM
-- IGC\Metrics - metrics are disabled
-- Configuring Intel Gen Assembler (IGA) Component
--  - GED_BRANCH:           GED_external
--  - CMAKE_CXX_COMPILER:   /usr/bin/c++
--  - IGA_VERSION_SUFFIX:    -373eb77
-- Found BISON: /usr/bin/bison (found version "3.7.5") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
[check-igc] LIT tests disabled. Missing igc_opt target.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nobody/source/intel-graphics-compiler
-- Cache values
// Path to a library.
CCLANG_FROM_SYSTEM:FILEPATH=/usr/lib/libopencl-clang.so

// Path to a program.
CLANG_GE7:FILEPATH=/usr/bin/clang-11

// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=Release

// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local

// Path to a file.
DEFAULT_IGC_LLVM_SOURCES_DIR:PATH=DEFAULT_IGC_LLVM_SOURCES_DIR-NOTFOUND

// Path to a file.
DEFAULT_SPIRV_TRANSLATOR_SOURCE_DIR:PATH=/home/nobody/source/llvm-spirv

// Build SPIRV-TOOLS with c++ exceptions enabled in MSVC
ENABLE_EXCEPTIONS_ON_MSVC:BOOL=ON

// Enables RTTI
ENABLE_RTTI:BOOL=OFF

// Path to a file.
FOUND_VCS:FILEPATH=/usr/lib/llvm-11/lib/cmake/llvm/VersionFromVCS.cmake

// Path to a program.
GIT:FILEPATH=/usr/bin/git

// IGC available build configurations.
IGC_CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release

// Architecture of host used during compilation. Only used when cross-compiling.
IGC_OPTION__ARCHITECTURE_HOST:STRING=Linux64

// Target architecture for compilation.
IGC_OPTION__ARCHITECTURE_TARGET:STRING=Linux64

// Build project igc_opt.
IGC_OPTION__BUILD_IGC_OPT:BOOL=ON

// Clang mode for IGC (can be Source, Prebuilds or empty)
IGC_OPTION__CLANG_MODE:STRING=

// Enable lit testing for IGC compiler. May require additional tools like llvm lit and opt
IGC_OPTION__ENABLE_LIT_TESTS:BOOL=OFF

// Only building igcc part of IST (IGCStandalone).
IGC_OPTION__IST_IGCC_ONLY:BOOL=ON

// Enable link against Khronos SPIRV-LLVM-Translator, instead of legacy versions
IGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR:BOOL=ON

// LLD mode for IGC (can be Source, Prebuilds or empty)
IGC_OPTION__LLD_MODE:STRING=

// LLVM mode for IGC (can be Source, Prebuilds or empty)
IGC_OPTION__LLVM_MODE:STRING=

// Preferred version of LLVM to use
IGC_OPTION__LLVM_PREFERRED_VERSION:STRING=11

// Output directory path where the final libraries will be stored.
IGC_OPTION__OUTPUT_DIR:PATH=/home/nobody/source/intel-graphics-compiler/IGC/Release

// SPIRV mode for IGC (can be Source, Prebuilds or empty)
IGC_OPTION__SPIRV_TRANSLATOR_MODE:STRING=Source

// Path to SPIRV translator sources
IGC_OPTION__SPIRV_TRANSLATOR_SOURCE_DIR:PATH=/home/nobody/source/llvm-spirv

// [Experimental] Enable usage of Khronos SPIRV-LLVM-Translator in Scalar Compiler
IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC:BOOL=OFF

// disable BiF generation for VC (disables some BE features)
IGC_OPTION__VC_DISABLE_BIF:BOOL=OFF

// install GENX_IR or not
INSTALL_GENX_IR:BOOL=ON

// Path to a library.
LIBRT:FILEPATH=/usr/lib/x86_64-linux-gnu/librt.so

// link with /MT or /MD
LINK_AS_STATIC_LIB:BOOL=ON

// Path to a file.
LLD_INCLUDE_DIR:PATH=LLD_INCLUDE_DIR-NOTFOUND

// The directory containing a CMake configuration file for LLVM.
LLVM_DIR:PATH=/usr/lib/llvm-11/cmake

// Disable optional build system features that cause problems for IDE generators
LLVM_ENABLE_IDE:BOOL=OFF

// Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO
LLVM_ENABLE_LTO:STRING=OFF

// Export symbols from LLVM tools so that plugins can import them
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS:BOOL=OFF

// Enable statistics collection for builds that wouldn't normally enable it
LLVM_FORCE_ENABLE_STATS:BOOL=OFF

// 
LLVM_LINK_EXE:STRING=llvm-link

// 
LLVM_OPT_EXE:STRING=opt

// Define the maximum number of concurrent compilation jobs (Ninja only).
LLVM_PARALLEL_COMPILE_JOBS:STRING=

// Define the maximum number of concurrent link jobs (Ninja only).
LLVM_PARALLEL_LINK_JOBS:STRING=

// Use prefix for sources
LLVM_SOURCE_PREFIX:STRING=

// Generate build targets for the llvm-spirv lit tests.
LLVM_SPIRV_INCLUDE_TESTS:BOOL=OFF

// Use relative paths in debug info
LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO:BOOL=OFF

// Use relative paths in sources and debug info
LLVM_USE_RELATIVE_PATHS_IN_FILES:BOOL=OFF

// Skip installation
SKIP_SPIRV_TOOLS_INSTALL:BOOL=ON

// Allow timers via clock_gettime on supported platforms
SPIRV_ALLOW_TIMERS:BOOL=ON

// Build SPIR-V compressing codec
SPIRV_BUILD_COMPRESSION:BOOL=OFF

// Build spirv-fuzz
SPIRV_BUILD_FUZZER:BOOL=OFF

// Build libFuzzer targets
SPIRV_BUILD_LIBFUZZER_TARGETS:BOOL=OFF

// In a debug build, check if the IR context is in a valid state.
SPIRV_CHECK_CONTEXT:BOOL=ON

// Enable color terminal output
SPIRV_COLOR_TERMINAL:BOOL=ON

// Skip building SPIRV-Headers examples
SPIRV_HEADERS_SKIP_EXAMPLES:BOOL=ON

// Skip SPIRV-Headers installation
SPIRV_HEADERS_SKIP_INSTALL:BOOL=ON

// Used by OSS-Fuzz to control, via link options, which fuzzing engine should be used
SPIRV_LIB_FUZZING_ENGINE_LINK_OPTIONS:STRING=

// Enable excessive debug output
SPIRV_LOG_DEBUG:BOOL=OFF

// Skip building the executable and tests along with the library
SPIRV_SKIP_EXECUTABLES:BOOL=ON

// Skip building tests along with the library
SPIRV_SKIP_TESTS:BOOL=ON

// Build SPIRV-Tools-static target. SPIRV-Tools will alias to SPIRV-Tools-static or SPIRV-Tools-shared based on BUILD_SHARED_LIBS
SPIRV_TOOLS_BUILD_STATIC:BOOL=ON

// Install Emacs helper to disassemble/assemble SPIR-V binaries on file load/save.
SPIRV_TOOLS_INSTALL_EMACS_HELPERS:BOOL=OFF

// Enable -Weverything
SPIRV_WARN_EVERYTHING:BOOL=OFF

// Enable error on warning
SPIRV_WERROR:BOOL=ON

// Path to a library.
SYSTEM_COMMON_CLANG:FILEPATH=/usr/lib/libopencl-clang.so

// Path to a library.
lldCommon_PATH:FILEPATH=/usr/lib/llvm-11/lib/liblldCommon.a

// Path to a library.
lldELF_PATH:FILEPATH=/usr/lib/llvm-11/lib/liblldELF.a

// Path to a program.
lld_PATH:FILEPATH=lld_PATH-NOTFOUND
eero-t commented 2 years ago

Note: I'm using Ubuntu opencl-clang, because building that myself would have required pulling & building also LLVM, which would be taking way too much time for building just one of the Intel GPU drivers. Ubuntu "opencl-clang" depends on the same LLVM v11 against which IGC is built, so I do not see why that would be a cause of this issue though: https://packages.ubuntu.com/hirsute/libopencl-clang11

(Especially as previous IGC release worked fine with it.)

JablonskiMateusz commented 2 years ago

Hi @eero-t ,

(Especially as previous IGC release worked fine with it.)

Could you try to build 21.52.22081 with the previous IGC release?

eero-t commented 2 years ago

Could you try to build 21.52.22081 with the previous IGC release?

@JablonskiMateusz As I said, 21.52.22081 + igc-1.0.9636 builds fine.

Whereas 21.52.22081 + igc-1.0.9933 build breaks to ocloc failures (with everything except the release tag from which intel-graphics-compiler project is cloned, being the same).

EDIT: Or did you mean try building even earlier IGC release with the latest compute-runtime?

(At least earlier IGC releases worked with earlier compute-runtime releases.)

JablonskiMateusz commented 2 years ago

If 21.52.22081 works fine with igc-1.0.9636 while fails with igc-1.0.9933, then please transfer the issue to IGC team https://github.com/intel/intel-graphics-compiler

eero-t commented 2 years ago

I thought it was clear from my above comment:

Can you move this to IGC, or do I need to file a new bug against it?

That I do not any see functionality in this ticket to transfer it to IGC. So, I'm asking again, can you move this to IGC, or do I need to file a new bug against it?

eero-t commented 2 years ago

Thanks for moving the ticket! Same issue happens also with the new "compute-runtime" 22.01.22131 release.

eero-t commented 2 years ago

Same issue happens also with the new "compute-runtime" 22.01.22131 release.

And with the new compute-runtime "22.04.22286" release.

eero-t commented 2 years ago

Same issue happens also with the new "compute-runtime" 22.01.22131" and "22.04.22286" releases.

And new "igc-1.0.10183" IGC version. Also, IGC fails building SPIRV-Tools "v2022.1" (for "v2021.4" it still works).

eero-t commented 2 years ago

Same issue happens also with the new "compute-runtime" 22.01.22131" and "22.04.22286" releases.

And new "igc-1.0.10183" IGC version.

And new "igc-1.0.10200" IGC release with new "22.07.22465" compute-runtime release. This time on top of Ubuntu 20.10 i.e. LLVM 12 + GCC 11.

Like earlier, downgrading to IGC "igc-1.0.9636" fixes compute-runtime build.

Also, IGC fails building SPIRV-Tools "v2022.1" (for "v2021.4" it still works).

SPIRV-Tools issue was Khronos having mismatched releases. Build works fine when using e.g. the new "sdk-1.3.204.0" tag for both SPIRV headers and tools projects.

eero-t commented 2 years ago

Same problem with the new "igc-1.0.10395" release (on top of Ubuntu 20.10 i.e. LLVM 12 + opencl-clang12 + GCC 11) when building latest "compute-runtime":

[345/2728] Generating ../../../bin/Gen12LPlp/0/test_files/x64/kernel_num_args_Gen12LPlp.spv, ../../../bin/Gen12LPlp/0/test_files/x64/kernel_num_args_Gen12LPlp.bin, ../../../bin/Gen12LPlp/0/test_files/x64/kernel_num_args_Gen12LPlp.gen
FAILED: bin/Gen12LPlp/0/test_files/x64/kernel_num_args_Gen12LPlp.spv bin/Gen12LPlp/0/test_files/x64/kernel_num_args_Gen12LPlp.bin bin/Gen12LPlp/0/test_files/x64/kernel_num_args_Gen12LPlp.gen 
cd /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files && LD_LIBRARY_PATH=/home/nobody/source/compute-runtime/build/bin /home/nobody/source/compute-runtime/build/bin/ocloc -q -file /home/nobody/source/compute-runtime/opencl/test/unit_test/test_files/kernel_num_args.cl -device tgllp -64 -revision_id 0 -out_dir /home/nobody/source/compute-runtime/build/bin/Gen12LPlp/0/test_files/x64/
: CommandLine Error: Option 'spirv-expand-step' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted (core dumped)

I would like to get working new IGC because the old "igc-1.0.9636" release (working otherwise) does not generate code that would pass "compute-runtime" XE_HP* unit-tests, and I would really like to test it on DG2 HW.

eero-t commented 2 years ago

@pszymich, could somebody take a look at this?

Same months old build regression happens also with the new "igc-1.0.10778" release and latest compute-runtime release "22.12.22749", on all Ubuntu releases with new enough LLVM / opencl-clang version:

What makes this issue more critical now, is that the latest 2 "compute-runtime" releases cannot any more be built even with the older (Dec 22) IGC "igc-1.0.9636" release (which does not have this particular issue), as newer compute-runtime releases require IGC EU fusion support to build. Additionally, IGC "igc-1.0.9636" fails compute-runtime build, if it's built with LLVM 13 (issue #204).

I.e. the latest IGC + compute-runtime combination that I can build with system LLVM (which implies using also system opencl-clang):

Using newer version of any of those, causes compute-runtime build to fail due to different IGC issues.

PS. I guess this bug (along with the external component usage issues that were fixed recently) explains why IGC and compute-runtime versions in forthcoming Ubuntu 22.04 LTS version are even older, from the last summer:

PPS. This is really frustrating as I mainly want up to date L0 Sysman API support on 22.04 for Intel dGPUs from the compute-runtime (which does not need anything from IGC, except it not breaking compute-runtime build). Aargh!!!

mnaczk commented 2 years ago

Hi @eero-t

Starting with the commit 3fde0acae81b48b5225e1760e1feb9ae44ccdbb2: remove spirvdll The vector compiler starts using the Khronos LLVM-SPIRV translator, which is shared with the OpenCL clang. So the libLLVMSPIRVLib.so file used by OpenCL-clang and Vector Compiler must be the same.

In your CMake command line, I see an option -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Source This forces IGC to build the SPIRV_TRANSLATOR from the source, which causes a linking error in the Neo build.

Additionally, I found a bug in IGC CMakeLists.txt that even without -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Source SPIRV_TRANSLATOR will be built from source if on the same level as the IGC folder there is an llvm-spirv folder with SPIRV_TRANSLATOR source. A fix should be available in the next IGC release.

If you want to build your own SPIRV_TRANSLATOR, you need to rebuild openCL-clang.

Please let me know if the above information is helpful.

eero-t commented 2 years ago

@mnaczk I tried using Ubuntu 21.10 spirv-llvm/-dev, spirv-tools and spirv-headers, but then IGC configuration failed to it not finding spirv-tools:

-- [SPIRV-Tools] : IGC_OPTION__SPIRV_TOOLS_MODE set to Prebuilds
-- [SPIRV-Tools] : IGC__OPTION_USE_PREINSTALLED_SPRIV_HEADERS set to OFF
-- [SPIRV-Tools] : Using default path /home/nobody/source/intel-graphics-compiler/IGC/../../SPIRV-Headers
-- [SPIRV-Tools] : Searching prebuilt SPIRV-Tools package
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake:98 (message):
  The imported target "SPIRV-Tools-shared" references the file
     "/usr/lib/x86_64-linux-gnu/libSPIRV-Tools-shared.so"
  but this file does not exist.

FYI: "spirv-tools" package file paths are following: https://packages.ubuntu.com/impish/amd64/spirv-tools/filelist

When I added sources back for SPIRV tools & headers, IGC config phase passed, but then its build failed to vc-intrinsics issues #239.

If build still fails after #239 is dealt with, I could try building both lllvm-spirv + opencl-clang...

(If latter nowadays can be done without also building llvm. Last time I tried it, long time ago, it did not work.)

PS: There's no mention of this LLVM<->SPIRV-LLVM<->OpenCL-Clang restriction in the build instructions, maybe something could be added there: https://github.com/intel/intel-graphics-compiler/blob/master/documentation/build_ubuntu.md

mnaczk commented 2 years ago

@eero-t The error log point that issue is on resolving CMake files. /usr/lib/x86_64-linux-gnu/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake want libSPIRV-Tools-shared.so but it not exist in package https://packages.ubuntu.com/impish/amd64/spirv-tools/filelist. So the issue probably is not on the IGC side.

I mentioned in #239 that vc-intinsics should be checkout to a specific commit described in the IGC release note.

If building IGC with spirv-tool and spirv-headers from the source works fine then the current issue is resolved?

eero-t commented 2 years ago

The error log point that issue is on resolving CMake files. /usr/lib/x86_64-linux-gnu/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake want libSPIRV-Tools-shared.so but it not exist in package https://packages.ubuntu.com/impish/amd64/spirv-tools/filelist. So the issue probably is not on the IGC side.

@tjaalton Any comment on why Ubuntu "spirv-tools" package provides only static version of the tools library, and not the shared one required by IGC?

I mentioned in #239 that vc-intinsics should be checkout to a specific commit described in the IGC release note.

If building IGC with spirv-tool and spirv-headers from the source works fine then the current issue is resolved?

@mnaczk Yes, indeed it works fine now. Thanks!

IMHO you could add some note (to Ubuntu build docs) about which all components need to either come from the system, or be all built from sources, and for which components you do not support use of system versions, but I'll close this now.

tjaalton commented 2 years ago

https://github.com/KhronosGroup/SPIRV-Tools/issues/3909 that pretty much sums it up, especially https://github.com/KhronosGroup/SPIRV-Tools/issues/3214 which was referenced in the Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980370