Skip to content

[Bug] [spirv-opt] Crash on --strip-nonsemantic with Slang shader #6344

@Beyley

Description

@Beyley

I use reflection data internally in my build system, but want to strip it out before it makes it's way to my application (so I don't have to enable extra Vulkan extensions), however I get a crash inside spirv-opt when trying to do so.

basic.spirv.zip
spirv-opt basic.spirv --target-env=vulkan1.0 --strip-nonsemantic -o basic.opt.spirv

* thread #1, name = 'spirv-opt', stop reason = signal SIGABRT
  * frame #0: 0x00007ffff789894c libc.so.6`__pthread_kill_implementation(threadid=<unavailable>, signo=6, no_tid=<unavailable>) at pthread_kill.c:44:76
    frame #1: 0x00007ffff783e410 libc.so.6`__GI_raise(sig=6) at raise.c:26:13
    frame #2: 0x00007ffff782557a libc.so.6`__GI_abort at abort.c:77:3
    frame #3: 0x00007ffff78254e3 libc.so.6`__assert_fail_base(fmt=<unavailable>, assertion=<unavailable>, file=<unavailable>, line=<unavailable>, function=<unavailable>) at assert.c:118:3
    frame #4: 0x00005555555f7aad spirv-opt`spvtools::opt::Instruction::GetOperand(this=0x0000555555d5a058, index=2) const at instruction.h:678:3
    frame #5: 0x00005555557ce522 spirv-opt`spvtools::opt::Instruction::GetSingleWordOperand(this=0x0000555555d5a058, index=2) const at instruction.cpp:184:33
    frame #6: 0x000055555585a3a6 spirv-opt`operator(__closure=0x0000555555d27710, i=0x0000555555d4d0e0) at module.cpp:216:25
    frame #7: 0x000055555585b718 spirv-opt`std::__invoke_impl<void, spvtools::opt::Module::ToBinary(std::vector<unsigned int>*, bool) const::<lambda(const spvtools::opt::Instruction*)>&, const spvtools::opt::Instruction*>((null)=__invoke_other @ 0x00007fffffffc470, __f=0x0000555555d27710, (null)=0x00007fffffffc4e0) &) at invoke.h:63:36
    frame #8: 0x000055555585b2ac spirv-opt`std::__invoke_r<void, spvtools::opt::Module::ToBinary(std::vector<unsigned int>*, bool) const::<lambda(const spvtools::opt::Instruction*)>&, const spvtools::opt::Instruction*>(__fn=0x0000555555d27710, (null)=0x00007fffffffc4e0) &) at invoke.h:113:28
    frame #9: 0x000055555585ae15 spirv-opt`std::_Function_handler<void(const spvtools::opt::Instruction*), spvtools::opt::Module::ToBinary(std::vector<unsigned int>*, bool) const::<lambda(const spvtools::opt::Instruction*)> >::_M_invoke(__functor=0x00007fffffffc9b0, __args#0=0x00007fffffffc4e0) at std_function.h:292:30
    frame #10: 0x00005555556d9709 spirv-opt`std::function<void (spvtools::opt::Instruction const*)>::operator()(this=0x00007fffffffc9b0, __args#0=0x0000555555d4d0e0) const at std_function.h:593:9
    frame #11: 0x00005555557b50f0 spirv-opt`operator(__closure=0x00007fffffffc7a0, inst=0x0000555555d4d0e0) at function.cpp:76:10
    frame #12: 0x00005555557b7372 spirv-opt`std::__invoke_impl<bool, spvtools::opt::Function::ForEachInst(const std::function<void(const spvtools::opt::Instruction*)>&, bool, bool) const::<lambda(const spvtools::opt::Instruction*)>&, const spvtools::opt::Instruction*>((null)=__invoke_other @ 0x00007fffffffc550, __f=0x00007fffffffc7a0, (null)=0x00007fffffffc5c0) &) at invoke.h:63:36
    frame #13: 0x00005555557b6e5f spirv-opt`std::__invoke_r<bool, spvtools::opt::Function::ForEachInst(const std::function<void(const spvtools::opt::Instruction*)>&, bool, bool) const::<lambda(const spvtools::opt::Instruction*)>&, const spvtools::opt::Instruction*>(__fn=0x00007fffffffc7a0, (null)=0x00007fffffffc5c0) &) at invoke.h:116:35
    frame #14: 0x00005555557b6896 spirv-opt`std::_Function_handler<bool(const spvtools::opt::Instruction*), spvtools::opt::Function::ForEachInst(const std::function<void(const spvtools::opt::Instruction*)>&, bool, bool) const::<lambda(const spvtools::opt::Instruction*)> >::_M_invoke(__functor=0x00007fffffffc7a0, __args#0=0x00007fffffffc5c0) at std_function.h:292:30
    frame #15: 0x00005555556d96c9 spirv-opt`std::function<bool (spvtools::opt::Instruction const*)>::operator()(this=0x00007fffffffc7a0, __args#0=0x0000555555d4d0e0) const at std_function.h:593:9
    frame #16: 0x00005555556d911f spirv-opt`spvtools::opt::Instruction::WhileEachInst(this=0x0000555555d4d0e0, f=0x00007fffffffc7a0, run_on_debug_line_insts=true) const at instruction.h:775:11
    frame #17: 0x00005555556d941c spirv-opt`spvtools::opt::BasicBlock::WhileEachInst(this=0x0000555555d5c590, f=0x00007fffffffc7a0, run_on_debug_line_insts=true) const at basic_block.h:285:63
    frame #18: 0x00005555557b5786 spirv-opt`spvtools::opt::Function::WhileEachInst(this=0x0000555555d4c7b0, f=0x00007fffffffc7a0, run_on_debug_line_insts=true, run_on_non_semantic_insts=true) const at function.cpp:153:65
    frame #19: 0x00005555557b515b spirv-opt`spvtools::opt::Function::ForEachInst(this=0x0000555555d4c7b0, f=0x00007fffffffc9b0, run_on_debug_line_insts=true, run_on_non_semantic_insts=true) const at function.cpp:74:16
    frame #20: 0x0000555555859e6d spirv-opt`spvtools::opt::Module::ForEachInst(this=0x0000555555d59c60, f=0x00007fffffffc9b0, run_on_debug_line_insts=true) const at module.cpp:131:55
    frame #21: 0x000055555585a652 spirv-opt`spvtools::opt::Module::ToBinary(this=0x0000555555d59c60, binary=size=1218, skip_nop=true) const at module.cpp:236:14
    frame #22: 0x00005555555b63eb spirv-opt`spvtools::Optimizer::Run(this=0x00007fffffffcaf0, original_binary=0x0000555555d27970, original_binary_size=2835, optimized_binary=size=1218, opt_options=0x0000555555d27410) const at optimizer.cpp:738:30
    frame #23: 0x00005555555ab425 spirv-opt`main(argc=6, argv=0x00007fffffffcc98) at opt.cpp:906:20

Tested on 19042c8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions