-
Notifications
You must be signed in to change notification settings - Fork 16
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
Hardware Metrics #580
Hardware Metrics #580
Conversation
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.
Overall looks good, but I am not sure if it isn't overly complicated.
Additionally, the histogram tracks the number of observations, the sum | ||
of observed values, and the minimum and maximum values. |
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.
Are they needed? E.g. number of observations we can calculate by summing up all elements from buckets.
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.
we could, but it is more convenient to just look at one number. And it doesn't cost us much to have it
from ..common import * | ||
|
||
|
||
class CounterInMethodCircuit(Elaboratable): |
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.
Why you can not use SimpleTestCircuit
?
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.
Because metric methods are just wrappers and SimpleTestCircuit
won't handle it.
val = yield m._dut.counter.count.value | ||
self.assertEqual(val, called_cnt) |
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.
More logical in my opinion it would be to have that code before if
, because you compare counter to the previous one.
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.
It won't work. It takes one cycle to update the value of the underlying counter, so if the method is called in cycle n
, the counter will be increased in cycle n+1
. Thus in fact I need to compare it with the previous value of the register.
And I don't want to add another yield after the method call, because I want to test how the counter works when it is possibly called every cycle (without stalls).
I added a clarifying comment to the code.
|
||
return m | ||
|
||
def incr(self, m: TModule): |
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.
Why you decided for such interface instead of allowing to the direct calls to the _incr
?
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 first statement of this function is the answer. When metrics are disabled, the calls are not made.
d370ec3
to
1116f65
Compare
I have created #585 to fix pipeline problem. |
The main part of PR #572, which adds the core classes for hardware metrics along with some unit tests.