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

DXC internal compiler crash using following shader #6427

Closed
Nielsbishere opened this issue Mar 18, 2024 · 1 comment
Closed

DXC internal compiler crash using following shader #6427

Nielsbishere opened this issue Mar 18, 2024 · 1 comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage

Comments

@Nielsbishere
Copy link
Contributor

Description
DXC crashes internally during pixel shader compilation. This shader used to work with a previous DXC version (I think it was v1.7.2308) but seems to be broken in latest.
image(8)

Steps to Reproduce

struct VertexOut {
    float4 pos    : SV_POSITION;
    float2 uv    : TEXCOORD0;
};

#define M_PI 3.1415926535897
// assumes x>0
float erfc(float x) {
    return 2.0 * exp(-x * x) / (2.319 * x + sqrt(abs(4.0 + 1.52 * x * x)));
}
float Lambda(float cosTheta, float sigmaSq) {
    float v = cosTheta / sqrt(abs((1.0 - cosTheta * cosTheta) * (2.0 * sigmaSq)));
    return max(0.0, (exp(-v * v) - v * sqrt(abs(M_PI)) * erfc(v)) / (2.0 * v * sqrt(abs(M_PI))));
    //return (exp(-v * v)) / (2.0 * v * sqrt(M_PI)); // approximate, faster formula
}
            
float4 PS(VertexOut input): SV_TARGET0 {
    return float4(input.uv, Lambda(input.uv.x, input.uv.y), 1); //_tex0.Sample(_samplerLinear, input.uv);
}

dxc -E PS -T ps_6_3 crash.hlsl

Actual Behavior
Shouldn't crash. I think it's valid HLSL, but then again it's legacy code so I'm not sure what it actually does. If it's invalid code then it should give an error instead.

Environment

  • DXC version: v1.8.2403
  • Host Operating System: N/A
@Nielsbishere Nielsbishere added bug Bug, regression, crash needs-triage Awaiting triage labels Mar 18, 2024
@llvm-beanz
Copy link
Collaborator

This is a different manifestation of #6410. We're working on getting out the low-risk quick fix in the 1.8.2403.1 release tracked as #6420. We haven't figured out the correct long-term fix, so this bug will persist in main for a short time while we work that out.

@llvm-beanz llvm-beanz closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2024
@damyanp damyanp added this to the Release 1.8.2403.1 milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage
Projects
Archived in project
Development

No branches or pull requests

3 participants