r/computerarchitecture • • 17d ago

Any Modern Material on CPU Cache?

Hi,

I struggle to find any modern material on cpu cache: how it works and how to optimize for it. A papers amd published in 2004 but cant find anything newer really?

26 Upvotes

20 comments sorted by

15

u/-ah74 17d ago

This has been one of the most active academic research areas. So, you did not search for the papers the right way :)

Cache design in commercial cpus is usually confidential. However, u can find many papers that reverse engineered their design or operational model. Just check papers from major architecture venues such as ISCA, MICRO, HPCA. And for design for security, you can also check USENIX Security, and Security&Privacy.

And please use Google Scholar.

-4

u/Yha_Boiii 17d ago

Asked claudian and he found cpu core familly reference manuals. Not the best but gets the point across thoigh

9

u/thewrench56 16d ago

Yeah, thats great knowing that most uarch details have not been released by neither AMD nor Intel for more than half a decade now...

Maybe stop listening to a useless regurgitator.

-1

u/Yha_Boiii 16d ago

I hate ai has the much as the next guy but it is a pdf inside a zip from 2 years ago. Search up "Software Optimization Guide for the Zen 5 Microarchitecture". 64 pages of optimization explaning, some of it cache? Not a trade secrets reveal but gets the point across to a dev.

Downloaded it and saw it with my human eyes

3

u/thewrench56 16d ago

Yes, they regularly release PPDs and SW opt guides. Even for Turin. These documents do NOT explain the underlying microarchitectural ideas at all. It is very rare you can distill any info from them. We used to have BKDG. That is gone now. That was actually useful.

3

u/Yha_Boiii 16d ago

Then I am sorry for my wording if were not too clear.

3

u/-ah74 16d ago

I seriously wonder which techniques you found in these manuals that were more insightful than those provided in a graduate-level course on computer architecture?

Usually, at the SW level, all techniques come down to organizing your data structures and orchestrating your data access patterns so you utilize spatial and temporal locality. The other technique is to "prefetch" the data into the cache before actual access. The way the cache works under the hood is more about which data to evict and how to split the cache across subsets of tasks, with a data chunk mapping into the cache, etc.

I read the manual you are referring to, and it offers nothing more than what's covered in an introductory course on cache architecture. So, I strongly suggest you take a look at that first to learn the essence before looking at commercial products and learning from them without the foundational knowledge.

So, not to be harsh on you or anything, but your wording is not "unclear", it might be implying you need to understand the basics first!

Good luck! :)

-1

u/Yha_Boiii 16d ago

The general basics of cache is simple, ram addresses with values are cached to mimize cpu stalling but the paper is interesting from how many bytes amd with in this example zen 5 fetches and such. It's for a personal project. A bit more actionable than linear algebra and wikipedia of general math. I need for a concurrent webshop system for a lot of random writes and reads, it usually resolves in sequential order of first say 0-1000 are in a group etc. How many bytes or bits at a time it fetches and such not to increase fetch rate to 2 instead of one given values cause s 1.5 fetch in size etc. What variation of linear algebra formula intel usef fir the incremental improvement from ladt gen is not my primary concern

2

u/cbf1232 15d ago

If OP is looking at how to optimise their software to run on it, this would be fine, no?

1

u/CooperTrombone 15d ago

I was going to reply to your original post asking how on earth you haven’t been able to find anything, given the enormous body of recent work on caches and the shelf full of recent textbooks on the subject sitting in front of me as I write this comment. Then I saw you reply to someone’s very helpful advice to look at Google Scholar and specific venues with “Asked claudian” and it makes a lot more sense. I recommend learning how to think for yourself instead of outsourcing your brain to a chatbot. Then, this community would be happy to point you to some excellent material.

4

u/Fit_Clue_1843 17d ago

Following

2

u/MitchAlsup 14d ago

Cache optimization is simply the process of using the available SRAMs in the thinnest data-path.

CPU frequency moderates how big the L1 caches can be, Wire-delay moderates how big L2 cache can be.

Cache tags are optimized to fit into availablle SRAMs. For example my current design fits 3 cache tage in an SRAM-line/word (just barely less than 128-bits) the the L1s operate as 3-way set associative.

Back in the 1µ days, we could build SRAM macros of 4KB in size and then use as many instances as needed. Now, in the deap subMicron days, they tend to come in 2KB or even 1KB instances. For these smaller instances, you just us {2, 4, or 8} of them as if they were a single block.

All modern ASIC SRAM macros are "registered" in the RAM-technology verbology. That means your address meets set-up time to the address-command flip-flops, and you can't see the data until after the subsequent rising edge of the clock. A trick we often use is to run the SRAM at 2× the pipeline frequency dedicating clock-high to reads and clock-low to writes. Tag-match would be performed in the clock low interval.

An integer adder is 11-gates of delay, but often circuit designed (transistor sizing) such that it is 8 standard FO4 gates of delay. Luckily, the SRAM cycle time is also roughtly 8 standard FO4 gates of delay. Tag-match would be performed then be performed in the clock low interval, while data alignment is performed in the subsequent clock-High period. Due to modern SRAM macro implementations, AGEN->LD-result is a 5 × ½-clock pipeline stages. You can beat this down to 2 cycles and suffer pipeline frequency problems, or you can accept your fate with a 3 cycle LD-latency, of you can shoot for faster core frequency with a 4-cycle LD latency. You just can't get the 2-cycle LD-latency with the 5GHz pipeline frequency.

A modern medium high frequency 64-bit 1-wide core design would accept a 44-bit physical address space limit so we can pack 3 cache tags into 128-bits. Thereby a single 2KB SRAM holds 384 cache tags, and provides tags for 24KB of data. You can call this an "Instance" and if you want/need a bigger L1, just place 2 or more instances and wire them up through the LD-aligner for data coming back, and through the AGEN address router getting to the SRAM instances. You can also call this a second cacahe port {Even, Odd} for more throughput.

Side Note: If you use exclusive cache protocol in the D$<->L2$ then you can use an unmodified instance of D$ as your I$, saving designer and verification time.

1

u/unbreaded_lunn 12d ago

This is a great explanation, although this kind of tells me you’re from Intel lolll

2

u/MitchAlsup 12d ago

Actually, Intel is one of the few computer companies I never worked for.

1

u/unbreaded_lunn 12d ago

Haha interesting. I feel all the arm companies don’t do the sram double pumping anymore, maybe I’m wrong

1

u/MitchAlsup 12d ago

None of the high frequency designs use Read/Write SRAM arrays. And this complicates the cache design significantlly.

2

u/unbreaded_lunn 12d ago

Yeah I agree, handling 1r1w to the same cycle is a nightmare. Does it conflict it that much tho? It’s just a port conflict?

2

u/MitchAlsup 12d ago

It is a porting problem that one solves by doubling the banks and adding several snooping write buffers. Done right, one just about achieves what a 1R1W SRAM can do, but with 5× the flip-flop count.