Skip to content

Comments

Fix perf regression: limit debug info to relevant subprograms (#8174)#8177

Open
damyanp wants to merge 1 commit intomicrosoft:mainfrom
damyanp:8174
Open

Fix perf regression: limit debug info to relevant subprograms (#8174)#8177
damyanp wants to merge 1 commit intomicrosoft:mainfrom
damyanp:8174

Conversation

@damyanp
Copy link
Member

@damyanp damyanp commented Feb 19, 2026

PR #7799 added debug info for global variables across all inlined subprograms, creating O(subprograms x globals) debug instructions. This caused 2-3x slower compilation for shaders with many globals and deeply-inlined functions.

Fix: Instead of collecting ALL subprograms for a function (walking every instruction), only collect subprograms from the alloca's actual users -- the instructions that reference the specific global variable. This preserves the debug info feature (globals visible in inlined scopes that use them) while eliminating work for unrelated scopes.

The 'Lower static global into Alloca' pass is 3.8x faster on a stress test (41ms -> 11ms), and overall debug compilation is ~10% faster.

Fixed #8174

…oft#8174)

PR microsoft#7799 added debug info for global variables across all inlined
subprograms, creating O(subprograms x globals) debug instructions.
This caused 2-3x slower compilation for shaders with many globals
and deeply-inlined functions.

Fix: Instead of collecting ALL subprograms for a function (walking
every instruction), only collect subprograms from the alloca's actual
users -- the instructions that reference the specific global variable.
This preserves the debug info feature (globals visible in inlined
scopes that use them) while eliminating work for unrelated scopes.

The 'Lower static global into Alloca' pass is 3.8x faster on the
stress test (41ms -> 11ms), and overall debug compilation is ~10%
faster.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@damyanp damyanp marked this pull request as ready for review February 20, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Perf Regression from #7799

2 participants