gem5::statistics::Counter are 52-bit not 64-bit #946
Replies: 3 comments
-
This is something that dates back to ~2004 when the statistic package was originally implemented by Nathan Binkert. Your observation is sort of correct. You won't get the full 64b precision for integer counts, but it is technically a 64b value. You have highlighted an interesting and potentially important issue. Many stats are counters of integer events. Floating point semantics can be a bit weird for these sorts of things. One such problem is that stats will stop counting single events around 2^53 (I can't remember if this includes denormals or not). This could be a very real problem for high-frequency events in long-running simulations which can execute for 2^64 ticks. Another weird problem occurs if you subtract two large counters where the difference quickly ends up losing precision, this can end up being a problem when calculating averages. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your quick response. I agree with what you said. I have 2 further questions/comments:
|
Beta Was this translation helpful? Give feedback.
-
I suspect the reason we use double everywhere might be that some derived counters (e.g., IPC) aren't integers. Having a separate type for event counters and derived stats would be complicated. Fixing that seems like a lot of work. I suspect it isn't worth doing on its own, but it might be worth doing as a bigger stats overhaul at some point. |
Beta Was this translation helpful? Give feedback.
-
gem5/src/base/stats/types.hh
Line 45 in e8bc4fc
As
double
, don't the counters really have only 52-bit precision?Beta Was this translation helpful? Give feedback.
All reactions