Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXIL: Deadlock when loading RayDesc from ByteAddressBuffer #5261

Open
MarijnS95 opened this issue Jun 1, 2023 · 5 comments
Open

DXIL: Deadlock when loading RayDesc from ByteAddressBuffer #5261

MarijnS95 opened this issue Jun 1, 2023 · 5 comments
Labels
bug Bug, regression, crash crash DXC crashing or hitting an assert
Milestone

Comments

@MarijnS95
Copy link
Contributor

Our previous shader compiler came from 0392e60 which worked fine. We now downloaded new blobs from ea3623f / https://ci.appveyor.com/project/dnovillo/directxshadercompiler/builds/47177077 and observe a deadlock with the following pattern:

repro.hlsl:

[numthreads(32, 8, 1)] void main(uint2 threadId
                                 : SV_DispatchThreadID) {
    ByteAddressBuffer buffer = ResourceDescriptorHeap[NonUniformResourceIndex(10)];
    RayDesc result = buffer.Load<RayDesc>(sizeof(RayDesc) * 1);
}

Run dxc from the above (Windows or Linux) download, and observe that the command runs indefinitely:

./dxc-artifacts/bin/dxc -E main -T cs_6_6 repro.hlsl -Fo test

I understand RayDesc to be a simple POD, and copying that into a local RayDesc2 struct and loading that doesn't deadlock.

@llvm-beanz llvm-beanz added the needs-triage Awaiting triage label Jun 29, 2023
@llvm-beanz llvm-beanz added bug Bug, regression, crash crash DXC crashing or hitting an assert and removed needs-triage Awaiting triage labels Jun 30, 2023
@llvm-beanz
Copy link
Collaborator

sigh

My least favorite pass strikes again:

cannot flatten hlsl intrinsic.Assertion failed: (false && "cannot flatten hlsl intrinsic."), function RewriteCall, file ScalarReplAggregatesHLSL.cpp, line 2761.

@llvm-beanz llvm-beanz removed this from HLSL Triage Jun 30, 2023
@MarijnS95
Copy link
Contributor Author

Oh indeed, on a newer compiler (from 6287d51) this is now an assert.

@MarijnS95
Copy link
Contributor Author

It's still an assert for the simple example above, but usually a deadlock on the bigger, massively-parallel-compiled shaders in our project.

Fortunately some unrelated issue we were facing (multiple identical compile invocations returning vastly different DXIL blobs) has magically been solved, and we can now upgrade to the latest DXC :)

@damyanp
Copy link
Member

damyanp commented Sep 3, 2024

Looks like this still repros: https://godbolt.org/z/z11rb6E6E

@damyanp damyanp moved this to Triaged in HLSL Triage Sep 3, 2024
@damyanp damyanp added this to the Dormant milestone Sep 3, 2024
@llvm-beanz
Copy link
Collaborator

We're clearly giving the builtin RayDesc struct some extra handling, but you can workaround this by writing your own RayDesc struct:

https://godbolt.org/z/M8ov38c9c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash crash DXC crashing or hitting an assert
Projects
Status: Triaged
Development

No branches or pull requests

3 participants