microsoft / microsoft/DirectXShaderCompiler

Segmentation fault/ICE when attempting a particular (invalid) code pattern

Open
#5,681 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

AFAICT, there is no way to perform interlocked instructions on data viewed via templated loads or stores with ByteAddressBuffers. However, attempting to do so ICEs the compiler.

Steps to Reproduce

Here's a simple snippet to demonstrate the issue:

struct T
{
    uint value;
};
RWByteAddressBuffer b = ResourceDescriptorHeap[0];
int original;
InterlockedMax(b.Load<T>(0).value, 1, original);

Obviously, the code above doesn't make any sense, but since the compiler ICEd instead of reporting a diagnostic, I decided to file this as an issue.

As an aside, is there a way to express the intent above with valid HLSL today? (I don't believe it's possible, but it would be nice if it was).

Environment

  • DXC version trunk and 1.7
  • Host Operating System Windows

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 by reproducing the ICE with the provided HLSL snippet using DXC trunk and version 1.7 on Windows. Trace the compiler path handling the templated ByteAddressBuffer load used as an interlocked-operation operand, and consider the diagnostic for this invalid pattern as done.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.