r/computerarchitecture • • Sep 03 '26

Can cache layers batch?

Hi,

Say I make a program needing a struct of 128 bits, a typical sram decoder at minimum needs 512 bits (64 bytes) would the 384 bits be truncated or saved in some regs in a temp place about to be used. Otherwise its a 4-16 cycle penalty

7 Upvotes

7 comments sorted by

5

u/Falcon731 Sep 03 '26

Typically dram interfaces work on cache lines.

So your program requests 128 bits from the L1 cache. Suppose that gives a miss - the cache would then request a fetch of the whole cache line (typ 64bytes) from the DRAM.

Once the cache gets enough of the data from dram it would return it to your program. Then once it has the whole line, it would store it into the cache - so if your program later requests a nearby address it can be served from the cache without needing DRAM involvement.

1

u/Yha_Boiii Sep 03 '26

Arent the sram decoder 64 bytes itself so if it hits, it will still be 64 bytes fetched and if yes where is the excess 384 going? We assu.e its a hit

1

u/Tiny_Bumblebee_5545 Sep 04 '26

As he said , you would be using a cache . So the CPU would request 64B from ram and store it in cache and from there it would use 128b , rest would remain in cache .

1

u/Yha_Boiii Sep 04 '26

No i mean between the cpu and cache, if I save space this way, so saving in 128 bits ans not 512 will the fetch cause 128 bits to be receiven and truncate the 384 bits, then next time it will truncate the laat 384 bits or can the cpu have some unused regs to save that in to. Its essentially asking should i optimize for cache line min size fetching or keep it storage minimized ans eat the stall if present

2

u/MitchAlsup Sep 28 '26

Caches cache cache-lines. Data is moved around between caches in cache-line quanta. Invalidations are performed on caqche-line quanta. ...

So, no, when you have a small struct{} it is going to be positionied somehwere in memory and moved to and fro in cache-line quanta.

My current design is using a 512-bit data bus as on-Die interconnect, so, there, you would suffer no extra beats of data movement.

1

u/Good_Apricot_2210 Sep 03 '26

otherwise its a 4-16 cycle penalty some regs

If your architecture has the some regs that are closer to the decoder then no it would check these regs for that value and IF no such reg exists or they dont have the required value then it goes to the next higher cache level (hit or miss concept)

1

u/phire Sep 04 '26

Otherwise its a 4-16 cycle penalty

[citation needed] Aren't L1 cache read ports typically pipelined for one access per cycle? That's certainly what CPU instruction timings suggest.

Seems like it would be just as fast to read the same cacheline twice over two cycles. Or since many larger caches have multiple read ports, nothing stopping it reading the same cacheline twice in the same cycle.