Skip to content

Stop compiling host code for every new kernel type - #752

Open
maleadt wants to merge 1 commit into
mainfrom
tb/launch-specialization
Open

maleadt wants to merge 1 commit into
mainfrom
tb/launch-specialization

Conversation

@maleadt

@maleadt maleadt commented Oct 28, 2026

Copy link
Copy Markdown
Member

Launching a kernel with a new signature compiled host code that doesn't depend on the signature: zefunction passed a closure to GPUCompiler.cached_lookup whose type includes the kernel's function and argument types, and with_managed_locks/with_ownership were specialized on the operation they run, which is a different closure for every kernel (and for every copy). This links kernels through a callable struct instead, and doesn't specialize the two memory helpers on the operation, using a struct rather than a closure for the ownership transfer.

On an Arc A770 with Julia 1.13, launching a second new kernel takes 57-60 instead of 85 ms, without a measurable change in warm launch time. The launch specialization test now also covers these functions; it fails on main (their specializations go from 5 to 20 over six new kernels).

The closure that `zefunction` passed to `GPUCompiler.cached_lookup`,
and the functions that lock and take ownership of the memory a launch
uses, were specialized on types that depend on the kernel's, so every
new kernel compiled them again. Link the kernel with a callable struct
instead, and don't specialize `with_managed_locks` and `with_ownership`
on the operation they perform. On an Arc A770 with Julia 1.13, this
reduces launching a second new kernel from 85 to 57 ms.
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.63%. Comparing base (2ec42dc) to head (fa13a4f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #752      +/-   ##
==========================================
- Coverage   86.79%   86.63%   -0.17%     
==========================================
  Files          55       55              
  Lines        5068     5013      -55     
==========================================
- Hits         4399     4343      -56     
- Misses        669      670       +1     

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

No deployments
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