Skip to content

Sporadic crash in llvm::Use::getUser() #1629

Description

@TheRealMJP

I've been having an issue with using dxc in one of my open-source projects. The project has several complex shaders that make use of NonUniformResourceIndex to perform bindless texture lookups, and these seem to be causing sporadic crashes inside of dxcompiler.dll. This is the callstack that I get when it happens:

>	dxcompiler.dll!llvm::Use::getUser() Line 42	C++
 	dxcompiler.dll!`anonymous namespace'::DxilGenerationPass::MarkNonUniform(std::unordered_set<llvm::Value *,std::hash<llvm::Value *>,std::equal_to<llvm::Value *>,std::allocator<llvm::Value *> > & NonUniformSet) Line 404	C++
 	dxcompiler.dll!`anonymous namespace'::DxilGenerationPass::runOnModule(llvm::Module & M) Line 294	C++
 	dxcompiler.dll!`anonymous namespace'::MPPassManager::runOnModule(llvm::Module & M) Line 1624	C++
 	dxcompiler.dll!llvm::legacy::PassManagerImpl::run(llvm::Module & M) Line 1727	C++
 	dxcompiler.dll!`anonymous namespace'::EmitAssemblyHelper::EmitAssembly(clang::BackendAction Action, llvm::raw_pwrite_stream * OS) Line 721	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 738	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 527	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 277	C++

Unfortunately it does not seem to have a 100% repro rate, although it always crashes in that same function. Sometimes I can compile all of the shaders successfully, and sometimes it will crash. I'm not sure if it's something related to my app's particular usage of dxc (I link against the dxcompiler import lib and compile shaders at runtime as opposed to using the command line executable), or perhaps something is wrong with my code. However these shaders all used to compile fine with earlier versions of dxc.

Do you guys have any ideas on what I can do to track this down? You're welcome to pull down the code yourself and compile/run the program. Everything is included in the GitHub repo, including the dxcompiler.dll that I compiled myself earlier today (it's in Externals/DXCompiler/Bin). You'll just need to enable DXIL support by setting EnableShaderModel6_ to 1 in AppConfig.h. Also be aware that the app caches compiled shaders in a folder called "ShaderCache", so you'll want to delete that folder to force it to re-compile all shaders. There's also a flag at the top of BindlessDeferred.cpp called "EnableMultithreadedCompilation" that you can use to disable multi-threaded shader compilation, in case that makes things easier (

I've also attached a pre-processed file containing one of the shaders that has been crashing the compiler, in case that's useful. You can compile it with a target of cs_6_0, with entry point "DeferredCS".

Please let me know if there's anything else I can do or provide that would be helpful for tracking this down.

Deferred_PP.hlsl.txt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugBug, regression, crash

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions