weixin_39797780 2020-11-29 16:15
浏览 0

Crashes when using mul intrinsic with different data types

Below compiles fine with fxc, but crashes with dxc. This is related to #2447


// %dxc -T vs_6_0 -E main -DELEM_TY1=float -DELEM_TY2=float2x4 -DRET_TY=float2x4 %s

cbuffer CB {
  ELEM_TY1 e1;
  ELEM_TY2 e2;
};

RET_TY main(): OUT
{
    return mul(e1, e2);
}

Call stack:



>   dxcompiler.dll!llvm_assert(const char * _Message, const char * _File, unsigned int _Line, const char * _Function) Line 23   C++
    dxcompiler.dll!llvm::cast<:vectortype>(llvm::Type * Val) Line 238   C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::lowerHLMulIntrinsic(llvm::Value * Lhs, llvm::Value * Rhs, bool Unsigned, llvm::IRBuilder<1,llvm::ConstantFolder,llvm::IRBuilderDefaultInserter<1> > & Builder) Line 848    C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::lowerHLIntrinsic(llvm::CallInst * Call, hlsl::IntrinsicOp Opcode) Line 807 C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::lowerHLOperation(llvm::CallInst * Call, hlsl::HLOpcodeGroup OpcodeGroup) Line 752  C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::lowerCall(llvm::CallInst * Call) Line 681  C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::lowerInstruction(llvm::Instruction * Inst) Line 648    C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::runOnFunction(llvm::Function & Func) Line 254  C++
    dxcompiler.dll!`anonymous namespace'::HLMatrixLowerPass::runOnModule(llvm::Module & M) Line 218 C++
    dxcompiler.dll!`anonymous namespace'::MPPassManager::runOnModule(llvm::Module & M) Line 1624    C++
    dxcompiler.dll!llvm::legacy::PassManagerImpl::run(llvm::Module & M) Line 1726   C++
    dxcompiler.dll!llvm::legacy::PassManager::run(llvm::Module & M) Line 1766   C++
    dxcompiler.dll!`anonymous namespace'::EmitAssemblyHelper::EmitAssembly(clang::BackendAction Action, llvm::raw_pwrite_stream * OS) Line 722  C++
    dxcompiler.dll!clang::EmitBackendOutput(clang::DiagnosticsEngine & Diags, const clang::CodeGenOptions & CGOpts, const clang::TargetOptions & TOpts, const clang::LangOptions & LOpts, llvm::StringRef TDesc, llvm::Module * M, clang::BackendAction Action, llvm::raw_pwrite_stream * OS) Line 743  C++
    dxcompiler.dll!clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext & C) Line 194    C++
    dxcompiler.dll!clang::ParseAST(clang::Sema & S, bool PrintStats, bool SkipFunctionBodies) Line 162  C++
    dxcompiler.dll!clang::ASTFrontendAction::ExecuteAction() Line 556   C++
    dxcompiler.dll!clang::CodeGenAction::ExecuteAction() Line 755   C++
    dxcompiler.dll!clang::FrontendAction::Execute() Line 468    C++
    dxcompiler.dll!DxcCompiler::CompileWithDebug(IDxcBlob * pSource, const wchar_t * pSourceName, const wchar_t * pEntryPoint, const wchar_t * pTargetProfile, const wchar_t * * pArguments, unsigned int argCount, const DxcDefine * pDefines, unsigned int defineCount, IDxcIncludeHandler * pIncludeHandler, IDxcOperationResult * * ppResult, wchar_t * * ppDebugBlobName, IDxcBlob * * ppDebugBlob) Line 714   C++
    dxcompiler.dll!DxcCompiler::Compile(IDxcBlob * pSource, const wchar_t * pSourceName, const wchar_t * pEntryPoint, const wchar_t * pTargetProfile, const wchar_t * * pArguments, unsigned int argCount, const DxcDefine * pDefines, unsigned int defineCount, IDxcIncludeHandler * pIncludeHandler, IDxcOperationResult * * ppResult) Line 453   C++
    dxc.exe!DxcContext::Compile() Line 785  C++
    dxc.exe!dxc::main(int argc, const wchar_t * * argv_) Line 1194  C++
    dxc.exe!wmain(int argc, const wchar_t * * argv_) Line 22    C++

</:vectortype>

该提问来源于开源项目:microsoft/DirectXShaderCompiler

  • 写回答

5条回答 默认 最新

  • weixin_39797780 2020-11-29 16:15
    关注

    With mul involving double type, fxc fails compilation with an error message "doubles cannot be used as shader inputs or outputs. If you need to pass a double between shader stages you must pass it as two uints and use asuint and asdouble to convert between forms", but dxc crashes.

    
    // %dxc -T vs_6_0 -E main -DELEM_TY1=double4 -DELEM_TY2=double4 -DRET_TY=double %s
    
    cbuffer CB {
      ELEM_TY1 e1;
      ELEM_TY2 e2;
    };
    
    RET_TY main(): OUT
    {
        return mul(e1, e2);
    }
    
    评论

报告相同问题?