-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling with enabled vc-intrinsics causes segfaults #236
Comments
Hi @ConiKost, |
Hi @pszymich, |
And what exact revision is LLVM? We are verifying IGC against LLVM 13.0.0 and it's been building successfully: https://github.com/intel/intel-graphics-compiler/runs/5713751924. However, latest LLVM13 revision is 13.0.1 as of now. @mnaczk, can we have build scripts updated to released 13.0.1? |
LLVM 13.0.1. I will have to lookup, if there are custom patches. I would like to point out, that I am also using |
It shouldn't but verifying with vc-instrinsics built alongside IGC shouldn't take much time. Could you have a try with |
As expected, it segfaults again. Tried now with Source option.
|
Still happens with newest release :-( |
@ConiKost, could you please try https://github.com/intel/vc-intrinsics/releases/tag/v0.2.0 ? |
I tried IGC 10988 and VC 0.2.0, which still fails for me.
|
I am also getting those segfaults with LLVM-12.
|
@ConiKost Are you sure everything LLVM related (llvm, liblld, llvm-spirv*, clang, opencl-clang) is built/using same version? E.g. Vector compiler and OpenCL-Clang need to be built with same libllvmspirv, with all of them using same LLVM version. See: #224 (comment) FYI: build works fine for me when using:
And these IGC CMake options: "-DCMAKE_BUILD_TYPE=Release -DIGC_OPTION__LLVM_PREFERRED_VERSION=12". Resulting IGC build worked fine with "compute-runtime" 22.15.22905 and 22.16.22992 versions. |
Yes, this is the case. All stuff is build with LLVM-12. I have:
Sources from following git tags:
Both options are set. |
While LLVM13 seems fixed and works with current git master, it still fails with vc-intrinsics enabled. |
Hi @ConiKost, I compiled IGC just fine on these revisions:
Can you confirm the problem is still occuring? |
Yes, I can confirm, that using your exact specified versions still reproduced the problem here. |
Can you specify what do you mean by "enabling vc-intrinsics"? Compiling this module is enabled by default. |
Yes, this means, I am setting this CMake options:
|
I have tried to reproduce the error with the CMake command that you provided, but encountered a few unknowns.
To sum up. Without a complete log of the Cmake configuration stage, it is almost impossible to help out with your problem. |
No response from the submitter in the last 14 days. I am closing the issue. @ConiKost If the problem still exists please reopen the issue. |
@mnaczk IMHO 2 weeks is way too short time to wait for replies, people can easily be away for longer time (on vacation, sick, otherwise busy). Something like a month without a reply would be a more reasonable as a general rule for closing issues. Single notification / question mail can more easily get accidentally filtered / ignored / lost, so pinging the issue few times before closing it may also be a good idea. |
@eero-t you're right, starting now, we'll wait a month for a reply. Thanks for paying attention. |
Sorry, please apologize, but indeed, due holiday and some private stuff, I wasn't able to test further. Could we re-open please? :-)
All stuff is being compiled external and provided as
Yes, this is 100% the case. All mentioned stuff is build with exact same LLVM version. Currently using LLVM 14.0.6.
There is nothing I can do about. The linking needs to be specified, as Gentoo do supports called slotting of LLVM. This means, you can have multiple versions installed. In my case, I only have currently LLVM14 installed (but also tried in past with LLVM13 only). But I can't image in this case, that this an issue here. But since LLVMSPIRVLib is compiled once on the system, the exact same version is re-used accoss all stuff.
Content of file is (currently for 1.0.11485):
Which files do you need? |
@ConiKost Thanks for the response.
Configure /make calls will be useful. Also, build logs for OpenCL and Clang prebuilds will be useful too. I tried to reproduce the issue on Gentoo but I am not familiar with this distribution. So I still will be trying to reproduce the error on Ubuntu. For now my main suspiction based on build.log is that Vector Compiler LIT tests use two different Clang. First clean build with LLVM, second provided by OpenCL clang. I should be able to check this hipotesis if I get build log of prebuilds componets. |
Here we go.
The Please note, some ebuilds are in Gentoo |
And compiling of IGC itself (which fails with enabled
|
Whoops, I am sorry. I just forgot to add them :-) Sorry! Uploaded a new archive containing LLVM, Clang and LLD. I also got them all saved. -> https://www.bl4ckb0x.de/files/dev.tar.bz2 (yes, same file name) |
I was able to reproduce your issue on LLVM13. My reproduction steps:
I am currently debugging the issue. In the meantime, I want to ask why the command
In the log above I can see that the below packages
Are installed only in LLVM 14 version |
Happy to hear, that you were able to reproduce :-)
Could you add |
For emerge --ask --verbose --tree dev-util/intel-graphics-compiler
|
I've spoken with the LLVM gentoo devs. It' normal, that I also got a hint to check, if those created files maybe still wrongly use LLVM-14. I noticed an interessting thing. The Tool
Could it be possible, that there is some code, which does not honor |
Interesting, but in my case, I can see that the CMCLTranslatorTool links with libLLVM-13.so as expected.
I think that we have two different issues, both related to CMCLTranslatorTool. In your build.log I can see a crash that generates an LLVM stack call, which might suggest that CMCLTranslatorTool links with a different LLVM version than Clang which generates VCBiFPrintfOCL64.clang.bc
In my build.log I got
|
Please ignore my LLVM-14 stuff. This is wrong. I just tested again, where it failed. I re-checked and CMCLTranslatorTool is linked against libLLVM-13.so, so all fine! So as expected by you. It's the same error here, so I guess, it's both the same. Do you have any idea, in which direction this issue could go, as this only happens with Gentoo LLVM toolchain?
|
I was unable to solve About the future of this issue. I will try to make CMCL as a standalone project, for experimental purposes. If the problem persists in isolation from the rest of IGC, then it can be concluded that the problem is the LLVM toolchain on gentoo. |
Allright, please give me an update, when available :-) Thank you so far! |
Due to the high amount of work on upgrading IGC to LLVM 14 with production quality. I must postpone work on this issue, I will come back to this issue 2 weeks from now. |
I tried to make CMCL a standalone project but this does not help to debug this issue. |
I don't think, that this is a regression. I am not aware, that this was ever working on Gentoo. |
Support for building using prebuilt vc-intrinsics came fairly late: #142 Has build been tried withvc-intrinsics sources instead of prebuild? (All components in the stack need to use same components as other components in stack: llvm, opencl-clang, vc-intrinsics, spirv-*, igc, compute-runtime.) |
#260 mentions vISA, so it could be related too. |
Yeah, at least, since I am the maintainer of that package, I was never able to build.
Yes, made no difference for me.
I gave a try, patched the path and tried to recompile. Still fails :/ AFAIK, @mnaczk was able to reproduce with his Gentoo test system? |
I was able to reproduce the crash of building the Vector Compiler on Gentoo. As mentioned by @ConiKost in this comment #236 (comment) I hoped that this is a regression because this would be easier to resolve. Therefore I would like to try to build IGC completely without LLVM prebuilts.
will build IGC with the source of the above components. When the above step will be done then I will be able to continue work on this issue. |
Yes, I can do that. I have prepared something locally, but need some help. LLVM seems to consists of lot of subpackages. Which ones do I need and where do I need to place the source? As for SPIRV-Tools, SPIRV-Headers, vc-intrinsics and SPIRV-LLVM-Translator, I as able to get their source included by IGC. |
The instruction on to build IGC with the LLVM components from source can be found here: https://github.com/intel/intel-graphics-compiler/blob/master/documentation/build_ubuntu.md#build-from-sources The directory structure should be like this
|
I am sorry, I don't see myself able to put that into something working. If I do put My last work:
|
I manage to create ebuild file that starts to build IGC with IGC from the source
I still got error I think that this can be related to the fact that I need to change the line Do you know what |
Additionally, for reproduction, I run Gentoo on docker. Do you think that this could be the cause of why I got the error? |
No, that should have nothing to do with that. That's only keywords, if you have a stable or testing system. Since per default most packages are stable, it's okay, if you changed to
To be honest, I have not a slightly idea, why you are getting this error. I am not able to reproduce that on my local system. I have spoken with our infra. Could it be an option, to provide you a Gentoo VM with root access? The only point, it would be IPv6 only reachable, as we currently don't have enough public IPv4 address available. |
@ConiKost, @pszymich, @mnaczk, I was able to reproduce the failure on my home gentoo desktop, and I see, that portage tries to build both vc-intrinsics and all the IGC internal libraries as shared objects. However, IGC expects all this stuff to be compiled as static libraries. I'll try to make all this stuff explicitly static for newer IGC releases. However, we can pass
...
src_configure() {
local mycmakeargs=(
-DLLVM_DIR="$(get_llvm_prefix ${LLVM_MAX_SLOT})"
-DBUILD_SHARED_LIBS=OFF
)
cmake_src_configure
}
...
DEPEND="
dev-libs/opencl-clang:${LLVM_MAX_SLOT}=
dev-util/spirv-tools
sys-devel/lld:${LLVM_MAX_SLOT}=
sys-devel/llvm:${LLVM_MAX_SLOT}=
=dev-libs/intel-vc-intrinsics-0.7.1-r1
"
...
src_configure() {
# Get LLVM version
local llvm_version="$(best_version -d sys-devel/llvm:${LLVM_MAX_SLOT})"
local llvm_version="${llvm_version%%-r*}"
# See https://github.com/intel/intel-graphics-compiler/issues/212
append-ldflags -Wl,-z,undefs
# See https://bugs.gentoo.org/718824
! use debug && append-cppflags -DNDEBUG
local mycmakeargs=(
-DCCLANG_INCLUDE_PREBUILDS_DIR="/usr/lib/clang/${llvm_version##*-}/include"
-DCCLANG_SONAME_VERSION="${LLVM_MAX_SLOT}"
-DCMAKE_LIBRARY_PATH="$(get_llvm_prefix ${LLVM_MAX_SLOT})/$(get_libdir)"
-DIGC_OPTION__ARCHITECTURE_TARGET="Linux64"
-DIGC_OPTION__CLANG_MODE="Prebuilds"
-DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR="ON"
-DIGC_OPTION__LLD_MODE="Prebuilds"
-DIGC_OPTION__LLDELF_H_DIR="${EPREFIX}/usr/include/lld/Common"
-DIGC_OPTION__LLVM_MODE="Prebuilds"
-DIGC_OPTION__LLVM_PREFERRED_VERSION="${llvm_version##*-}"
-DIGC_OPTION__SPIRV_TOOLS_MODE="Prebuilds"
-DIGC_OPTION__SPIRV_TRANSLATOR_MODE="Prebuilds"
-DIGC_OPTION__USE_PREINSTALLED_SPRIV_HEADERS="ON"
-DINSTALL_GENX_IR="ON"
-DSPIRVLLVMTranslator_INCLUDE_DIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAX_SLOT}/include/LLVMSPIRVLib"
-Wno-dev
# Compilation with VectorCompiler causes currently a segfault.
# See https://github.com/intel/intel-graphics-compiler/issues/236
# -DIGC_BUILD__VC_ENABLED="OFF"
-DIGC_OPTION__VC_INTRINSICS_MODE="Prebuilds"
-DBUILD_SHARED_LIBS=OFF
)
cmake_src_configure
} |
While is may be a short term workaround, I am afraid, that we cannot commit this change, since static libs are not allowed by policy and should be only used in special cases in Gentoo. And a second question is open, by for example, in Arch Linux, it seems to work fine with shared libs. They didn't disabled them. |
@ConiKost, actually, the We also need to double-check vc-intrinsics usage as a shared library. Actually, we have never tried, but it probably will work. |
This change should fix the issue for the top-of-trunk IGC: 753a6a4 |
Thanks for clarifying, that would be indeed okay to enable static.
Great, I will test locally and report back. |
Looks good. If I do apply this patch and enable VC, IGC just compiles fine. I will push that into Gentoo. |
Great, Thanks @vmustya for the help. |
If I do compile newest IGC release with enabled vc-intrinsics, compilation fails due segfaulting. Using LLVM 13.
The text was updated successfully, but these errors were encountered: