Please school me on L2/L3 cache

Bruck

Senior member
Aug 6, 2003
381
0
0
Ok here's what I THINK. not what i KNOW. You can correct me or just start from scratch.

L2 cache runs at full clock speed of the chip, and is used for processing instructions space. L3 cache runs at 1/3 cpu bus speed and is used for identical funcitons when L2 cache is full. So there are no advantages of L3 over L2, providing it isnt at the cost of space. For example. 2mb of L2 would be better than 1mb L2+1mbL3 , or any other combo. I am not sure i know that i am right. Just figured i'd let you know what i think.

This is in refrence to apple recently dropping L3 cache off of one of it's G4 laptop processors, but then doubling the L2 cache. Some people are wasting their time complaining about the removal of L3, but i am under the impression that if the L2 was doubled, then who cares.

Please educate me as easily as possible. Thankyou.
 

Bruck

Senior member
Aug 6, 2003
381
0
0
I was kind-of looking for a little less technical reply fitting perhaps in a paragraph.

thanks
 

mechBgon

Super Moderator<br>Elite Member
Oct 31, 1999
30,699
1
0
L2 doesn't always run at full clockspeed (examples: PentiumII's and Katmai P3's). Latency, associativity, bus width and inclusion/exclusion play parts, not just plain old size, so it's a delicate balancing act. That's just a grab at some generalizations, and I know next to nothing about the G4 in the first place. I'll point your thread out to ViRGE and see what he's got to say... sometimes all the theory in the world is nothing more than that :D
 

lucky9

Senior member
Sep 6, 2003
557
0
0
depends on the processor. L1, L2, L3 etc can all be on die and full speed. the higher numbers are later in the chain of requests, usually. and there are the 4way and 8way and 16way set associative (sp) cache types. these can be faster or slower, each of them, due to the code that detail how they work. usually (up to a limit) the higher ones are faster. but it depends on the size of these also.:confused:
 

Bruck

Senior member
Aug 6, 2003
381
0
0
Well I know for a fact that the L3 on the chip in discussion is slower than the L2 on the same chip. So would my assumption that uppipng L2 and dropping L3 is an improvement with no downside true?
 

Pandaren

Golden Member
Sep 13, 2003
1,029
0
0
Well I know for a fact that the L3 on the chip in discussion is slower than the L2 on the same chip. So would my assumption that uppipng L2 and dropping L3 is an improvement with no downside true?

Not necessarily. It depends on how much bigger you make the L2 cache and how fast or slow your computer's memory system is.

Making a bigger L2 cache means that more data and instructions are quickly available to the CPU, but generally speaking, larger caches can't clock as high as smaller ones (larger ones require more logic to control, and the more circuitry you have the slower the logic can run due to propogation issues, etc). So an engineer might raise the L2 from 512KB to 1024KB, but raise the latency from 10 cycles to 15 cycles.

Dropping L3 is not necessarily an improvement if the memory system is relatively slow. If the designer of the CPU raised the L2 cache, but did not make it as big as the L3 cache, the CPU will be idling a lot longer if there is an L2 miss because the CPU would have to wait for information from RAM.

You can read about this in textbooks - I am somewhat rusty on these concepts as I am mostly a software person.
 

ViRGE

Elite Member, Moderator Emeritus
Oct 9, 1999
31,516
167
106
You are correct, Apple dropping the L3 cache in favor of more on-die L2 is indeed a "who cares" situation. Probably the best proof is one of Anand's old articles, where he tests the performance of L3 cache on K6-3 based machines(the -3 had on-die L2, which made the L2 on the motherboard L3); the performance boost from L3 was negligable in turn, a boost of only a couple of precentage points at best. What matters in this case is that Apple has replaced relitively slow L3 cache with a smaller, but much faster quantity of on-die L2, as that more than makes up for any performance loss by dropping the L3(note that Apple never even bothered to include L3 on the original PB G4 12", so that's how useless it was). My guess is that the people who are complaining are just doing so for the heck of it; the days of cache that's not on-die is over.
 

George Powell

Golden Member
Dec 3, 1999
1,265
0
76
From my point of view, and correct me if I have got the wrong end of the stick here, is that.....

L1 tiny cache, only 8k on P4 but very fast with pretty much no latency and directly accessible from the logic units in the CPU.

L2 bigger, but slightly slower and acts as a way of topping up the L1 when the data/instructions have been used.

L3 really only useful for counteracting the high latency between the CPU and system RAM, in the case of the current P4's this is already quite small and hence there is only a small performance advantage in adding the L3 cache. Going back to the K6-3 the L3 was merely a lower latency memory off chip that ran at the FSB speed, the same as the memory at the time and as a result the performance gain was small. To simulate this in reverse benchmark your system and then slacken off all the memory timings to their highest value, benchmark again and compare, depending on your system I'd be surprised if the difference was enormous.
 

aka1nas

Diamond Member
Aug 30, 2001
4,335
1
0
In general the "lower level" caches are faster. Off die caches are usually only slightly faster than RAM.
<Helpful Analogy>
Lets say that you are chilling in your room and you want a beer. The first place you look is the minifridge you keep in the corner(Level 1 cache). It's kind of small, but you usually just keep your favorite munchies and drinks in there so you can get to them easy. If the beer you want isn't there, you hafta run downstairs to the fridge and look there(Level 2 cache). It's bigger and holds more kinds of grub than your minifridge, but it takes you longer to run downstairs to get to it. If the fridge doesn't have any beer, than you have to hoof it all the way to the store to buy more beer(RAM). The store has everything, but it takes much longer to get your beer than either of the two fridges.

In the case of a level 3 or offdie cache, think of it as the 7-11 on the corner.
</Helpful Analogy>:D

Hope that makes sense
 

ViRGE

Elite Member, Moderator Emeritus
Oct 9, 1999
31,516
167
106
Dude, that is the best analogy I have ever read. Congrats.;)
 

aka1nas

Diamond Member
Aug 30, 2001
4,335
1
0
Hehe, thanks guys. Feel free to use it in a FAQ if you guys think it will be helpful:D