Repository navigation
Cache the kernel lookup of clfunction with GPUCompiler's cached_lookup - #590
Merged
Merged
Conversation
Julia doesn't specialize on keyword arguments that are only passed on, so `source` was a `Function`, and every launch constructed the `HostKernel` with `apply_type` and a dynamic `new`: about 3100 instructions.
…okup` Every launch took a global lock, built the compiler configuration and job and queried GPUCompiler's cache. Wrap that in `GPUCompiler.cached_lookup`, keyed on the context, the device, the program backend and the compiler options. The program backend is task-local state that selects the compiler configuration, so a test checks that switching it doesn't return the kernel compiled for the other one. Together with the previous commit, a hit goes from about 6600 to 580 instructions, and a KernelAbstractions launch gets 13-17% faster on PoCL.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #590 +/- ##
==========================================
+ Coverage 88.86% 90.85% +1.98%
==========================================
Files 18 18
Lines 1778 1782 +4
==========================================
+ Hits 1580 1619 +39
+ Misses 198 163 -35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every launch takes a global lock, builds the compiler configuration and job and queries GPUCompiler's cache. This wraps that lookup in
GPUCompiler.cached_lookup(JuliaGPU/GPUCompiler.jl#1061). The key holds the context, the device, the task-local program backend and the compiler options, with copies of array options likeextensions; tests cover switching the program backend and mutating an option.A separate commit makes
clfunctionspecialize on the type ofsource, which it didn't as the keyword is only passed on: every launch constructed theHostKerneldynamically, for about 3100 instructions.clfunction(hit)@opencl