-
Notifications
You must be signed in to change notification settings - Fork 101
Avoid dynamic memory allocation in kernel launch #3861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3861 +/- ##
========================================
Coverage 92.41% 92.41%
========================================
Files 520 520
Lines 22471 22478 +7
========================================
+ Hits 20766 20774 +8
+ Misses 1705 1704 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing small improvements (up to 0.03ms), no regressions
@@ -551,14 +556,28 @@ std::vector<argument> generic_eval(const program& p, | |||
F trace) | |||
{ | |||
const module* mm = p.get_main_module(); | |||
return generic_eval(mm, ctx, params, {}, trace); | |||
std::size_t n = p.total_instructions(); | |||
std::vector<char> buffer(n * (sizeof(instruction_ref) + sizeof(argument)) * 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raw constants (e.g. 4 here) create a mystery.
std::vector<argument> values; | ||
values.reserve(16); | ||
for(auto ins : iterator_for(*mod)) | ||
{ | ||
assert(results.find(ins) == results.end()); | ||
assert(mod->name() != "main" or results.find(ins) == results.end()); | ||
#ifndef NDEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment here, for the uninitiated, why is this under a flag. Thanks.
@@ -462,24 +463,27 @@ template <class F> | |||
std::vector<argument> generic_eval(const module* mod, | |||
std::vector<context>& ctx, | |||
std::unordered_map<std::string, argument> params, | |||
std::unordered_map<instruction_ref, argument> results, | |||
std::pmr::unordered_map<instruction_ref, argument>& results, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line above can take an efficiency gain of using a const reference: i.e. for const std::unordered_map<std::string, argument> & params', as for
results`.
@pfultz2 just need to fix the merge conflicts |
No description provided.