Repository navigation
Cache device limits globally for lockless lookups - #747
Merged
Merged
Conversation
Replace repeated task-local storage and `Dict` lookups with a global immutable dictionary. Lock only when adding a device. Query device limits in `KI.max_work_group_size` only when the kernel's limit is unknown; `coalesce` evaluated both arguments. This saves 165-285 ns per KernelAbstractions launch of ~3 µs on an Arc A770.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #747 +/- ##
==========================================
- Coverage 86.89% 86.65% -0.25%
==========================================
Files 55 55
Lines 5090 5005 -85
==========================================
- Hits 4423 4337 -86
- Misses 667 668 +1 ☔ 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.
Each KernelAbstractions launch calls
device_limitsseveral times, each requiring task-local storage andDictlookups. Store the limits in a globalBase.ImmutableDict, replaced under a lock when adding a device. Cached lookups need no lock.__init__clears the cache because its keys are driver handles. InKI.max_work_group_size(kernel), query device limits only when the kernel's limit is unknown;coalesceevaluated both arguments.Host time per launch in batches of 64 launches without synchronization. Arc A770, Julia 1.12.7, KernelAbstractions 0.10.3; median of 3 fresh processes:
@oneapindrange=1000The full test suite passes on an Arc A770 (Julia 1.12.7).