//META: generated=true
//META: model=claude-opus-5[1m]
//META: generated_at=2026-08-04T00:00:00+00:00
//META: source_commit=7e725f15572c6589ee6d738a8856fb3348f11617
//META: doc_ref=docs/generated/design/pipeline/05-ir-passes.md#specialization-and-generics
//META: doc_section_digest=2f10610b6a8497f9b2cec62d411162a4585b32e9698a95e5288845967ffba16d
//META: purpose=Expansion: the specialize driver produces independent specializations for two different `let N` array sizes (N=2 and N=8) — both inline cleanly and no generic shape survives.
//META: intent=expansion
//META: pipeline_stage=ir-pass
//META: warning=Auto-generated. May drift from source. Do not edit by hand.

// `sumN<let N : int>` is instantiated twice — once with N=2 and once
// with N=8. Each call site produces its own specialization. Because
// the helper is `[ForceInline]` it inlines away and `sumN` does not
// appear in the HLSL emit.

//TEST:SIMPLE(filecheck=HLSL):-target hlsl -stage compute -entry main

uniform RWStructuredBuffer<int> buf;

[ForceInline]
int sumN<let N : int>(int data[N])
{
    int s = 0;
    [ForceUnroll] for (int i = 0; i < N; ++i) s += data[i];
    return s;
}

[numthreads(1, 1, 1)]
void main(uint3 tid : SV_DispatchThreadID)
{
    int small[2] = { int(tid.x), int(tid.y) };
    int big[8] = { 0, 1, 2, 3, 4, 5, 6, int(tid.z) };
    buf[0] = sumN<2>(small) + sumN<8>(big);
}

// HLSL: void main
// HLSL-NOT: sumN
