Issue 179560
Summary [HLSL][SPIRV] Support `ByteAddressBuffer` Load/Store lowering
Labels new issue
Assignees
Reporter kmpeng
    The SPIR-V backend needs to handle the `ByteAddressBuffer` and `RWByteAddressBuffer` Load/Store methods that were added in #176058.

This is the current crash stack:
```hlsl
// RUN: %clang-dxc -spirv -fspv-target-env=vulkan1.3 -T cs_6_5 %s
ByteAddressBuffer In : register(t0);
RWByteAddressBuffer Out : register(u1);

[numthreads(1,1,1)]
void main() {
  uint U0 = In.Load(0);
  Out.Store(0, U0);
}
```
```
Unimplemented implicit down-cast from load.
UNREACHABLE executed at /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:229!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ../llvm-build-debug/bin/clang-dxc -spirv -fspv-target-env=vulkan1.3 -T cs_6_5 clang/test/AST/HLSL/Test.hlsl
1.      <eof> parser at end of file
2. Code generation
3.      Running pass 'Function Pass Manager' on module 'clang/test/AST/HLSL/Test.hlsl'.
4.      Running pass 'SPIRV legalize bitcast pass' on function '@main'
 #0 0x00006452865ec1e1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/kaitlinpeng/llvm-project/llvm/lib/Support/Unix/Signals.inc:842:11
 #1 0x00006452865ec75b PrintStackTraceSignalHandler(void*) /home/kaitlinpeng/llvm-project/llvm/lib/Support/Unix/Signals.inc:924:1
 #2 0x00006452865ea42f llvm::sys::RunSignalHandlers() /home/kaitlinpeng/llvm-project/llvm/lib/Support/Signals.cpp:108:5
 #3 0x00006452865eba35 llvm::sys::CleanupOnSignal(unsigned long) /home/kaitlinpeng/llvm-project/llvm/lib/Support/Unix/Signals.inc:377:1
 #4 0x0000645286506357 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/kaitlinpeng/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:7
 #5 0x0000645286506745 CrashRecoverySignalHandler(int) /home/kaitlinpeng/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:391:1
 #6 0x000073ad62445330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #7 0x000073ad6249eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
 #8 0x000073ad6244527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #9 0x000073ad624288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#10 0x0000645286513840 llvm::install_out_of_memory_new_handler() /home/kaitlinpeng/llvm-project/llvm/lib/Support/ErrorHandling.cpp:225:0
#11 0x00006452842e08c3 (anonymous namespace)::SPIRVLegalizePointerCast::transformLoad(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::LoadInst*, llvm::Value*, llvm::Value*) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:0:7
#12 0x00006452842e04d7 (anonymous namespace)::SPIRVLegalizePointerCast::legalizePointerCast(llvm::IntrinsicInst*) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:390:9
#13 0x00006452842e01f4 (anonymous namespace)::SPIRVLegalizePointerCast::runOnFunction(llvm::Function&) /home/kaitlinpeng/llvm-project/llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp:444:28
#14 0x0000645285ce845a llvm::FPPassManager::runOnFunction(llvm::Function&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1398:23
#15 0x0000645285cece42 llvm::FPPassManager::runOnModule(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:16
#16 0x0000645285ce8d0b (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:23
#17 0x0000645285ce888a llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:16
#18 0x0000645285ced121 llvm::legacy::PassManager::run(llvm::Module&) /home/kaitlinpeng/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1640:3
#19 0x000064528750e5fb (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:1277:19
#20 0x0000645287507ea7 (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:1303:7
#21 0x0000645287507396 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:1473:3
#22 0x0000645287530de2 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:310:3
#23 0x000064528a490678 clang::ParseAST(clang::Sema&, bool, bool) /home/kaitlinpeng/llvm-project/clang/lib/Parse/ParseAST.cpp:190:12
#24 0x0000645287d4e8b3 clang::ASTFrontendAction::ExecuteAction() /home/kaitlinpeng/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1435:1
#25 0x0000645287534d50 clang::CodeGenAction::ExecuteAction() /home/kaitlinpeng/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1108:5
#26 0x0000645287d4eb02 clang::WrapperFrontendAction::ExecuteAction() /home/kaitlinpeng/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1466:1
#27 0x0000645287da552e clang::HLSLFrontendAction::ExecuteAction() /home/kaitlinpeng/llvm-project/clang/lib/Frontend/FrontendActions.cpp:1325:35
#28 0x0000645287d4e226 clang::FrontendAction::Execute() /home/kaitlinpeng/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1317:7
#29 0x0000645287c4c3ae clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/kaitlinpeng/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1007:23
#30 0x0000645287f62ddb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/kaitlinpeng/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:310:8
#31 0x00006452840ec8f3 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/kaitlinpeng/llvm-project/clang/tools/driver/cc1_main.cpp:304:13
#32 0x00006452840df99c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) /home/kaitlinpeng/llvm-project/clang/tools/driver/driver.cpp:226:5
#33 0x00006452840e04f1 clang_main(int, char**, llvm::ToolContext const&)::$_0::operator()(llvm::SmallVectorImpl<char const*>&) const /home/kaitlinpeng/llvm-project/clang/tools/driver/driver.cpp:376:12
#34 0x00006452840e049d 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 0x0000645287a9b271 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 0x0000645287a981d8 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:442:34
#37 0x0000645287a981a5 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 0x000064528500fb69 llvm::function_ref<void ()>::operator()() const /home/kaitlinpeng/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#39 0x000064528650614a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/kaitlinpeng/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:427:3
#40 0x0000645287a97b07 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:442:7
#41 0x0000645287a295e3 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 0x0000645287a297f4 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 0x0000645287a469b2 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:2265:7
#44 0x00006452840df465 clang_main(int, char**, llvm::ToolContext const&) /home/kaitlinpeng/llvm-project/clang/tools/driver/driver.cpp:414:9
#45 0x0000645284113935 main /home/kaitlinpeng/llvm-build-debug/tools/clang/tools/driver/clang-driver.cpp:17:3
#46 0x000073ad6242a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#47 0x000073ad6242a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#48 0x00006452840de125 _start (../llvm-build-debug/bin/clang-dxc+0x6005125)
clang-dxc: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 23.0.0git (https://github.com/llvm/llvm-project.git d8350712b300bcd4d05240b8edec40cc96e6d588)
Target: spirv1.6-unknown-vulkan1.3-compute
Thread model: posix
InstalledDir: /home/kaitlinpeng/llvm-build-debug/bin
Build config: +unoptimized, +assertions
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to