How to access Cache memory

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

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

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.

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today