Hi All,

When fixing a couple of bugs in gem5's unit converter I realised that we make ambigious 
use of unit prefixes in some cases. The culprit here is the difference between binary 
prefixes and decimal prefixes. We currently use the traditional SI-like prefixes to 
represent binary multipliers in some contexts and not in some other contexts. Large 
standards bodies like the IEC, ISO, and ISQ (SI) all recommend against this abuse of SI 
prefixes. Instead, the recommendation is to use a "new" (they have been around 
since the 90s) set of unamgigious binary prefixes (KiB/MiB/GiB/TiB/etc.). If you aren't 
convinced that this is a problem, have a look at the summary of how we and the industry 
use it below.

There is already support for the new prefixes, so you can use them today in 
your code. I would suggest that we start to phase out the ambigious prefixes 
from gem5, which would have to be a slow and step-wise process:

1) Consistenly use the new ISO/SI/IEC prefixes in documentatin, code, and 
configuration files. I have posted some changes that update the main simulator, 
but not the configuration files. These changes are completely transparent and 
don't break anything.

2) Warn if legacy prefixes are used in a context in a context where they are 
interpreted as binary (e.g., MB).

3) Make the warning from 3 into an error.

4) Phase in consistent use SI-prefixes. I.e., 1M B == 1e6 B.

In terms of timeline, I think we can do 1 & 2 today without breaking anything. 
3 could be implemented after one or two releases.  4 is unlikely to be possible 
anytime soon, or at all, since it would subtly break simulation scripts that 
haven't been converted to use the new prefixes.

You might think this is just just a distraction and that the definitions are 
clear by looking at the unit (e.g., bytes and bits are always binary), but 
that's not the case. This is what we are currently doing in gem5:

 *   Physical quantities (s, Hz, V, A, J, K, C, F) use decimal prefixes (1M Hz 
== 1e6 Hz)
 *   Interconnect and NoC bandwidths (B/s) use binary prefixes (1 MB/s == 2**20 
B/s)
 *   Network bandwidths (bps) use decimal prefixes (1 Mbps == 1e6 b/s)
 *   Memory sizes and storage sizes (B) use binary prefixes.

This is roughly in line with traditional use:

 *   Most storage vendors define 1 MB as 10**6 bytes
 *   Memory vendors define 1 MB as 2**20 bytes (note that gem5 doesn't do this)
 *   Network equipment treats 1Mbit/s as 10**6 bits/s
 *   Memory vendors define 1Mbit as 2**20 bits
 *   Windows defines 1 MB as 2**20 bytes
 *   MacOS 10.6 or newer defines a 1MB as 10**6 bytes, older versions use 2**20 
bytes.
 *   JEDEC defines 1 MB as 2**20 bytes
 *   IEC, ISO, ISQ(SI) all define 1MB as 10**6 bytes. This is also the legal 
definition in the US.

This means that a FLASH chip on a storage bus uses decimal prefixes, but that 
same flash chip on a memory bus uses binary prefixes. It would also be 
reasonable to assume that the contents of a 10Mbit FLASH chip would take 1s to 
transfer over a 10Mbit Ethernet link. That's however not the case due to 
different meanings of the prefix.

Cheers,
Andreas
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to