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

Compiler infinite loop issue #3906

Open
hannes-vernooij opened this issue Aug 13, 2021 · 1 comment
Open

Compiler infinite loop issue #3906

hannes-vernooij opened this issue Aug 13, 2021 · 1 comment
Labels
bug Bug, regression, crash crash DXC crashing or hitting an assert
Milestone

Comments

@hannes-vernooij
Copy link

hannes-vernooij commented Aug 13, 2021

I seem to have found an infinite loop during shader compilation and I was only able to reproduce this infinite loop when the following three conditions were met:

  • When the handle to index in the ByteAddressBufferArray was returned from a struct
  • When the ByteAddressBuffer is accessed in the function (it doesn't need to be used)
  • When the function returns an array of values, I tested it with float2,float3 and int2.

When any of these steps are missing it will not result in an infinite loop. I have attached the source code of the shader below.

struct RenderResourceHandle {
    uint handle;

    uint readIndex() { return this.handle; }
};

ByteAddressBuffer g_byteAddressBuffer[] : register(t0, space3);

struct Test{
    RenderResourceHandle h;

    float3 infLoop()[2] {
        ByteAddressBuffer b = g_byteAddressBuffer[this.h.readIndex()];
        float3 v[2] = {
            0.xxx,0.xxx,
        };
        return v;
    }
};

[numthreads(8, 8, 1)] void main(uint2 dispatchIdx
                                : SV_DispatchThreadID, uint3 pxInTile
                                : SV_GroupThreadID) {

    RenderResourceHandle resourceHandle;
    resourceHandle.handle = 0;

     Test t;
     t.h = resourceHandle;
     float3 w[2] = t.infLoop();
}

I have tried to compile this shader with the latest version from master.
shader playground link: http://shader-playground.timjones.io/8db5b73aef2c0f7eb76810f4afcdb49a

As workaround I wrapped the data in a struct and returned the struct instead.

@hannes-vernooij hannes-vernooij changed the title Infinite loop issue Compiler infinite loop issue Aug 13, 2021
@llvm-beanz llvm-beanz added the needs-triage Awaiting triage label Jun 29, 2023
@damyanp damyanp added bug Bug, regression, crash crash DXC crashing or hitting an assert and removed needs-triage Awaiting triage labels Apr 18, 2024
@damyanp damyanp added this to the Dormant milestone Apr 18, 2024
@damyanp
Copy link
Member

damyanp commented Apr 18, 2024

Setting to Dormant as there's a workaround for this.

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