Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
12 Views

How to access Cache memory

Hello All,
I need to access the CPU Cache memories (L1, L2, L3) for reading and writing into it. Can I do this? I think so far that Cache is made only for processor for spped up the operations. Is'nt it? I am calling the CPU intrinsic method _mm_prefetch interuction for this. whether I am on right track to get cache information or not. Please let me know As early as possible.

Thanks in advance,

regards,
Suraj
0 Kudos
3 Replies
Highlighted
New Contributor II
12 Views

Quoting - suraj_pune
Hello All,
I need to access the CPU Cache memories (L1, L2, L3) for reading and writing into it. Can I do this? I think so far that Cache is made only for processor for spped up the operations. Is'nt it? I am calling the CPU intrinsic method _mm_prefetch interuction for this. whether I am on right track to get cache information or not. Please let me know As early as possible.

Thanks in advance,

regards,
Suraj
Hi.

AFAIK from the information you are sharing, Cache memories(L1, L2, L3) data can be studied & known through Compiler propreitary IDE, if you have IDE of the Compiler you are using, you can check the datas flow and it's contents.

Intel VTune which is a profiler doesgives ananalysis of Cache misses & it's performances.

Plz do check your processor supports all caches(L1, L2 & L3 caches) or simply L1 & L2 caches.

~BR
0 Kudos
Highlighted
Valued Contributor I
12 Views

Quoting - suraj_pune
Hello All,
I need to access the CPU Cache memories (L1, L2, L3) for reading and writing into it. Can I do this? I think so far that Cache is made only for processor for spped up the operations. Is'nt it? I am calling the CPU intrinsic method _mm_prefetch interuction for this. whether I am on right track to get cache information or not. Please let me know As early as possible.

Thanks in advance,

regards,
Suraj

You cannot read or write cache contents explicitly because that would be a security risk and messing with data in such a way would actually decrease performance.

As you concluded yourself, the cache is there only for the processor to speed up its operations. The best analogy would be your peripheral nervous system (autonomous part in particular) which controls your breathing to stay alive -- you can influence breathing to an extent, but you don't have direct and complete control over it.

0 Kudos
Highlighted
Beginner
12 Views


you can read/write cached data with windbg
its a debug tool from microsoft
but once you write to it it will become invalid and the proc will dump it and reload from system memory
0 Kudos