Confused about Conflict Misses in Cache (Computer Architecture) - only seem to get them at a specific Block Size (8B)
Hello guys, I'm trying to learn how caches work and how misses happen. I have a pretty good understanding of how compulsory and capacity misses happen, but conflict misses can be a bit tricky in some situations.
So here's the deal:
- I have a cache of 512B
- A block size of 8B
- Direct Mapping
- (64 blocks in total)
The program goes througt a 4x64 matrix (each element is 4B) in column-major order (that's the challenge).
I'm getting 128 compulsory misses (that makes sense since we have twice the amount of data). Now what confuses me is that I'm getting 64 conflict misses as well, but only with an 8B block size - if I reduce the block size to 4B or increase it to 16B I get 0 conflict misses. Why does it only happen with an 8B block size?
I'm assuming an 8B block size would fetch and store 2 words of data from mem when accessed (spatial locality?), and maybe that somehow makes it skip every other memory reference?
I don't know, I'm super confused. If anyone of you want to discuss this with me, or point me in the right direction that would be huge. Let me know if you need more info to help me.
Posted Jan 23, 2019, 4:52 PM UTC
Take another look at what direct-mapped means. Try to find situations where aliasing would occur: Given your address space and the way you index your cache, can you find ranges of addresses which all map to the same block?
I tried drawing it out on the computer, but then I'm getting conflicts even on 4B block size. This is probably the completely wrong way to think about it, but this is how I was thinking (note that I scaled it all down): https://imgur.com/a/7ZYBCu6
I'm following this description:
"The typical mapping between addresses and cache locations for a directmapped cache is usually simple. For example, almost all direct-mapped caches use this mapping to find a block:
(Block address) modulo (Number of blocks in the cache)"
^(Hi, I'm a bot for linking direct images of albums with only 1 image)
https://i.imgur.com/0alW8Ib.png
^^Source ^^| ^^Why? ^^| ^^Creator ^^| ^^ignoreme ^^| ^^deletthis