Kobzol / hardware-effects

Demonstration of various hardware effects.
MIT License
2.83k stars 159 forks source link

Determining cache line size #19

Open skgbanga opened 4 years ago

skgbanga commented 4 years ago

This isn't really an issue, but more of a request.

I think it would be really nice to have a program (much like cache-hierarchy-bandwidth) which determine the cache line size. It is surprisingly difficult to isolate cache line size effect (prefetching makes everything hard). I tried to follow the advice mentioned in the top answer here: https://stackoverflow.com/questions/12675092/how-to-find-the-size-of-the-l1-cache-line-size-with-io-timing-measurements but it doesn't work on my computer.

skgbanga commented 4 years ago

I just realized that you have listed http://igoro.com/archive/gallery-of-processor-cache-effects/ as one of your resources, and this page does indeed show a way via stride lengths. (which is the example in cache-memory-bound).

However, my results are different from those in the article. I do not see a drop when going from ~15/16 to ~18/19.

Kobzol commented 3 years ago

Sorry for the long delay :( As you said, it might be probably pretty difficult to determine the cache size. If you found a reliable way, I'd be happy to accept a PR with such a program.