public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50994] New: wanted: interface for querying cache size
@ 2011-11-04 23:01 bkoz at gcc dot gnu.org
  2011-11-04 23:13 ` [Bug c/50994] " pinskia at gcc dot gnu.org
  2021-09-03  6:32 ` [Bug middle-end/50994] " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: bkoz at gcc dot gnu.org @ 2011-11-04 23:01 UTC (permalink / raw)
  To: gcc-bugs

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!!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/50994] wanted: interface for querying cache size
  2011-11-04 23:01 [Bug c/50994] New: wanted: interface for querying cache size bkoz at gcc dot gnu.org
@ 2011-11-04 23:13 ` pinskia at gcc dot gnu.org
  2021-09-03  6:32 ` [Bug middle-end/50994] " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-04 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50994

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-04 23:12:51 UTC ---
The cache block/line size could be different on two different machines so it
cannot be constant.  Also there is no portable way of figuring out the cache
size.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/50994] wanted: interface for querying cache size
  2011-11-04 23:01 [Bug c/50994] New: wanted: interface for querying cache size bkoz at gcc dot gnu.org
  2011-11-04 23:13 ` [Bug c/50994] " pinskia at gcc dot gnu.org
@ 2021-09-03  6:32 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-03  6:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50994

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=88466

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this has the same issues as std::hardware_destructive_interference_size
has really. In that they can't be a constant as it might be different between
runtime env.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-03  6:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-04 23:01 [Bug c/50994] New: wanted: interface for querying cache size bkoz at gcc dot gnu.org
2011-11-04 23:13 ` [Bug c/50994] " pinskia at gcc dot gnu.org
2021-09-03  6:32 ` [Bug middle-end/50994] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).