microsoft / microsoft/DirectXShaderCompiler
DXC hangs when compiling shader code for work graphs
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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