RRZE-HPC / likwid

Performance monitoring and benchmarking suite
https://hpc.fau.de/research/tools/likwid/
GNU General Public License v3.0
1.65k stars 226 forks source link

What is the difference between cache miss rate and cache miss ratio? #549

Closed nicklin96 closed 8 months ago

nicklin96 commented 1 year ago

I am measuring the cache performance of my multi-thread program. I wonder what's the definition of miss rate and miss ratio in performance groups like L2CACHE and L3CACHE?

TomTheBear commented 1 year ago

If you run likwid-perfctr -g L2CACHE -H, you get the long description of the group. This text commonly contains more information about the used events and their meaning as a derived metric.

https://github.com/RRZE-HPC/likwid/blob/master/groups/skylakeX/L2CACHE.txt#L25C1-L32 :

This group measures the locality of your data accesses with regard to the L2 cache. L2 request rate tells you how data intensive your code is or how many data accesses you have on average per instruction. The L2 miss rate gives a measure how often it was necessary to get cache lines from memory. And finally L2 miss ratio tells you how many of your memory references required a cache line to be loaded from a higher level. While the data cache miss rate might be given by your algorithm you should try to get data cache miss ratio as low as possible by increasing your cache reuse.

For L3CACHE, it's basically the same text, just at a different cache level: https://github.com/RRZE-HPC/likwid/blob/master/groups/skylakeX/L3CACHE.txt#L26-L33

It might be that for your architecture, the long descriptions do not contain this info or do not explain the metrics. Please name the architecture, I will add more info to the groups.

TomTheBear commented 10 months ago

Any more questions? If not, please close the issue.