GithubHelp home page GithubHelp logo

Comments (2)

linqun avatar linqun commented on June 28, 2024 1

Reproduced. there are 3 issues.

  • decoration Offset and ArrayStride are missed in your shader source. please add following code in your source code.
    OpMemberDecorate %struct_0 0 Offset 0
    OpMemberDecorate %struct_1 0 Offset 0
    OpMemberDecorate %struct_1 1 Offset 4
    OpDecorate %u32_array_runtime_array ArrayStride 128
    OpDecorate %u32_array ArrayStride 4
  • calcShaderBlockSize doesn't handle Structs with no members, please try to add following code in calcShaderBlockSize
    if (BT->isTypeStruct()) {
  • if (BT->getStructMemberCount() == 0)
  • BlockSize = 0;
    
  • else {
  • the order of lower pass in incorrect. please move pass SpirvLowerAccessChain after pass PassDeadFuncRemove in llpcSpirvLower.cpp

    // Function inlining
    passMgr.add(createFunctionInliningPass(InlineThreshold));
    passMgr.add(PassDeadFuncRemove::Create());

  • // Lower SPIR-V access chain
  • passMgr.add(SpirvLowerAccessChain::Create());
  • after apply these three changes, this shader is passed in my local machine.

PS: I will send out the pull request next week.

from llpc.

emberian avatar emberian commented on June 28, 2024

backtrace from a RelWithDebInfo:

Program received signal SIGSEGV, Segmentation fault.
0x000055555587f337 in SPIRV::SPIRVTypeStruct::getMemberType (I=0, this=0x555558b0f1c0)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/libSPIRV/SPIRVType.h:640
640         return static_cast<SPIRVType *>(getEntry(MemberTypeIdVec[I]));
(gdb) where
#0  0x000055555587f337 in SPIRV::SPIRVTypeStruct::getMemberType (I=0, this=0x555558b0f1c0)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/libSPIRV/SPIRVType.h:640
#1  SPIRV::SPIRVType::getStructMemberType (this=0x555558b0f1c0, Index=0)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/libSPIRV/SPIRVType.cpp:106
#2  0x00005555557b22fd in SPIRV::SPIRVToLLVM::calcShaderBlockSize (this=this@entry=0x7fffffffa850,
    BT=BT@entry=0x555558b0f1c0, BlockSize=BlockSize@entry=0, MatrixStride=MatrixStride@entry=4294967295,
    IsRowMajor=IsRowMajor@entry=false) at /home/cmr/proj/vulkandriver/drivers/llpc/translator/SPIRVReader.cpp:4512
#3  0x00005555557c0f6c in SPIRV::SPIRVToLLVM::transShaderDecoration (this=this@entry=0x7fffffffa850,
    BV=BV@entry=0x55555ac27f00, V=V@entry=0x555557a3c868)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/SPIRVReader.cpp:4358
#4  0x00005555557c11ff in SPIRV::SPIRVToLLVM::transDecoration (this=0x7fffffffa850, BV=0x55555ac27f00, V=0x555557a3c868)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/SPIRVReader.cpp:3883
#5  0x00005555557c71b5 in SPIRV::SPIRVToLLVM::transValue (this=this@entry=0x7fffffffa850, BV=0x55555ac27f00,
    F=F@entry=0x0, BB=BB@entry=0x0, CreatePlaceHolder=CreatePlaceHolder@entry=true)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/SPIRVReader.cpp:1096
#6  0x00005555557d07fe in SPIRV::SPIRVToLLVM::translate (this=this@entry=0x7fffffffa850,
    EntryExecModel=EntryExecModel@entry=spv::ExecutionModelGLCompute,
    EntryName=EntryName@entry=0x555557673aa8 <EntryTarget+168> "main")
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/SPIRVReader.cpp:3818
#7  0x00005555557d0e7f in llvm::readSpirv (C=..., IS=...,
    EntryExecModel=EntryExecModel@entry=spv::ExecutionModelGLCompute,
    EntryName=EntryName@entry=0x555557673aa8 <EntryTarget+168> "main", SpecConstMap=std::map with 0 elements,
    M=@0x7fffffffaf98: 0x555557763540, ErrMsg="", forceLoopUnrollCount=0)
    at /home/cmr/proj/vulkandriver/drivers/llpc/translator/SPIRVReader.cpp:5484
#8  0x0000555555731fa4 in Llpc::Compiler::TranslateSpirvToLlvm (this=this@entry=0x555557719890,
    pSpirvBin=<optimized out>, pSpirvBin@entry=0x55555acbef48, shaderStage=shaderStage@entry=Llpc::ShaderStageCompute,
    pEntryTarget=0x555557673aa8 <EntryTarget+168> "main", pSpecializationInfo=0x0,
    pContext=pContext@entry=0x55555771d5f0, forceLoopUnrollCount=0, ppModule=0x7fffffffaf98)
    at /home/cmr/proj/vulkandriver/drivers/llpc/context/llpcCompiler.cpp:1631
#9  0x00005555557372b2 in Llpc::Compiler::BuildComputePipelineInternal (this=this@entry=0x555557719890,
    pComputeContext=pComputeContext@entry=0x7fffffffb1a0, pPipelineInfo=pPipelineInfo@entry=0x7fffffffde00,
    forceLoopUnrollCount=forceLoopUnrollCount@entry=0, pPipelineElf=pPipelineElf@entry=0x7fffffffc100,
    pDynamicLoopUnroll=pDynamicLoopUnroll@entry=0x7fffffffb110)
    at /home/cmr/proj/vulkandriver/drivers/llpc/context/llpcCompiler.cpp:1127
#10 0x0000555555738657 in Llpc::Compiler::BuildComputePipeline (this=0x555557719890, pPipelineInfo=0x7fffffffde00,
    pPipelineOut=0x7fffffffde78) at /home/cmr/proj/vulkandriver/drivers/llpc/context/llpcCompiler.cpp:1410
#11 0x00005555556d832d in BuildPipeline (pCompileInfo=0x7fffffffda30, pCompiler=0x555557719890)
    at /home/cmr/proj/vulkandriver/drivers/llpc/tool/amdllpc.cpp:828
#12 main (argc=<optimized out>, argv=<optimized out>) at /home/cmr/proj/vulkandriver/drivers/llpc/tool/amdllpc.cpp:1194

from llpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.