Open th0ma7 opened 2 months ago
Using a newer version it looks like this error no longer exists (or build order as now changed and is not showing up yet.
Using the prebuilds of:
llvm*
(14.0.5)intel-opencl-clang
(140)intel-vc-intrinsics
(either 0.18.0 or 0.19.0, no change)intel-level-zero
(1.17.19, tried others, no change neither)Along with the following build options:
CMAKE_ARGS += -DIGC_OPTION__CLANG_MODE='Prebuilds'
CMAKE_ARGS += -DIGC_OPTION__LLVM_MODE='Prebuilds'
CMAKE_ARGS += -DIGC_OPTION__LLVM_PREFERRED_VERSION='14.0.5'
CMAKE_ARGS += -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR='ON'
CMAKE_ARGS += -DIGC_OPTION__SPIRV_TOOLS_MODE='Prebuilds'
CMAKE_ARGS += -DIGC_OPTION__VC_INTRINSICS_MODE='Prebuilds'
CMAKE_ARGS += -DCCLANG_FROM_SYSTEM='ON'
CMAKE_ARGS += -DINSTALL_GENX_IR='ON'
I now get the following error which looks odd llvm::Module::~Module()'
:
[388/989] Linking CXX shared library IGC/Release/libBiFManager.so
FAILED: IGC/Release/libBiFManager.so
: && /home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-g++ -fPIC -I/home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/include -I/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/include -std=gnu++11 -Wno-error=restrict -Wno-error=deprecated-declarations -std=gnu++11 -Wno-error=restrict -Wno-error=deprecated-declarations -fexceptions -fdata-sections -ffunction-sections -O2 -pipe -fmessage-length=0 -march=corei7 -mstackrealign -fms-extensions -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wwrite-strings -Wno-long-long -Wswitch -Wno-sign-compare -Wno-unused-result -Wno-enum-compare -Wno-type-limits -Wno-ignored-qualifiers -Wno-shadow -Wformat -Wformat-security -Wno-extra -Wno-write-strings -finline -fno-strict-aliasing -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -Wno-unknown-pragmas -fPIC -Bsymbolic -D_FORTIFY_SOURCE=2 -fstack-protector -finline-functions -funswitch-loops -Wno-maybe-uninitialized -lrt -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -g -L/home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/lib -L/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib -Wl,--rpath-link,/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib -Wl,--rpath,/usr/local/intel-graphics-compiler/lib -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -g -Wl,--gc-sections -shared -Wl,-soname,libBiFManager.so -o IGC/Release/libBiFManager.so IGC/BiFManager/CMakeFiles/BiFManager.dir/BiFManagerHandler.cpp.o IGC/BiFManager/CMakeFiles/BiFManager.dir/BiFManagerCommon.cpp.o IGC/BiFManager/CMakeFiles/BiFManager.dir/__/AdaptorOCL/OCL/LoadBuffer.cpp.o -Wl,-rpath,/usr/local/intel-graphics-compiler/lib && :
IGC/BiFManager/CMakeFiles/BiFManager.dir/BiFManagerHandler.cpp.o: In function `std::_Rb_tree<int, std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > >, std::_Select1st<std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > >, std::less<int>, std::allocator<std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > > >::_M_erase(std::_Rb_tree_node<std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > >*)':
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.17384.8/build/IGC/Release/bif/OCLBiFImpl.h:84096: undefined reference to `llvm::Module::~Module()'
collect2: error: ld returned 1 exit status
[389/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXVerify_Regioning.cpp.o
[390/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXCisaBuilder.cpp.o
[391/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXInitBiFConstants.cpp.o
[392/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXGVClobberChecker.cpp.o
[393/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLegacyToLscTranslator.cpp.o
[394/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLiveElements.cpp.o
[395/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLiveRanges.cpp.o
[396/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLegalization.cpp.o
[397/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLoadStoreLegalization.cpp.o
[398/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLiveness.cpp.o
[399/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLoadStoreLowering.cpp.o
[400/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXIntrinsics.cpp.o
[401/989] Building CXX object IGC/BiFModule/linux/CMakeFiles/BiFLibOcl.dir/__/__/Release/bif/embedder/OCLBiFImpl__igc_bif_BIFBC_122.cpp.o
ninja: build stopped: subcommand failed.
make[2]: *** [../../mk/spksrc.cross-ninja.mk:61: ninja_compile_target] Error 1
make[2]: Leaving directory '/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler'
make[1]: Leaving directory '/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler'
Looking at installed header files, ~Module
looks there for llvm whereas install/usr/local/intel-graphics-compiler/include
is included in the build flags.
$ grep -R "~Module" *
install/usr/local/intel-graphics-compiler/include/llvm/IR/Module.h: ~Module();
Question then is, should include/llvm/IR/
also be included in the build flags?
Problem ends-up being far more interesting...
igc
builds a tool called CMCLTranslatorTool
which in turn requires libLLVMGenXIntrinsics.so
that gets installed by vc-intrinsics
to run.
intel-opencl-clang
was having build issues as presuming it was a git clone rather than using source tar.gz. This led the build process to mess around with the unrelated git snapshot of my working repository (spksrc framework) and ended-up causing the build to fail. That was recently fixed with https://github.com/intel/opencl-clang/pull/539 and https://github.com/intel/opencl-clang/pull/545 (thnx again @haonanya)vc-intrinsics
when built in-tree with llvm from intel-opencl-clang
ends-up not installing its cmake configuration leading to inability for igc
to find it later on. This is without naming its tentative at build time to, yet this one again, to play with the current repository its sits in resulting in early build failure. I ended-up creating a rather ugly patch to get rid of: conjunction of https://github.com/SynoCommunity/spksrc/pull/6166/commits/1db8da6590d6e29462f602ffb93560c1060bfae8#diff-06a450f52c459db410d62013f6e573344675c6e9f48b7aae5ab1e52ce4ca817e and https://github.com/SynoCommunity/spksrc/pull/6166/commits/4ee454e77a690af4a45f86339d2e2d7e2ef2cefc (needs merging together). Installing vc-intrinsics
over prebuilt opencl-clang + llvm ended-up working just fine (no patch needed, no git repository messing-up), including installing associated cmake configurations (for reference https://github.com/intel/vc-intrinsics/issues/130)
$ tree cmake/VCIntrinsics14/
cmake/VCIntrinsics14/
├── VCIntrinsics14Config.cmake
└── VCIntrinsics14Config-release.cmake
CMCLTranslatorTool
. It hapens that it links itself to llvm/clang library + libLLVMGenXIntrinsics.so
from vc-intrinsics. It hapens that, if llvm is built statically, thus in turn vc-intrinsics being also static, at linking time it ends-up linking twice to llvm/clang libraries as (i believe) also bundled in the vc-intrinsics library, thus fails. Enabling shared libraries at llvm/clang/opencl-clang in-tree solved that.CMCLTranslatorTool
, interestingly this executable is being used later during build, although it wasn't built using NATIVE
like other "in-build" tools like in a normal llvm build. In turn it requires accessing the target libraries to run properly (as remember, I'm cross-compiling against an arch toolchain). So I ended-up adding a LD_LIBRARY_PATH=$(STAGING_INSTALL_PREFIX)/lib
so it can found that libLLVMGenXIntrinsics.so
which was built for the target. As an alternate I tried finding that binary so I could just download and use during the build, no luck. My theory is that, if igc was being built in-tree with llvm, this "may" not be an issue and that binary would be built against NATIVE libraries.igc
to link against llvm/clang shared libraries installed under the INSTALL_PREFIX and thus requires static linking.Next on my todo is to revert back to building in-tree, now using the new -DAPPLY_PATCHES=OFF
to allow opencl-clang
to build, along with potentially re-applying my vc-intrinsics patch (as it otherwise fails in-tree), while hoping that this time CMCLTranslatorTool
gets recognized as a NATIVE
built tool, so it can work as-is during the build and therefore result in a (most probably) "static" build of igc
.
Admittedly, my faith is relatively low and help so far inexistent (unless I've been opening my issue at the wrong place?). Anyhow, thnx in advance if anyone can give me pointers in figuring this one out.
Lastly, just to recall that I'm hopeful to be able to enable opencl in ffmpeg for our SynoCommunity ffmpeg package which in turns requires igc. Thnx in advance.
I'm the ffmpeg maintainer for the SynoCommunity which aims at porting open source software on Synology NAS using the Synology toolchain for their various Linux DSM versions. We're using our https://github.com/SynoCommunity/spksrc framework to cross-compile to various arch (arm, ppc, x64).
I'm working on enabling
--opencl
to ffmpeg for compatible intel based NAS (apollolake and above). My [WIP] PR is https://github.com/SynoCommunity/spksrc/pull/6166.I was finally able to fully build intel-opencl-clang
140
branch with all corresponding requirements. From there I've been trying to get IGC to build using:-DIGC_OPTION__CLANG_MODE='Prebuilds'
-DIGC_OPTION__LLVM_MODE='Prebuilds'
-DIGC_OPTION__SPIRV_TOOLS_MODE='Prebuilds'
Configure works ok (after needing to also include LLVM
lld
,libunwind
and alsoMako
python wheel (all of which I couldn't find any trace of in the build documentation btw).When invoking the build process I hit the following issue:
Full build log available here: build-x64-7.1.log