Skip to content

Minor compiler perf improvements#783

Merged
maleadt merged 2 commits into
masterfrom
tb/spec
Apr 23, 2026
Merged

Minor compiler perf improvements#783
maleadt merged 2 commits into
masterfrom
tb/spec

Conversation

@maleadt
Copy link
Copy Markdown
Member

@maleadt maleadt commented Apr 23, 2026

No description provided.

maleadt and others added 2 commits April 23, 2026 08:56
\`mangle_param\` called \`findfirst(isequal(x), substitutions)\` with \`x\`
a type — which builds a \`Base.Fix{2, isequal, Type{X}}\` closure that
\`findfirst\` then specializes on. Every unique type mangled during a
CUDA kernel-function compile therefore produced a fresh \`findnext\` +
\`Fix\` specialization.

Trace-compile on CUDA.jl's gpuarrays/broadcasting suite showed
~1771 \`isequal\` + ~867 \`findnext\` events before this fix (5680 total
trace lines); after this fix, 0 of either (3953 total, a 30 % drop),
with the broadcasting testset's wall-clock dropping ~8 s.

The fix: replace the closure-creating \`findfirst\` with a manual
\`===\` loop that \`@nospecialize\`s its argument, and \`@nospecialize\`
\`mangle_param\` / \`mangle_sig\` / \`safe_name\` themselves so they
don't duplicate one compiled body per distinct mangled type.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.43%. Comparing base (3084db6) to head (8af7a81).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #783      +/-   ##
==========================================
+ Coverage   75.42%   75.43%   +0.01%     
==========================================
  Files          24       24              
  Lines        3857     3859       +2     
==========================================
+ Hits         2909     2911       +2     
  Misses        948      948              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt maleadt merged commit 3bedfd7 into master Apr 23, 2026
37 checks passed
@maleadt maleadt deleted the tb/spec branch April 23, 2026 09:47
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

Successfully merging this pull request may close these issues.

1 participant