-
Notifications
You must be signed in to change notification settings - Fork 38
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
Basic runtime metering #626
Conversation
4e0e6be
to
340309f
Compare
Codecov Report
@@ Coverage Diff @@
## master #626 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 88 88
Lines 13158 13184 +26
=======================================
+ Hits 13062 13088 +26
Misses 96 96
Flags with carried forward coverage won't be shown. Click here to find out more.
|
340309f
to
987b5d4
Compare
8480da1
to
ba9f744
Compare
GCC 10.2 with LTO
Clang 11.0.1 with LTO
|
So that is rather curious that on clang it is faster with metering on 😅 |
c7fd3f2
to
c333e40
Compare
75d8408
to
ac50361
Compare
I think this looks good code wise and now the change is rather small, so it is easy to keep rebasing it. However we probably need to make our measurements without merging it, so we can easily see the overhead. (Unless it is possible to merge this with a compile-time option enabling/disabling it.) |
Rebased. |
lib/fizzy/execute.cpp
Outdated
|
||
ExecutionResult execute( | ||
template <bool MeteringEnabled> | ||
ExecutionResult execute_local_function( |
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.
Maybe consider specialising invoke
as well so that we generate one less branch?
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.
Which branch? I think invoke_function
does not change with MeteringEnabled
... It still needs ExecutionContext
to count depth.
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.
I think I actually meant execute
and not invoke
, because it is called by invoke_function
.
c65cc7a
to
7095691
Compare
@@ -444,6 +444,222 @@ constexpr uint8_t instruction_max_align_table[256] = { | |||
/* f32_reinterpret_i32 = 0xbe */ 0, | |||
/* f64_reinterpret_i64 = 0xbf */ 0, | |||
}; | |||
|
|||
constexpr int16_t instruction_cost_table[256] = { |
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.
What would be the way to have a user supplied cost_table
?
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.
I guess probably passing const int16_t*
to execute()
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.
I think this looks good, benchmarking can decide whether the last commit makes it worse or better.
|
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.
Looks good to me, please rebase.
Method 1 of #621