Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

How to access Cache memory

suraj_pune
Beginner
507 Views
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
srimks
New Contributor II
507 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
levicki
Valued Contributor I
507 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
delacy__david
Beginner
507 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
Reply