Issue |
153513
|
Summary |
[HLSL][SPIR-V] Hitting assert when compiling program with 'asdouble' in HLSL
|
Labels |
new issue
|
Assignees |
|
Reporter |
kmpeng
|
https://godbolt.org/z/qzj6PsWPz
Discovered while running the offload-test-suite. Hitting an assert when compiling this program with spirv:
```hlsl
StructuredBuffer<uint4> Low : register(t0);
StructuredBuffer<uint4> High : register(t1);
RWStructuredBuffer<double4> Out : register(u2);
[numthreads(1,1,1)]
void main() {
Out[0] = asdouble(Low[0], High[0]);
}
```
```
Assertion `DstType->getNumElements() >= SrcType->getNumElements()' failed
```
https://github.com/llvm/llvm-project/blob/8432f24831b21c34eb8c03b7cdc75c6f59326395/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp#L191
Crash stack:
```
Stack dump:
0. Program arguments: ../llvm-build-debug/bin/clang-dxc -spirv -fspv-target-env=vulkan1.3 -T cs_6_5 clang/test/CodeGenHLSL/builtins/TestFile.hlsl
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'clang/test/CodeGenHLSL/builtins/TestFile.hlsl'.
4. Running pass 'SPIRV legalize bitcast pass' on function '@main'
#0 0x00005fe7d787e7a1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/kaitlinpeng/llvm-project/llvm/lib/Support/Unix/Signals.inc:834:11
#1 0x00005fe7d787ed2b PrintStackTraceSignalHandler(void*) /home/kaitlinpeng/llvm-project/llvm/lib/Support/Unix/Signals.inc:918:1
#2 0x00005fe7d787ca76 llvm::sys::RunSignalHandlers() /home/kaitlinpeng/llvm-project/llvm/lib/Support/Signals.cpp:104:5
#3 0x00005fe7d787e01e llvm::sys::CleanupOnSignal(unsigned long) /home/kaitlinpeng/llvm-project/llvm/lib/Support/Unix/Signals.inc:374:1
#4 0x00005fe7d779fc87 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/kaitlinpeng/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:7
#5 0x00005fe7d77a0075 CrashRecoverySignalHandler(int) /home/kaitlinpeng/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:391:1
#6 0x000074aae0845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#7 0x000074aae089eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
#8 0x000074aae084527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#9 0x000074aae08288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#10 0x000074aae082881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#11 0x000074aae083b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#12 0x00005fe7d56e65d0 (anonymous namespace)::SPIRVLegalizePointerCast::storeVectorFromVector(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::Value*, llvm::Value*, llvm::Align) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:193:20
#13 0x00005fe7d56e5a34 (anonymous namespace)::SPIRVLegalizePointerCast::transformStore(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::Instruction*, llvm::Value*, llvm::Value*, llvm::Align) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:267:7
#14 0x00005fe7d56e5681 (anonymous namespace)::SPIRVLegalizePointerCast::legalizePointerCast(llvm::IntrinsicInst*) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:315:11
#15 0x00005fe7d56e51a4 (anonymous namespace)::SPIRVLegalizePointerCast::runOnFunction(llvm::Function&) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:342:28
#16 0x00005fe7d6fe00ca llvm::FPPassManager::runOnFunction(llvm::Function&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1398:23
#17 0x00005fe7d6fe4aa2 llvm::FPPassManager::runOnModule(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:16
#18 0x00005fe7d6fe097b (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:23
#19 0x00005fe7d6fe04fa llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:16
#20 0x00005fe7d6fe4d81 llvm::legacy::PassManager::run(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1640:3
#21 0x00005fe7d8721d24 (anonymous namespace)::EmitAssemblyHelper::RunCodegenPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1254:19
#22 0x00005fe7d871b74e (anonymous namespace)::EmitAssemblyHelper::emitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1280:7
#23 0x00005fe7d871ac38 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1443:3
#24 0x00005fe7d8742851 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:316:3
#25 0x00005fe7db6a00b8 clang::ParseAST(clang::Sema&, bool, bool) /home/kaitlinpeng/llvm-project/clang/lib/Parse/ParseAST.cpp:190:12
#26 0x00005fe7d904cac3 clang::ASTFrontendAction::ExecuteAction() /home/kaitlinpeng/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1430:1
#27 0x00005fe7d87467b0 clang::CodeGenAction::ExecuteAction() /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1114:5
#28 0x00005fe7d904c436 clang::FrontendAction::Execute() /home/kaitlinpeng/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1312:7
#29 0x00005fe7d8f645ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/kaitlinpeng/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1066:23
#30 0x00005fe7d9256f57 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/kaitlinpeng/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:299:8
#31 0x00005fe7d55109b8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/kaitlinpeng/llvm-project/clang/tools/driver/cc1_main.cpp:297:13
#32 0x00005fe7d5503892 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/kaitlinpeng/llvm-project/clang/tools/driver/driver.cpp:223:5
#33 0x00005fe7d55043d0 clang_main(int, char**, llvm::ToolContext const&)::$_0::operator()(llvm::SmallVectorImpl<char const*>&) const /home/kaitlinpeng/llvm-project/clang/tools/driver/driver.cpp:366:9
#34 0x00005fe7d550439d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::$_0>(long, llvm::SmallVectorImpl<char const*>&) /home/kaitlinpeng/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#35 0x00005fe7d8dc0d51 llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::operator()(llvm::SmallVectorImpl<char const*>&) const /home/kaitlinpeng/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#36 0x00005fe7d8dbdcb8 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_0::operator()() const /home/kaitlinpeng/llvm-project/clang/lib/Driver/Job.cpp:436:34
#37 0x00005fe7d8dbdc85 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_0>(long) /home/kaitlinpeng/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#38 0x00005fe7d639ce39 llvm::function_ref<void ()>::operator()() const /home/kaitlinpeng/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#39 0x00005fe7d779fa7a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/kaitlinpeng/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:427:3
#40 0x00005fe7d8dbd61b clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /home/kaitlinpeng/llvm-project/clang/lib/Driver/Job.cpp:436:7
#41 0x00005fe7d8d50fb3 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /home/kaitlinpeng/llvm-project/clang/lib/Driver/Compilation.cpp:196:15
#42 0x00005fe7d8d511c4 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /home/kaitlinpeng/llvm-project/clang/lib/Driver/Compilation.cpp:246:13
#43 0x00005fe7d8d6da42 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /home/kaitlinpeng/llvm-project/clang/lib/Driver/Driver.cpp:2243:7
#44 0x00005fe7d5503375 clang_main(int, char**, llvm::ToolContext const&) /home/kaitlinpeng/llvm-project/clang/tools/driver/driver.cpp:404:9
#45 0x00005fe7d5537fe5 main /home/kaitlinpeng/llvm-build-debug/tools/clang/tools/driver/clang-driver.cpp:17:3
#46 0x000074aae082a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#47 0x000074aae082a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#48 0x00005fe7d55020a5 _start (../llvm-build-debug/bin/clang-dxc+0x5c700a5)
clang-dxc: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs