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

Crash in constant propagation #5972

Open
Axel-Reactor opened this issue Dec 31, 2024 · 0 comments
Open

Crash in constant propagation #5972

Axel-Reactor opened this issue Dec 31, 2024 · 0 comments

Comments

@Axel-Reactor
Copy link

This is nonsensical test code from internal code gen testing, but I reliably crash with this:

#version 460

struct TYPE_QBmQRbmlpcTGbHxh { uint32_t variant; };
bool operator==(TYPE_QBmQRbmlpcTGbHxh lhs, TYPE_QBmQRbmlpcTGbHxh rhs) { return lhs.variant == rhs.variant; }
const TYPE_QBmQRbmlpcTGbHxh TYPE_kxUyNIzptPXewEJs = TYPE_QBmQRbmlpcTGbHxh(0);
const TYPE_QBmQRbmlpcTGbHxh TYPE_JLGyglBSdGSCICTU = TYPE_QBmQRbmlpcTGbHxh(1);
const TYPE_QBmQRbmlpcTGbHxh TYPE_ASIGaEGzVWSeCIec = TYPE_QBmQRbmlpcTGbHxh(2);

struct TYPE_eyQZDoMvVLZElrDX {
    vector<float32_t, 4> m_ujigZxHKbJHSjjnn;
    vector<float32_t, 4> m_ICCAonGNzdVjdlFA;
};

struct TYPE_YFSaXGWERCxuTrrK {
    TYPE_QBmQRbmlpcTGbHxh m_mdQTHFyBjntnjvIN;
};

layout (scalar, set = 1, binding = 0) uniform UBO_Global {
   float64_t HREOIZIQbKUVImYu;
   int64_t TCQXdQpMJLfmpkBk;
   uint64_t BxMLeBcLoJtfhYSt;
   TYPE_QBmQRbmlpcTGbHxh qBiKxIBkevFdwQpf;
   float32_t NNcjGUneJoKLqabz;
   int32_t sGnohaMoeSNpKPid;
   uint32_t NBitKKiZyGtZUjVI;
   uint32_t wERQxwcenXQxjkLv;
   uint8_t sNZWJyWSVFVhBiIM;
} UNIFORMS_Global;
layout (set = 1, binding = 1) SamplerState BINDING_wizPzNhlwuWdxKiV;
layout (location = 0) in vector<float32_t, 2> BINDING_jishczyZNXwjphtt;
layout (location = 0) out vector<float32_t, 4> BINDING_AWsuafnviCutmiDT;
layout (location = 1) out vector<float32_t, 4> BINDING_pffaEcYwacxRzGLr;

[shader("fragment")] void main()
{
    uint32_t XWmYSYtNDXgIxFiI_2 = uint32_t((UNIFORMS_Global.NBitKKiZyGtZUjVI));
    vector<float32_t, 4> TEMP_3 = vector<float32_t, 4>(0);
    vector<float32_t, 4> jYnWAUjUEIobUMPT_4 = TEMP_3;
    TYPE_QBmQRbmlpcTGbHxh TEMP_5 = TYPE_kxUyNIzptPXewEJs;
    TYPE_YFSaXGWERCxuTrrK TEMP_6 = TYPE_YFSaXGWERCxuTrrK(TEMP_5);
    TYPE_YFSaXGWERCxuTrrK XNQfxLPytymSEvwe_7 = TEMP_6;
    float32_t TEMP_8 = float32_t(0);
    float32_t cGiZyVhuQNcOgcxk_9 = TEMP_8;
    const TYPE_QBmQRbmlpcTGbHxh TEMP_10 = (XNQfxLPytymSEvwe_7.m_mdQTHFyBjntnjvIN);
    if (((TEMP_10 == TYPE_kxUyNIzptPXewEJs)))
    {
        float32_t TEMP_11 = -1.0e0f;
        float32_t DsRDIOosmDXFXWnm_12 = TEMP_11;
        (cGiZyVhuQNcOgcxk_9 = DsRDIOosmDXFXWnm_12);
    }
    else
    {
        float32_t TEMP_13 = jYnWAUjUEIobUMPT_4.y;
        bool TEMP_14 = TEMP_13 < 1.0e1f;
        if ((TEMP_14) && ((TEMP_10 == TYPE_ASIGaEGzVWSeCIec) || (TEMP_10 == TYPE_JLGyglBSdGSCICTU)))
        {
            (cGiZyVhuQNcOgcxk_9 = 1.0e0f);
        }
        else
        {
            float32_t TEMP_15 = jYnWAUjUEIobUMPT_4.y;
            bool TEMP_16 = TEMP_15 > 1.0e1f;
            if ((TEMP_16) && ((TEMP_10 == TYPE_JLGyglBSdGSCICTU)))
            {
                (cGiZyVhuQNcOgcxk_9 = 0.0e0f);
            }
            else
            {
                if (true)
                {
                }
            }
        }
    }
    float32_t TEMP_17 = (BINDING_jishczyZNXwjphtt).x;
    float32_t TEMP_18 = (BINDING_jishczyZNXwjphtt).y;
    float32_t TEMP_19 = (BINDING_jishczyZNXwjphtt).x;
    float32_t TEMP_20 = jYnWAUjUEIobUMPT_4.w;
    float32_t TEMP_21 = TEMP_20 * cGiZyVhuQNcOgcxk_9;
    vector<float32_t, 4> TEMP_22 = vector<float32_t, 4>(TEMP_17, TEMP_18, TEMP_19, TEMP_21);
    vector<float32_t, 4> TEMP_23 = TEMP_22;
    vector<float32_t, 4> TEMP_24 = vector<float32_t, 4>(0);
    vector<float32_t, 4> TEMP_25 = TEMP_24;
    TYPE_eyQZDoMvVLZElrDX TEMP_26 = TYPE_eyQZDoMvVLZElrDX(TEMP_23, TEMP_25);
    TYPE_eyQZDoMvVLZElrDX TEMP_27 = TEMP_26;
    BINDING_AWsuafnviCutmiDT = TEMP_27.m_ujigZxHKbJHSjjnn;
    BINDING_pffaEcYwacxRzGLr = TEMP_27.m_ICCAonGNzdVjdlFA;
    return;
}

Crashes in

[slang.dll] Slang::SCCPContext::getLatticeVal(Slang::IRInst *) 0x00007ffca90f4622
[slang.dll] Slang::SCCPContext::updateValueForInst(Slang::IRInst *) 0x00007ffca90f7486
[slang.dll] Slang::SCCPContext::apply() 0x00007ffca90f833f
[slang.dll] Slang::applySparseConditionalConstantPropagationRec(const Slang::SCCPContext &,Slang::IRInst *) 0x00007ffca90f8bda
[slang.dll] Slang::applySparseConditionalConstantPropagation(Slang::IRInst *,Slang::DiagnosticSink *) 0x00007ffca90f95ce
[slang.dll] Slang::simplifyIR(Slang::TargetProgram *,Slang::IRModule *,IRSimplificationOptions,Slang::DiagnosticSink *) 0x00007ffca914ab2b
[slang.dll] Slang::linkAndOptimizeIR(Slang::CodeGenContext *,const Slang::LinkingAndOptimizationOptions &,Slang::LinkedIR &) 0x00007ffca8f2b05b
[slang.dll] Slang::emitSPIRVForEntryPointsDirectly(Slang::CodeGenContext *,Slang::ComPtr<Slang::IArtifact> &) 0x00007ffca8f2e3c3
[slang.dll] Slang::CodeGenContext::_emitEntryPoints(Slang::ComPtr<Slang::IArtifact> &) 0x00007ffca8e1d1a4
[slang.dll] Slang::CodeGenContext::emitEntryPoints(Slang::ComPtr<Slang::IArtifact> &) 0x00007ffca8e1d296
[slang.dll] Slang::TargetProgram::_createEntryPointResult(long long,Slang::DiagnosticSink *,Slang::EndToEndCompileRequest *) 0x00007ffca8e1e1d5
[slang.dll] Slang::ComponentType::getEntryPointCode(long long,long long,ISlangBlob **,ISlangBlob **) 0x00007ffca9365f09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant