ldc
ldc copied to clipboard
Bump LDC-LLVM to v14.0.6
The remaining lit-test regression for codegen/dcompute_cl_images.d is a failing assertion in the SPIR-V translator. On my box, using latest KhronosGroup/SPIRV-LLVM-Translator@2e9f1262688462caf5035d73e6b60b0749eaef80:
#6 0x00007ffff7883e96 in __GI___assert_fail (assertion=0x555556db8728 "Val && \"isa<> used on a null pointer\"",
file=0x555556ea5c20 "/home/mkinkelin/dev/llvm-project/llvm/include/llvm/Support/Casting.h", line=104,
function=0x555556c3b288 "static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::StructType; From = llvm::Type]") at ./assert/assert.c:101
#7 0x000055555923117b in llvm::isa_impl_cl<llvm::StructType, llvm::Type const*>::doit ()
at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/Support/Casting.h:104
#8 llvm::isa_impl_wrap<llvm::StructType, llvm::Type const*, llvm::Type const*>::doit ()
at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/Support/Casting.h:131
#9 llvm::isa_impl_wrap<llvm::StructType, llvm::Type* const, llvm::Type const*>::doit ()
at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/Support/Casting.h:122
#10 llvm::isa<llvm::StructType, llvm::Type*> () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/Support/Casting.h:143
#11 llvm::dyn_cast<llvm::StructType, llvm::Type> () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/Support/Casting.h:345
#12 SPIRV::isSPIRVStructType () at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVUtil.cpp:262
#13 0x00005555592312bf in SPIRV::getSPIRVStructTypeByChangeBaseTypeName ()
at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVUtil.cpp:1397
#14 SPIRV::getSPIRVTypeByChangeBaseTypeName ()
at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVUtil.cpp:1388
#15 0x0000555559288f2e in operator() ()
at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/OCLToSPIRV.cpp:992
#16 __invoke_impl<std::__cxx11::basic_string<char>, SPIRV::OCLToSPIRVBase::visitCallReadImageWithSampler(llvm::CallInst*, llvm::StringRef, llvm::StringRef)::<lambda(llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&)>&, llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&> () at /usr/include/c++/11/bits/invoke.h:61
#17 __invoke_r<std::__cxx11::basic_string<char>, SPIRV::OCLToSPIRVBase::visitCallReadImageWithSampler(llvm::CallInst*, llvm::StringRef, llvm::StringRef)::<lambda(llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&)>&, llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&> () at /usr/include/c++/11/bits/invoke.h:143
#18 _M_invoke () at /usr/include/c++/11/bits/std_function.h:291
#19 0x000055555923a4b1 in std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&)>::operator()(llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&) const () at /usr/include/c++/11/bits/std_function.h:590
#20 SPIRV::mutateCallInst(llvm::Module*, llvm::CallInst*, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&)>, std::function<llvm::Instruction* (llvm::CallInst*)>, SPIRV::BuiltinFuncMangleInfo*, llvm::AttributeList*, bool) ()
at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVUtil.cpp:785
#21 0x000055555923a9f2 in SPIRV::mutateCallInstSPIRV(llvm::Module*, llvm::CallInst*, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (llvm::CallInst*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::Type*&)>, std::function<llvm::Instruction* (llvm::CallInst*)>, llvm::AttributeList*) ()
at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVUtil.cpp:841
#22 0x000055555927e949 in SPIRV::OCLToSPIRVBase::visitCallReadImageWithSampler ()
at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/OCLToSPIRV.cpp:984
--Type <RET> for more, q to quit, c to continue without paging-- c
#23 0x000055555928ebcf in SPIRV::OCLToSPIRVBase::visitCallInst () at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/OCLToSPIRV.cpp:266
#24 0x000055555927c0e9 in llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::delegateCallInst () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:302
#25 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visitCall () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/Instruction.def:209
#26 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/Instruction.def:209
#27 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, false> > () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:90
#28 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:105
#29 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void>, false, false> > () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:90
#30 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:101
#31 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true, false, void>, false, false> > () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:90
#32 llvm::InstVisitor<SPIRV::OCLToSPIRVBase, void>::visit () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/InstVisitor.h:97
#33 SPIRV::OCLToSPIRVBase::runOCLToSPIRV () at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/OCLToSPIRV.cpp:160
#34 0x000055555927c4b0 in SPIRV::OCLToSPIRVPass::run () at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/OCLToSPIRV.cpp:96
#35 0x00005555591bc7f6 in llvm::detail::PassModel<llvm::Module, SPIRV::OCLToSPIRVPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88
#36 0x000055555920b350 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () at /home/mkinkelin/dev/llvm-project/llvm/include/llvm/IR/PassManager.h:522
#37 runSpirvWriterPasses () at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVWriter.cpp:5212
#38 0x00005555591b8b76 in runOnModule () at /home/mkinkelin/dev/llvm-project/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/SPIRVWriterPass.cpp:43
#39 0x0000555558ddd475 in (anonymous namespace)::codegenModule (Target=..., m=..., filename=filename@entry=0x55555d819110 "/home/mkinkelin/dev/ninja-ldc/tests/codegen/Output/dcompute_cl_images.d.tmp_ocl220_64.spv", fileType=fileType@entry=llvm::CGFT_ObjectFile) at /home/mkinkelin/dev/ldc/driver/toobj.cpp:70
#40 0x0000555558dde044 in (anonymous namespace)::writeObjectFile (filename=0x55555d819110 "/home/mkinkelin/dev/ninja-ldc/tests/codegen/Output/dcompute_cl_images.d.tmp_ocl220_64.spv", m=0x55555d94d7c8) at /home/mkinkelin/dev/ldc/driver/toobj.cpp:259
#41 writeModule (m=0x55555d94d7c8, filename=0x55555d819110 "/home/mkinkelin/dev/ninja-ldc/tests/codegen/Output/dcompute_cl_images.d.tmp_ocl220_64.spv") at /home/mkinkelin/dev/ldc/driver/toobj.cpp:424
#42 0x0000555558de3c85 in DComputeTarget::writeModule (this=0x55555d8a1810) at /home/mkinkelin/dev/ldc/gen/dcompute/target.cpp:65
#43 0x0000555558de036c in DComputeCodeGenManager::writeModules (this=this@entry=0x7fffffffd790) at /home/mkinkelin/dev/ldc/driver/dcomputecodegenerator.cpp:96
#44 0x0000555558dd406d in codegenModules (modules=...) at /home/mkinkelin/dev/ldc/driver/main.cpp:1238
I've tried to quickly look into it, but gave up, as I lack all context, and there's ugly stuff based on hardcoded LLVM type names / trying to derive special types from the Itanium C++ mangling (!)...
Looking into this
Very strange, works for me
$ninja -j5
[0/1] Re-running CMake...
-- Found host D compiler /Users/nicholaswilson/d/ldc2-1.26.0-osx-arm64/bin/ldmd2, with default flags ''
-- Host D compiler ID: LDMD
-- Host D compiler version: LDC - the LLVM D compiler (1.26.0)
-- Host D compiler front-end version: 2096
-- LLVM_NATIVE_ARCH: AArch64
-- Checking for module 'LLVMSPIRVLib'
-- Found LLVMSPIRVLib, version 14.0.0.0
-- -- Building LDC with SPIR-V support
-- LDC version identifier: 1.30.0
$ldc2 --version
LDC - the LLVM D compiler (1.30.0):
based on DMD v2.100.1 and LLVM 14.0.6
built with LDC - the LLVM D compiler (1.26.0)
Default target: arm64-apple-darwin20.6.0
Host CPU: cyclone
http://dlang.org - http://wiki.dlang.org/LDC
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_32 - AArch64 (little endian ILP32)
aarch64_be - AArch64 (big endian)
arm - ARM
arm64 - ARM64 (little endian)
arm64_32 - ARM64 (little endian ILP32)
armeb - ARM (big endian)
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit
thumb - Thumb
thumbeb - Thumb (big endian)
$ ./runlit.py -v codegen/dcompute_cl_images.d
Lit version: 15.0.0
-- Testing: 1 tests, 1 workers --
PASS: LDC :: codegen/dcompute_cl_images.d (1 of 1)
Testing Time: 0.51s
Passed: 1
I'm fine if you want to mark that test as XFAIL for now.
there's ugly stuff based on hardcoded LLVM type names / trying to derive special types from the Itanium C++ mangling (!)
I know! That why I'd love to move to the proper backend in LLVM 15, but that needs new pass infrastructure and support for opaque pointers.
Thx for checking - I guess you didn't enable assertions for your LLVM build?
Ahh, I guess not.
I've ported our LLVM CI from Azure Pipelines to GitHub Actions and verified here that it's still working: https://github.com/ldc-developers/llvm-project/pull/1
I know! That why I'd love to move to the proper backend in LLVM 15, but that needs new pass infrastructure and support for opaque pointers.
Scratch that, looks like they still use the mangling in the new mainline backend https://github.com/llvm/llvm-project/blob/be37caca0055df77c9e3ca0a63d4b2ccefe94f7d/llvm/test/CodeGen/SPIRV/read_image.ll#L34
Superseded by #4311.