microsoft / microsoft/DirectXShaderCompiler

DXC hangs when compiling shader code for work graphs

Open
#7,141 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
Hi! I recently started experimenting with Work Graphs, but I have hit a roadblock where my shader code seems to make DXC infinitely allocate memory and then hang.

This kind of use-case has worked fine with compute shaders for years, it would be a shame if it stops working with Work Graphs. It is a very convenient way of sharing code between C++ and HLSL.

Steps to Reproduce
I managed to make a minimal repro:

ByteAddressBuffer heap : register(t0);

template<typename T>
struct Ptr {
	uint ptr;
	T load() { return heap.Load<T>(ptr); }
};

struct Chunk {
	uint words[8192];
};

struct Data {
	Chunk chunks[32768];
};

uint readWord(Ptr<Data> data_ptr, uint chunk_idx, uint word_idx)
{
	const Data data = data_ptr.load();
	return data.chunks[chunk_idx].words[word_idx];
}

[Shader("node")]
[NodeLaunch("thread")]
[NodeIsProgramEntry]
void entry()
{
}

Compile with dxc.exe -T lib_6_8 repro.hlsl -Fo repro.dxil and watch the compiler keep allocating memory forever.

Godbolt variant: https://godbolt.org/z/PaverY4Ej

Killed - processing time exceeded
Program terminated with signal: SIGKILL
Compiler returned: 143

Actual Behavior
Compiler allocates memory forever and hangs.

Environment

  • DXC version dxcompiler.dll: 1.8 - 1.8.2407.7 (416fab6b5); dxil.dll: 1.8(101.8.2407.12)
  • Host Operating System Windows 11 24H2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied repro.hlsl and compile it using dxc.exe with the command shown; compare behavior with the linked Godbolt variant. Trace the work-graph shader compilation path until the unbounded allocation occurs. Done means the minimal shader no longer hangs or exhausts memory and compilation completes normally.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.