Skip to content

Per-compile linkIR / linkAndOptimizeIR regression since the auto-diff refactor (auto-diff artifacts linked into every program) #11781

Description

@jvepsalainen-nv

Issue Description

Since the auto-diff refactor (the overhaul between releases 2026.5 and 2026.7), every compile
pays an inflated linkIR / linkAndOptimizeIR cost — even an empty shader that never
differentiates. The IR linker now deep-clones the differentiable-interface witness tables and their
annotations into every program, then carries that dead auto-diff IR through specialization /
simplify / DCE before eliminating it. This is a per-compile floor: it affects all targets and all
shaders, independent of auto-diff use.

Reproducer Code

An empty / minimal shader (the compile-perf minimal workload):

RWStructuredBuffer<float> outBuf;

[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain()
{
    outBuf[0] = 1.0;
}

Command:

slangc minimal.slang -target spirv -emit-spirv-directly -report-perf-benchmark

Expected Behavior

A non-differentiating program should not link auto-diff witness tables / annotations; linkIR and
linkAndOptimizeIR should be near the pre-refactor (release 2026.5) baseline.

Actual Behavior

linkIR rose ~10–13×, and linkAndOptimizeIR similarly: the minimal linkAndOptimizeIR is
~15 ms versus a pre-refactor baseline of ~1.9 ms.

Test Plan

  • tools/compile-perf per-compile-floor workloads (e.g. minimal); the linkIR /
    linkAndOptimizeIR timers, compared against the pre-refactor baseline.

Fixed by #11779. Companion codegen-side half (simplifyIR): #11780. Related broad
perf-regression tracking: #11474.

Metadata

Metadata

Labels

reproducedProvided instructions confirmed to reproduce the issue

Type

Fields

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions