Repository navigation
Conversation
`map` over a tuple of 32 or more elements isn't inferred, so launching a kernel with that many arguments (31 through KernelAbstractions, which adds its context) dispatched for every argument and allocated 10-40 KB on the host instead of a few hundred bytes per argument. Convert the arguments with an unrolled `ntuple`, as `onecall` already sets them, both when `@oneapi` compiles the kernel and when it is launched. Fixes #769.
This branch has not been deployed
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.
Fixes #769.
mapover a tuple of 32 or more elements isn't inferred, so launching a kernel with that many arguments (31 through KernelAbstractions, which adds its context) converted each argument through a dynamic call and allocated 10–40 KB on the host. The arguments are now converted with an unrolledntuple, asonecallalready sets them, both when@oneapicompiles the kernel and inlaunch_managed. KernelAbstractions and KernelInterface already convert their arguments this way, so this was the remainingmap.Bytes allocated per launch with the reproducer from the issue, on an Arc A770 (Julia 1.13.4):
@oneapi, before → afterThe remaining cost per argument is unchanged from below 32 arguments: mostly the closure passed to
with_ownership, which holds the converted arguments, and the growth of therefsvector.The "inference" testset now also checks a launch with 40 arguments, which fails without this change.