Repository navigation
Conversation
std::make_unique<char[]> value-initializes, which zero-fills every temporary serially on each call.
Contributor
Author
|
🤖 Written by an agent on behalf of @havogt |
Collaborator
|
Hi there, this is jenkins continuous integration... |
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.
Depends on #1835 — only the last commit belongs to this PR.
Switches the fn naive backend's temporary allocator to
sid::cached_allocator, which the fn GPU backend and the stencilcpu_kfirst/cpu_ifirstbackends already use. Buffers are reused across calls instead of being freshly allocated (and page-faulted) every time.Measured from gt4py (gtfn CPU, 6 temporaries of 256×256×80 float64, laptop, with the double allocation of #1832 removed): 37 ms (no zero-fill, #1835) → 16 ms per call with this PR.
Caveats of
cached_allocator, for the reviewer to weigh:thread_localcache.fn::make_backendcreates the allocator and it is destroyed on the calling thread, and the thread pool only runs the loops inside a stage, so this is safe with the OpenMP and dummy pools. With the HPX pool, a caller that is itself an HPX task can resume on a different worker afterhpx::parallel::for_loop; the destructor then pushes onto another worker's cache without synchronization. The same holds for an allocator that outlives its allocating thread.