Open Sparkenstein opened 1 week ago
Note that the example uses get_cache_info
which has limited support on AMD. To get cache sizes reliably on AMD you might want to use other functions like https://docs.rs/raw-cpuid/latest/raw_cpuid/struct.CpuId.html#method.get_l1_cache_and_tlb_info and https://docs.rs/raw-cpuid/latest/raw_cpuid/struct.CpuId.html#method.get_l2_l3_cache_and_tlb_info
So far so good, but I am using AMD Ryzen 7800X3D 8-Core Processor. Official spec and windows system monitor both report L2 cache size as 512KB.
L1 cache?
7800X3D has the L2 cache of 8MB (1MB per core).
https://www.amd.com/en/products/processors/desktops/ryzen/7000-series/amd-ryzen-7-7800x3d.html
The total cache count can be calculated as <max threads> / max_cores_for_cache
for AMD Ryzen.
If you want the total cache size, use <cache size> * (<max threads> / max_cores_for_cache)
to calculate it.
Sorry if I don't understand this correctly, as I am not well versed with rust, but from example I am getting cache sizes as:
So far so good, but I am using AMD Ryzen 7800X3D 8-Core Processor. Official spec and windows system monitor both report L2 cache size as 512KB.
The example says the calculation of cache is :
But its associativity is 8 way, so do I have to multiply size with associativity again? (that gives 8MB which is correct cache size). that also works with L1 because L1 data + Instruction is given as 32 so (32x8)x2 gives 512.
If that's the case, then why L3 is reported correctly? Is this a bug? Following are the cache objects for L2 and L3.