intel / intel-graphics-compiler

Other
605 stars 158 forks source link

Building errors for compute-runtime: stateless_copy_buffer_to_buffer and bindful_copy_buffer_to_buffer #282

Closed boberfly closed 1 year ago

boberfly commented 1 year ago

Copied from https://github.com/intel/compute-runtime/issues/603

Hi all, I've encountered some build errors trying to build intel-compute-runtime, some of the SPIR-V into bins I presume.

I'm loosely following the build setup of how Arch Linux is bundling things and watching Blender: https://developer.blender.org/D16984

Environment: intel-compute-runtime - 22.49.25018.21 LLVM - 15.0.7 vc-intrinsics - v0.11.0.0 LLVM-SPIRV-Translator - llvm_release_150 branch tip (78ad93b9952cb78889b86e9aa390d013c49dca0b) intel-graphics-compiler - igc-1.0.13064.4 level-zero - v1.8.12 gmmlib - 22.3.0 opencl-clang - ocl-open-150 branch tip (efdae77badff1cfe9b64802927e59f7740d671cc)

Full log here

Interesting bits here:

[585/2079] Generating ../../../../bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8core.gen, ../../../../bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8core.bin FAILED: bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8core.gen bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8core.bin /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8core.gen /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8core.bin cd /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/shared/source/built_ins/kernels && LD_LIBRARY_PATH=/buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/ocloc -q -gen_file -file /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_Gen8core.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_to_buffer_stateless_0 -out_dir /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info /usr/include/c++/12.2.0/bits/unique_ptr.h:445: typename std::add_lvalue_reference<_Tp>::type std::unique_ptr<_Tp, _Dp>::operator() const [with _Tp = llvm::SmallPtrSet<llvm::Argument, 2>; _Dp = std::default_delete<llvm::SmallPtrSet<llvm::Argument, 2> >; typename std::add_lvalue_reference<_Tp>::type = llvm::SmallPtrSet<llvm::Argument, 2>&]: Assertion 'get() != pointer()' failed.

[592/2079] Generating ../../../../bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_0_Gen8core.gen, ../../../../bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_0_Gen8core.bin FAILED: bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_0_Gen8core.gen bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_0_Gen8core.bin /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_0_Gen8core.gen /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_0_Gen8core.bin cd /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/shared/source/built_ins/kernels && LD_LIBRARY_PATH=/buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/ocloc -q -gen_file -file /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_Gen8core.spv -spirv_input -device bdw -force_stos_opt -64 -output bindful_copy_buffer_to_buffer_0 -out_dir /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info /usr/include/c++/12.2.0/bits/unique_ptr.h:445: typename std::add_lvalue_reference<_Tp>::type std::unique_ptr<_Tp, _Dp>::operator() const [with _Tp = llvm::SmallPtrSet<llvm::Argument, 2>; _Dp = std::default_delete<llvm::SmallPtrSet<llvm::Argument, 2> >; typename std::add_lvalue_reference<_Tp>::type = llvm::SmallPtrSet<llvm::Argument, 2>&]: Assertion 'get() != pointer()' failed.

Adding @frantisekz 's bakctrace:

(gdb) bt
#0  0x00007ffff7cfde5c in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007ffff7cada76 in raise () from /lib64/libc.so.6
#2  0x00007ffff7c977fc in abort () from /lib64/libc.so.6
#3  0x00007ffff7ad7e80 in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib64/libstdc++.so.6
#4  0x00007ffff5a32375 in IGC::ScalarArgAsPointerAnalysis::findArgs(llvm::Instruction*) () from /lib64/libigc.so.1
#5  0x00007ffff5a325a4 in IGC::ScalarArgAsPointerAnalysis::findArgs(llvm::Instruction*) () from /lib64/libigc.so.1
#6  0x00007ffff5a325a4 in IGC::ScalarArgAsPointerAnalysis::findArgs(llvm::Instruction*) () from /lib64/libigc.so.1
#7  0x00007ffff5a32f87 in IGC::ScalarArgAsPointerAnalysis::analyzePointer(llvm::Value*) [clone .part.0] () from /lib64/libigc.so.1
#8  0x00007ffff5a34353 in IGC::ScalarArgAsPointerAnalysis::runOnModule(llvm::Module&) () from /lib64/libigc.so.1
#9  0x00007fffeefbc148 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /lib64/libLLVM-15.so
#10 0x00007ffff584ecaf in IGC::CommonOCLBasedPasses(IGC::OpenCLProgramContext*, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >) () from /lib64/libigc.so.1
#11 0x00007ffff584f803 in IGC::UnifyIRSPIR(IGC::OpenCLProgramContext*, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >)
    () from /lib64/libigc.so.1
#12 0x00007ffff582536a in TC::TranslateBuildSPMD(TC::STB_TranslateInputArgs const*, TC::STB_TranslateOutputArgs*, TC::TB_DATA_FORMAT, IGC::CPlatform const&, float, ShaderHash const&) ()
   from /lib64/libigc.so.1
#13 0x00007ffff5fdd037 in IGC::VLD::TranslateBuildSPMDAndESIMD(TC::STB_TranslateInputArgs const*, TC::STB_TranslateOutputArgs*, TC::TB_DATA_FORMAT, IGC::CPlatform const&, float, ShaderHash const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) [clone .constprop.0] () from /lib64/libigc.so.1
#14 0x00007ffff58275cf in TC::TranslateBuild(TC::STB_TranslateInputArgs const*, TC::STB_TranslateOutputArgs*, TC::TB_DATA_FORMAT, IGC::CPlatform const&, float) () from /lib64/libigc.so.1
#15 0x00007ffff5919093 in IGC::IgcOclTranslationCtx<0ul>::Impl::Translate(unsigned long, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, unsigned int, void*) const () from /lib64/libigc.so.1
#16 0x00007ffff59197c3 in IGC::IgcOclTranslationCtx<1ul>::TranslateImpl(unsigned long, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, CIF::Builtins::Buffer<1ul>*, unsigned int) () from /lib64/libigc.so.1
#17 0x00007ffff7f36eec in IGC::IgcOclTranslationCtx<1ul>::Translate<IGC::OclTranslationOutput<1ul> > (tracingOptionsCount=0, tracingOptions=0x0, internalOptions=<optimized out>, options=<optimized out>, 
    src=<optimized out>, this=<optimized out>) at /usr/include/igc/ocl_igc_interface/igc_ocl_translation_ctx.h:33
#18 NEO::OfflineCompiler::buildSourceCode (this=0x55555556f9d0) at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/offline_compiler.cpp:367
#19 0x00007ffff7f3a215 in NEO::OfflineCompiler::build (this=0x55555556f9d0) at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/offline_compiler.cpp:398
#20 0x00007ffff7f46f91 in SafetyGuardLinux::call<int, NEO::OfflineCompiler, int (NEO::OfflineCompiler::*)()> (this=this@entry=0x7fffffffdcb0, object=object@entry=0x55555556f9d0, method=<optimized out>, 
    retValueOnCrash=retValueOnCrash@entry=-5152) at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/utilities/linux/safety_guard_linux.h:62
#21 0x00007ffff7f46cc0 in buildWithSafetyGuard (compiler=compiler@entry=0x55555556f9d0)
    at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/utilities/linux/safety_caller_linux.cpp:20
#22 0x00007ffff7f30768 in Ocloc::Commands::compile (argHelper=argHelper@entry=0x55555556c440, args=std::vector of length 17, capacity 17 = {...})
    at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/ocloc_interface.cpp:130
#23 0x00007ffff7f1b414 in oclocInvoke (numArgs=17, argv=0x7fffffffe0d8, numSources=0, dataSources=0x0, lenSources=0x0, nameSources=0x0, numInputHeaders=0, dataInputHeaders=0x0, lenInputHeaders=0x0, 
    nameInputHeaders=0x0, numOutputs=0x0, dataOutputs=0x0, lenOutputs=0x0, nameOutputs=0x0) at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/ocloc_api.cpp:52
#24 0x0000555555555097 in main (argc=<optimized out>, argv=<optimized out>) at /builddir/build/BUILD/compute-runtime-22.49.25018.21/shared/offline_compiler/source/main.cpp:11
mnaczk commented 1 year ago

Hi @boberfly This issue's original problem seems to relate to LLVM API incompatibility.

You use igc-1.0.13064 branch which is a stabilization branch for release with hotfixes mainly regarding the new ZEBinary communication interface. The branch tags may not be fully LLVM API compatible. (For LLVM versions greater than 11).

Please try to build with the IGC master's latest commit. The latest master should be LLVM 15 API compatible.

If the issue does not reproduce on the latest master, please close the issue.

frantisekz commented 1 year ago

@mnaczk it affects master (verified 37b55dab31d692aa6a8f09bbd58cd83e7dee3f16 ).

To elaborate a bit more, igc, in general, is LLVM 15 compatible, but since d26747a94644d5008d5dcb7ec77158f5ebaf9306 (or equivalent commit in master) all the way to the current HEAD, processing of compute-runtime's some builtins (like stateless_copy_buffer_to_buffer and bindful_copy_buffer_to_buffer) fails at the assertion mentioned above.

mnaczk commented 1 year ago

Thank @frantisekz for clarification. I tried to reproduce this error on my local Ubuntu 22.04 machine but without a success.

Environment: intel-compute-runtime - 22.49.25018.21 LLVM - 15.0.7 vc-intrinsics - v0.11.0.0 LLVM-SPIRV-Translator - llvm_release_150 branch tip (78ad93b9952cb78889b86e9aa390d013c49dca0b) intel-graphics-compiler - https://github.com/intel/intel-graphics-compiler/commit/37b55dab31d692aa6a8f09bbd58cd83e7dee3f16 level-zero - v1.8.12 gmmlib - 22.3.0 opencl-clang - ocl-open-150 branch tip (efdae77badff1cfe9b64802927e59f7740d671cc)

On the Ubuntu 22.04 machine NEO build finished without any errors.

I made a closer look at the error message cd /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/shared/source/built_ins/kernels && LD_LIBRARY_PATH=/buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/ocloc -q -gen_file -file /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_Gen8core.spv -spirv_input -device bdw -force_stos_opt -64 -output bindful_copy_buffer_to_buffer_0 -out_dir /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info

and found out that the error occurs when offline compilation is made on the file bindful_copy_buffer_to_buffer_Gen8core.spv

In my local reproduction, this file is not generated.

I could easily debug this issue (without the whole NEO context) if I had access to that .spv file.

@frantisekz Could you provide this file? In the build log I found it in this location: /buildstream/carbonOS/pkgs/intel/compute-runtime.bst/_builddir/bin/built_ins/x64/gen8/bindful_copy_buffer_to_buffer_Gen8core.spv

frantisekz commented 1 year ago

@mnaczk My last build failed with the same assert on stateless_copy_buffer_to_buffer_stateless_Gen8bdw.spv (I guess order can be a bit random due to parallel compile? I hope it works for you). Github doesn't support spv files, so here it is: https://drive.google.com/file/d/1sGT2piVd-aBuOLDkTfehH_K_HnVZrx2r/view?usp=sharing

In my local reproduction, this file is not generated.

This sounds weird, but I don't any ideas why it could build different set of files. Also, I won't have an access to my laptop/internet for next ~16 days for any further testing/replies.

mnaczk commented 1 year ago

Thank @frantisekz for attaching the spirv file. Unfortunately, I can not reproduce the issue with this file.

I attempt to reproduce the issue on the clean Arch Linux docker container. But still, I was unable to reproduce your issue. On my configuration, NEO builds correctly with the IGC with LLVM15.

Below are my reproduction steps:

I run a clean Arch Linux docker container docker run -it archlinux:latest bash

then I run script

#!/bin/sh

yes | pacman -Sy
yes | pacman -S bison cmake flex git gcc pkgconf python ninja

yes | pacman -S level-zero-headers # community/level-zero-headers 1.8.12-1
yes | pacman -S level-zero-loader # community/level-zero-loader 1.8.12-1
yes | pacman -S intel-gmmlib # community/intel-gmmlib 22.3.3-1
yes | pacman -S lld=15.0.7-1 # extra/lld 15.0.7-1
yes | pacman -S llvm=15.0.7-1 # extra/clang 15.0.7-1
yes | pacman -S intel-opencl-clang # community/intel-opencl-clang 15.0.0-1
yes | pacman -S spirv-headers # community/spirv-headers 1:1.3.236.0-1
yes | pacman -S spirv-llvm-translator # community/spirv-llvm-translator 15.0.0.r10+g78ad93b9-1
yes | pacman -S vc-intrinsics # community/vc-intrinsics 0.11.0-2

cd ~
mkdir IGC_workspace && cd IGC_workspace
git clone https://github.com/intel/intel-graphics-compiler igc
cd igc && git checkout 37b55dab31d692aa6a8f09bbd58cd83e7dee3f16 && cd ..

# Remove add_custom_target(SPIRV-Tools) from igc/external/SPIRV-Tools/CMakeLists.txt as WA for issue #278
sed -i '/add_custom_target(SPIRV-Tools)/d' ./igc/external/SPIRV-Tools/CMakeLists.txt 

mkdir build && cd build
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DIGC_OPTION__CLANG_MODE=Prebuilds -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR=ON -DIGC_OPTION__LLD_MODE=Prebuilds -DIGC_OPTION__LLVM_MODE=Prebuilds -DIGC_OPTION__LLVM_PREFERRED_VERSION=15.0.7 -DIGC_OPTION__SPIRV_TOOLS_MODE=Prebuilds -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Prebuilds -DIGC_OPTION__USE_PREINSTALLED_SPRIV_HEADERS=ON -Wno-dev -DIGC_BUILD__VC_ENABLED=ON -DIGC_OPTION__VC_INTRINSICS_MODE=Prebuilds -DCMAKE_BUILD_TYPE=Release ../igc
cmake --build .
cmake --install .

cd ~
mkdir NEO_workspace && cd NEO_workspace
git clone -b 22.49.25018.21 https://github.com/intel/compute-runtime neo
mkdir build && cd build
cmake -G"Ninja" -DCMAKE_INSTALL_PREFIX:PATH="/usr" -DCMAKE_INSTALL_LIBDIR:PATH="lib"  -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Release -DSKIP_UNIT_TESTS=1 -DNEO_SKIP_UNIT_TESTS=1 ../neo
cmake --build .

I don't know what arguments you used to configure IGC with CMake. Maybe the error is caused by wrong arguments. Or do you see that I missed something in my configuration?

RinCat commented 1 year ago

Run into a similar issue:

[564/3142] cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_rect_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_rect_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
FAILED: bin/built_ins/x64/gen8/stateless_copy_buffer_rect_stateless_0_Gen8bdw.bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_rect_stateless_0_Gen8bdw.bin 
cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_rect_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_rect_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/unique_ptr.h:445: typename add_lvalue_reference<element_type>::type std::unique_ptr<llvm::SmallPtrSet<llvm::Argument *, 2>>::operator*() const [_Tp = llvm::SmallPtrSet<llvm::Argument *, 2>, _Dp = std::default_delete<llvm::SmallPtrSet<llvm::Argument *, 2>>]: Assertion 'get() != pointer()' failed.
[565/3142] /usr/lib/llvm/15/bin/clang++  @shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/__/__/__/__/bin/built_ins/x64/spirv/fill_image3d.cpp.o.rsp -MD -MT shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/__/__/__/__/bin/built_ins/x64/spirv/fill_image3d.cpp.o -MF shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/__/__/__/__/bin/built_ins/x64/spirv/fill_image3d.cpp.o.d -o shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/__/__/__/__/bin/built_ins/x64/spirv/fill_image3d.cpp.o -c /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/spirv/fill_image3d.cpp
[566/3142] cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_to_buffer_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
FAILED: bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8bdw.bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_0_Gen8bdw.bin 
cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_buffer_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_to_buffer_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/unique_ptr.h:445: typename add_lvalue_reference<element_type>::type std::unique_ptr<llvm::SmallPtrSet<llvm::Argument *, 2>>::operator*() const [_Tp = llvm::SmallPtrSet<llvm::Argument *, 2>, _Dp = std::default_delete<llvm::SmallPtrSet<llvm::Argument *, 2>>]: Assertion 'get() != pointer()' failed.
[567/3142] : && /usr/bin/cmake -E rm -f lib/libneo_shared.a && /usr/lib/llvm/15/bin/llvm-ar qc lib/libneo_shared.a  @CMakeFiles/neo_shared.rsp && /usr/lib/llvm/15/bin/llvm-ranlib lib/libneo_shared.a && :
[568/3142] cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_image3d_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_to_image3d_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
FAILED: bin/built_ins/x64/gen8/stateless_copy_buffer_to_image3d_stateless_0_Gen8bdw.bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_image3d_stateless_0_Gen8bdw.bin 
cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_image3d_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_to_image3d_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/unique_ptr.h:445: typename add_lvalue_reference<element_type>::type std::unique_ptr<llvm::SmallPtrSet<llvm::Argument *, 2>>::operator*() const [_Tp = llvm::SmallPtrSet<llvm::Argument *, 2>, _Dp = std::default_delete<llvm::SmallPtrSet<llvm::Argument *, 2>>]: Assertion 'get() != pointer()' failed.
[569/3142] cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_image3d_to_buffer_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_image3d_to_buffer_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
FAILED: bin/built_ins/x64/gen8/stateless_copy_image3d_to_buffer_stateless_0_Gen8bdw.bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_image3d_to_buffer_stateless_0_Gen8bdw.bin 
cd /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/shared/source/built_ins/kernels && LD_LIBRARY_PATH=:/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/ocloc -q -file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8/stateless_copy_image3d_to_buffer_stateless_Gen8bdw.spv -spirv_input -device bdw -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_image3d_to_buffer_stateless_0 -out_dir /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/bin/built_ins/x64/gen8 -revision_id 0 -options -cl-kernel-arg-info
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/unique_ptr.h:445: typename add_lvalue_reference<element_type>::type std::unique_ptr<llvm::SmallPtrSet<llvm::Argument *, 2>>::operator*() const [_Tp = llvm::SmallPtrSet<llvm::Argument *, 2>, _Dp = std::default_delete<llvm::SmallPtrSet<llvm::Argument *, 2>>]: Assertion 'get() != pointer()' failed.

Configuration:

>>> Preparing source in /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build"
 * Applying intel-compute-runtime-22.24.23453-remove-fortify-sources.patch ...
 [ ok ]
 * Applying intel-compute-runtime-22.49.25018.24-level-zero-1.9.patch ...
 [ ok ]
 * Hardcoded definition(s) removed in CMakeLists.txt:
 *    set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: [Release, ReleaseI
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build"
cmake -C /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCCACHE_ALLOWED=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64 -DBUILD_WITH_L0=yes -DDISABLE_LIBVA=no -DNEO__METRICS_LIBRARY_INCLUDE_DIR=/usr/include -DKHRONOS_GL_HEADERS_DIR=/usr/include -DOCL_ICD_VENDORDIR=/etc/OpenCL/vendors -DSUPPORT_DG1=ON -Wno-dev -DSKIP_UNIT_TESTS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/gentoo_toolchain.cmake /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24
loading initial cache file /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24_build/gentoo_common_config.cmake
-- The C compiler identification is Clang 15.0.7
-- The CXX compiler identification is Clang 15.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/llvm/15/bin/clang - 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/lib/llvm/15/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- branch dir list: /
-- Host processor: x86_64
-- Target processor: x86_64
-- Neo target processor: x86_64
-- WDK include paths: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/DirectX-Headers/include/wsl;/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/DirectX-Headers/include/wsl/stubs;/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/DirectX-Headers/include/directx;/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/DirectX-Headers/include/dxguids;/var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/libdxg/include/
-- Driver model : drm_or_wddm
-- Performing Test COMPILER_SUPPORTS_LLD
-- Performing Test COMPILER_SUPPORTS_LLD - Success
-- Performing Test COMPILER_SUPPORTS_GOLD
-- Performing Test COMPILER_SUPPORTS_GOLD - Success
-- Using linker: ld.lld
-- Release build configuration
-- Source Level Debugger headers dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/source_level_debugger
-- Aub Stream Headers dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/aub_stream
-- Khronos OpenCL headers dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/opencl_headers
-- Khronos OpenGL headers dir: /usr/include
-- AOT config headers dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/aot_config_headers
-- Third party dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/third_party
-- Found PkgConfig: /usr/bin/x86_64-pc-linux-gnu-pkg-config (found version "1.8.0") 
-- Checking for module 'igc-opencl'
--   Found igc-opencl, version 1.0.1
-- IGC include dirs: /usr/include/igc;/usr/include/igc/cif;/usr/include/igc/ocl_igc_shared/executable_format;/usr/include/igc/ocl_igc_shared/device_enqueue
-- VISA Dir: /usr/include/visa
-- IGA Includes dir: /usr/include/iga
-- Checking for module 'igdgmm'
--   Found igdgmm, version 12.3.0
-- GmmLib include dirs: /usr/include/igdgmm;/usr/include/igdgmm/GmmLib;/usr/include/igdgmm/GmmLib/inc;/usr/include/igdgmm/inc;/usr/include/igdgmm/inc/common;/usr/include/igdgmm/util
-- Checking for module 'libigdml'
--   Found libigdml, version 1.0.114
-- Metrics Library include dirs: 
-- Checking for module 'libigdmd'
--   Package 'libigdmd', required by 'virtual:world', not found
-- Metrics Discovery dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/metrics_discovery
-- Checking for module 'libva>=1.0.0'
--   Found libva, version 1.16.0
-- Looking for vaGetLibFunc in va
-- Looking for vaGetLibFunc in va - found
-- Using libva 
-- AUB_STREAM_DIR = 
-- Engine node dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/aub_stream
-- Auto-Enabling GEN12LP support for DG1
-- All supported platforms:  PVC DG2 TGLLP DG1 RKL ADLS ADLP ADLN ICLLP LKF EHL SKL KBL GLK CFL BXT BDW
-- All tested platforms: 
-- Default supported platform: PVC
-- Default tested platform: 
-- All supported core families: GEN8;GEN9;GEN11;GEN12LP;XE_HPG_CORE;XE_HPC_CORE
-- All tested core families: 
-- Default tested family name: 
-- i915 prelim headers detection: FALSE
-- i915 includes dir: /var/tmp/portage/dev-libs/intel-compute-runtime-22.49.25018.24/work/compute-runtime-22.49.25018.24/third_party/uapi
-- Performing Test COMPILER_SUPPORTS_RETPOLINE
-- Performing Test COMPILER_SUPPORTS_RETPOLINE - Success
-- Performing Test COMPILER_SUPPORTS_SSE42
-- Performing Test COMPILER_SUPPORTS_SSE42 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- Performing Test COMPILER_SUPPORTS_NEON
-- Performing Test COMPILER_SUPPORTS_NEON - Failed
-- L0: Selected platforms for testing are not supported. Skipping tests.
-- Level Zero driver version: 1.3.25018
-- Found LevelZero: /usr/include  
-- LevelZero_INCLUDE_DIRS: /usr/include
-- LibGenl headers directory: /usr/include/libnl3
-- igsc Library headers directory: 
-- igsc version: 0.8.7
-- Prebuilt kernels are linked to Level Zero.
-- <<< Gentoo configuration >>>
Build type      Release
Install path    /usr
Compiler flags:
C               -march=znver3 -O2 -pipe -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2
C++             -march=znver3 -O2 -pipe -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -mretpoline -ftemplate-depth=1024 -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wshorten-64-to-32 -Wno-extern-c-compat -Wno-unused-local-typedefs -DSANITIZER_BUILD -Wno-deprecated-register -Wno-deprecated-copy -fstack-protector-strong -Wformat -Wformat-security
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -Wl,-z,relro,-z,now -pie -unwindlib=libunwind -fuse-ld=lld -Wl,--build-id=sha1
Module          -Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -Wl,-z,relro,-z,now -pie -unwindlib=libunwind
Shared          -Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -Wl,-z,relro,-z,now -pie -unwindlib=libunwind

-- Configuring done
-- Generating done
mnaczk commented 1 year ago

Hi @RinCat Could you prepare the reproductions steps? Dockerfile or bash script. As I described in the comment above I am unable to reproduce the issue with the current amount of information.

RinCat commented 1 year ago

I try to reproduce it in ubuntu 22.10 but run into another issue when compile compute-runtime.

The spv files not exists.

root@ubuntu-test:/tmp/workspace/compute-runtime# make -j $(nproc)
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_buffer_rect.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_buffer_rect_stateless.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/aux_translation.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/fill_image3d.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_buffer_to_buffer_stateless.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_buffer_to_buffer.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_buffer_to_image3d.spv
[  1%] Built target run_unit_tests
[  1%] Built target unit_tests
[  1%] Built target builtins_sources
[  1%] Built target igdrcl_lib_release_sharings_enable
[  1%] Built target builtins_vme
[  1%] Built target cpp_generate_tool
Error copying file (if different) from "Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_buffer_rect.spv/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//aux_translation.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_buffer_to_buffer.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
" to "Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_buffer_to_buffer_stateless.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_buffer_rect_stateless.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
".
/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:170: bin/built_ins/x64/spirv/copy_buffer_to_buffer.spv] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:230: bin/built_ins/x64/spirv/copy_buffer_to_buffer_stateless.spv] Error 1
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:235: bin/built_ins/x64/spirv/copy_buffer_rect_stateless.spv] Error 1
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//fill_image3d.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:225: bin/built_ins/x64/spirv/aux_translation.spv] Error 1
".
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_buffer_to_image3d.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:165: bin/built_ins/x64/spirv/copy_buffer_rect.spv] Error 1
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_image3d_to_buffer.spv
[  1%] Generating ../../../../bin/built_ins/x64/spirv/copy_buffer_to_image3d_stateless.spv
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:220: bin/built_ins/x64/spirv/fill_image3d.spv] Error 1
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:185: bin/built_ins/x64/spirv/copy_buffer_to_image3d.spv] Error 1
[  2%] Generating ../../../../bin/built_ins/x64/spirv/copy_image_to_image1d.spv
[  2%] Generating ../../../../bin/built_ins/x64/spirv/copy_image_to_image3d.spv
[  2%] Generating ../../../../bin/built_ins/x64/spirv/copy_image3d_to_buffer_stateless.spv
[  2%] Generating ../../../../bin/built_ins/x64/spirv/copy_image_to_image2d.spv
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_buffer_to_image3d_stateless.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_image3d_to_buffer.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:245: bin/built_ins/x64/spirv/copy_buffer_to_image3d_stateless.spv] Error 1
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_image_to_image1d.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:190: bin/built_ins/x64/spirv/copy_image3d_to_buffer.spv] Error 1
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_image_to_image3d.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_image3d_to_buffer_stateless.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:205: bin/built_ins/x64/spirv/copy_image_to_image3d.spv] Error 1
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:195: bin/built_ins/x64/spirv/copy_image_to_image1d.spv] Error 1
Error copying file (if different) from "/tmp/workspace/kernels_bin/linux/built_ins/x64/spirv//copy_image_to_image2d.spv" to "/tmp/workspace/compute-runtime/bin/built_ins/x64/spirv/".
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:250: bin/built_ins/x64/spirv/copy_image3d_to_buffer_stateless.spv] Error 1
make[2]: *** [shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/build.make:200: bin/built_ins/x64/spirv/copy_image_to_image2d.spv] Error 1
make[1]: *** [CMakeFiles/Makefile2:2619: shared/source/built_ins/kernels/CMakeFiles/builtins_spirv.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
frantisekz commented 1 year ago

Okey dokey, got back to civilization, poked a bit more at it. The issue lies in C(XX)FLAGS. I'll pin it to the exact one in a bit, to compute-runtime/igc or both, but removing these from both the igc and the compute-runtime resolved the issue:

-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fcf-protection -fstack-protector-strong -fstack-clash-protection

and this abomination:

%{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}

which would be fpie in the end I guess.

frantisekz commented 1 year ago

Also poking @ArchangeGabriel as this regression might not affect Arch at all in the end (I barely remember it wasn't using such a strong defensive buildflags?)

frantisekz commented 1 year ago

So, @mnaczk , for me, the error happens with -Wp,-D_GLIBCXX_ASSERTIONS present in C(XX)FLAGS (compute-runtime build works fine with that buildflag dropped). I'll try an Arch vm to repro this using your script.

boberfly commented 1 year ago

@frantisekz success! CarbonOS has those flags as well, I can confirm I've removed those flags from both igc + compute runtime and it went through

mnaczk commented 1 year ago

Thank @frantisekz for the explanation. As the problem with -Wp,-D_GLIBCXX_ASSERTIONS occurs when building Compute Runtime, for further development please open the issue in https://github.com/intel/compute-runtime.

If there is nothing left to do on the IGC side, please close this issue.

frantisekz commented 1 year ago

Thank @frantisekz for the explanation. As the problem with -Wp,-D_GLIBCXX_ASSERTIONS occurs when building Compute Runtime, for further development please open the issue in https://github.com/intel/compute-runtime.

If there is nothing left to do on the IGC side, please close this issue.

I didn't describe it clearly, sorry for that. For problem to occur, the igc has to be compiled with -Wp,-D_GLIBCXX_ASSERTIONS , compute-runtime can be compiled with it and it won't affect the compilation outcome (that depends solely on glibcxx being used to compile the igc).

mnaczk commented 1 year ago

As IGC we do not recommend using -D_GLIBCXX_ASSERTIONS due to performance concerns. @frantisekz Could you please describe how you pass the -D_GLIBCXX_ASSERTIONS to the IGC? Do you do it by overriding current CXX_FLAGS in CMakeLists.txt or passing by the command line variable to cmake? I will appreciate exact reproductions steps.

frantisekz commented 1 year ago

As IGC we do not recommend using -D_GLIBCXX_ASSERTIONS due to performance concerns. @frantisekz Could you please describe how you pass the -D_GLIBCXX_ASSERTIONS to the IGC? Do you do it by overriding current CXX_FLAGS in CMakeLists.txt or passing by the command line variable to cmake? I will appreciate exact reproductions steps.

Fedora buildsys is setting them through the env vars, eg.

CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3  -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -w '
export CFLAGS
CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3  -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -w '
export CXXFLAGS

(entire log is here: https://kojipkgs.fedoraproject.org//packages/intel-igc/1.0.13230.4/1.fc38/data/logs/x86_64/build.log )

I'll try to reproduce the issue on top of your bash script on arch, replicating the build process the way Fedora does would be tedious.

I can leave that flag disabled in the packaged version just fine, especially if there are perf concerns (wouldn't those failures with the assertions enabled point out some issue in the codebase/compiler? I am no expert here at all though.).

frantisekz commented 1 year ago

@mnaczk This would be the reproducer for Arch container (verified the same error happens, drop -Wp,-D_GLIBCXX_ASSERTIONS from igc flags and it works fine):

#!/bin/sh

yes | pacman -Sy
yes | pacman -S bison cmake flex git gcc pkgconf python ninja

yes | pacman -S level-zero-headers # community/level-zero-headers 1.8.12-1
yes | pacman -S level-zero-loader # community/level-zero-loader 1.8.12-1
yes | pacman -S intel-gmmlib # community/intel-gmmlib 22.3.3-1
yes | pacman -S lld=15.0.7-1 # extra/lld 15.0.7-1
yes | pacman -S llvm=15.0.7-1 # extra/clang 15.0.7-1
yes | pacman -S intel-opencl-clang # community/intel-opencl-clang 15.0.0-1
yes | pacman -S spirv-headers # community/spirv-headers 1:1.3.236.0-1
yes | pacman -S spirv-llvm-translator # community/spirv-llvm-translator 15.0.0.r10+g78ad93b9-1
yes | pacman -S vc-intrinsics # community/vc-intrinsics 0.11.0-2

CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -w '
export CFLAGS
CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -w '
export CXXFLAGS

cd ~
mkdir IGC_workspace && cd IGC_workspace
git clone https://github.com/intel/intel-graphics-compiler igc
cd igc && git checkout 37b55dab31d692aa6a8f09bbd58cd83e7dee3f16 && cd ..

# Remove add_custom_target(SPIRV-Tools) from igc/external/SPIRV-Tools/CMakeLists.txt as WA for issue #278
sed -i '/add_custom_target(SPIRV-Tools)/d' ./igc/external/SPIRV-Tools/CMakeLists.txt 

mkdir build && cd build
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DIGC_OPTION__CLANG_MODE=Prebuilds -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR=ON -DIGC_OPTION__LLD_MODE=Prebuilds -DIGC_OPTION__LLVM_MODE=Prebuilds -DIGC_OPTION__LLVM_PREFERRED_VERSION=15.0.7 -DIGC_OPTION__SPIRV_TOOLS_MODE=Prebuilds -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Prebuilds -DIGC_OPTION__USE_PREINSTALLED_SPRIV_HEADERS=ON -Wno-dev -DIGC_BUILD__VC_ENABLED=ON -DIGC_OPTION__VC_INTRINSICS_MODE=Prebuilds -DCMAKE_BUILD_TYPE=Release ../igc
cmake --build .
cmake --install .

cd ~
mkdir NEO_workspace && cd NEO_workspace
git clone -b 22.49.25018.21 https://github.com/intel/compute-runtime neo
mkdir build && cd build
cmake -G"Ninja" -DCMAKE_INSTALL_PREFIX:PATH="/usr" -DCMAKE_INSTALL_LIBDIR:PATH="lib"  -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Release -DSKIP_UNIT_TESTS=1 -DNEO_SKIP_UNIT_TESTS=1 ../neo
cmake --build .
mnaczk commented 1 year ago

I have successfully replicated the error which is linked to the commit https://github.com/intel/intel-graphics-compiler/commit/612eded8e2b8fc0f5712ad7f099591cb15872f46. The issue stems from the incorrect usage of std::unique_ptr in the following files:

https://github.com/intel/intel-graphics-compiler/blob/5a4b8f4a5a67a417fd5fb59043b28c167bdbbbe7/IGC/Compiler/Optimizer/OpenCLPasses/ScalarArgAsPointer/ScalarArgAsPointer.hpp#L115 https://github.com/intel/intel-graphics-compiler/blob/5a4b8f4a5a67a417fd5fb59043b28c167bdbbbe7/IGC/Compiler/Optimizer/OpenCLPasses/ScalarArgAsPointer/ScalarArgAsPointer.cpp#L120

The implementation is currently being fixed in a work-in-progress state.

frantisekz commented 1 year ago

Fix by https://github.com/intel/intel-graphics-compiler/commit/e98d39974436de32408aefaafbd040ef07f29cf4 confirmed, thanks!

pszymich commented 1 year ago

Thanks @pkwasnie-intel for the fix and thank you @frantisekz for validating. @boberfly, please reopen if the fix does not work for you or you have further qustions.