[Bug c/50994] New: wanted: interface for querying cache size
bkoz at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 4 23:01:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50994
Bug #: 50994
Summary: wanted: interface for querying cache size
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bkoz@gcc.gnu.org
GCC is missing a way to query cache line size. This could be provided as a
compile-time constant, in the form of predefined macros in a form similar to
the existing sizeof macros via something like __SIZEOF_L1_CACHE_LINE__. Or, it
could be via a __builtin, like __builtin_l1_cache_line_size().
Results would be consistent with existing --param flags, such that
--param l1-cache-line-size=64
meant that
__builtin_l1_cache_line_size() == 64.
I notice that intel provides the following interface, via:
http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/index.htm
unsigned int __cacheSize(unsigned int cacheLevel)
"__cacheSize(n) returns the size in kilobytes of the cache at level n. 1
represents the first-level cache. 0 is returned for a non-existent cache level.
For example, an application may query the cache size and use it to select block
sizes in algorithms that operate on matrices."
ding ding ding!!
More information about the Gcc-bugs
mailing list