-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Crash when running pass 'Adapt OCL types for SPIR-V' on module 'builtins.link.spirv64-mesa3d-.bc' #55121
Comments
@llvm/issue-subscribers-mlir-spirv |
Not MLIR related as far as I can tell |
Purging |
It appeared the bug disappearing on my end was not caused by building from scratch but by building older LLVM commit to workaround the compat-breaking changes of LLVM turning on opaque pointer by default that broke Mesa, see #54970. So it can be tagged I assume it's now an
The error is now printed this way: llvm-spirv: include/llvm/IR/Type.h:384: llvm::Type *llvm::Type::getNonOpaquePointerElementType() const: Assertion `NumContainedTys && "Attempting to get element type of opaque pointer"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: bin/llvm-spirv --spirv-max-version=1.1 -o spirv64-mesa3d-.spv builtins.link.spirv64-mesa3d-.bc
1. Running pass 'Adapt OCL types for SPIR-V' on module 'builtins.link.spirv64-mesa3d-.bc'.
Build libclc: [ 99%] Built target opt.spirv-mesa3d-.bc
Build libclc: [ 99%] Built target prepare-clspv--.bc
Build libclc: [ 99%] Built target prepare-clspv64--.bc
#0 0x00007f74b67c97e2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm-project/llvm/lib/Support/Unix/Signals.inc:565:22
#1 0x00007f74b67c98a9 PrintStackTraceSignalHandler(void*) llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
#2 0x00007f74b67c7454 llvm::sys::RunSignalHandlers() llvm-project/llvm/lib/Support/Signals.cpp:103:20
#3 0x00007f74b67c9113 SignalHandler(int) llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
#4 0x00007f74b5011520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007f74b5065828 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0x00007f74b5065828 __pthread_kill_internal ./nptl/pthread_kill.c:80:10
#7 0x00007f74b5065828 pthread_kill ./nptl/pthread_kill.c:91:10
#8 0x00007f74b5011476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#9 0x00007f74b4ff77b7 abort ./stdlib/abort.c:81:7
#10 0x00007f74b4ff76db get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
#11 0x00007f74b4ff76db _nl_load_domain ./intl/loadmsgcat.c:970:34
#12 0x00007f74b5008e26 (/lib/x86_64-linux-gnu/libc.so.6+0x39e26)
#13 0x000055f6364f4e97 llvm::Type::getNonOpaquePointerElementType() const (bin/llvm-spirv+0x10be97)
#14 0x000055f636594c65 llvm::Type::getPointerElementType() const (bin/llvm-spirv+0x1abc65)
#15 0x000055f6365b91bd SPIRV::isPointerToOpaqueStructType(llvm::Type*) (bin/llvm-spirv+0x1d01bd)
#16 0x000055f63675e93d SPIRV::OCLTypeToSPIRVBase::adaptFunctionArguments(llvm::Function*) (bin/llvm-spirv+0x37593d)
#17 0x000055f63675e3c3 SPIRV::OCLTypeToSPIRVBase::runOCLTypeToSPIRV(llvm::Module&) (bin/llvm-spirv+0x3753c3)
#18 0x000055f63675e201 SPIRV::OCLTypeToSPIRVLegacy::runOnModule(llvm::Module&) (bin/llvm-spirv+0x375201)
#19 0x00007f74b6abc94d (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1545:20
#20 0x00007f74b6ab767a llvm::legacy::PassManagerImpl::run(llvm::Module&) llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:13
#21 0x00007f74b6abd25f llvm::legacy::PassManager::run(llvm::Module&) llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1673:1
#22 0x000055f63660aba2 llvm::writeSpirv(llvm::Module*, SPIRV::TranslatorOpts const&, std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (bin/llvm-spirv+0x221ba2)
#23 0x000055f6364c1db5 convertLLVMToSPIRV(SPIRV::TranslatorOpts const&) llvm-spirv.cpp:0:0
#24 0x000055f6364bf942 main (bin/llvm-spirv+0xd6942)
#25 0x00007f74b4ff8fd0 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#26 0x00007f74b4ff907d call_init ./csu/../csu/libc-start.c:128:20
#27 0x00007f74b4ff907d __libc_start_main ./csu/../csu/libc-start.c:379:5
#28 0x000055f6364bc5e5 _start (bin/llvm-spirv+0xd35e5) |
I reopen the issue because Said otherwise, Also A workaround or a fix is needed so It looks like one can do this:
but I don't think it's an acceptable workaround to actually need to build two different |
@llvm/issue-subscribers-opencl |
Do you know on which source file in libclc this failure occurs? My guess is that it will likely be something specific to images or other OpenCL specific types? |
This specific stack trace is I believe fixed by KhronosGroup/SPIRV-LLVM-Translator#1499, not that it actually finishes the conversion process for SPIR-V emission with opaque pointers (there is another PR I'm working on which should make much more code work, although "much more" is itself a far cry from "all"). What you can probably do to mitigate the damage until the translator is fixed is to compile |
This issue can probably be closed now? |
I'll try to reproduce the issue in the coming days to see if it's fixed. |
At this point, the SPIR-V translator should be capable of handling everything as opaque pointers, save for some of the fancier extensions (e.g., Intel's function pointer extensions) that I'm pretty sure libclc doesn't use. The SPIR-V backend is I think not yet supporting opaque pointers, but I don't think libclc is even configurable to use the native SPIR-V backend instead of the translator. |
I'm not able anymore to compile So I cannot verify if that error is fixed or not. |
I was compiling libclc from commit 5bd8735, llvm-spirv was also built using recent commit KhronosGroup/SPIRV-LLVM-Translator@55d1de8 .
The text was updated successfully, but these errors were encountered: