Repository navigation
Hash compiler configuration kwargs without boxing them - #699
Merged
Merged
Conversation
compiler_config runs on every zefunction call, so on every launch of a KernelAbstractions kernel, which passes name, always_inline and sub_group_size. Hashing them as a Base.Pairs boxes each value. Hash the NamedTuple instead, which is fully typed and whose hash includes the field names, so distinct settings still get distinct configurations. With the kwargs of a KernelInterface launch, compiler_config goes from 237 ns and 4 allocations to 85 ns and none (Iris Xe, Julia 1.12).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #699 +/- ##
==========================================
- Coverage 81.32% 80.63% -0.70%
==========================================
Files 52 51 -1
Lines 4092 3971 -121
==========================================
- Hits 3328 3202 -126
- Misses 764 769 +5 ☔ 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.
compiler_configruns on everyzefunctioncall, so on every launch of a KernelAbstractions kernel, which passesname,always_inlineandsub_group_size. Hashing them as aBase.Pairsboxes each value. Hashing theNamedTuple(values(kwargs)) is fully typed, and its hash includes the field names, so distinct settings still get distinct configurations.Measured on an Iris Xe (Julia 1.12), calling
compiler_configthrough a kwargs-forwarding function likezefunction_link:name,always_inline,sub_group_size)@oneapi(no kwargs)@oneapi name="foo"Same as JuliaGPU/CUDA.jl#3400.