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
663 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
2 Replies
delacy__david
Beginner
663 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

if you write to the cpu cache it will become invalid and unload the data in the cache and reload the ram data
i think you want to use un-cached data
please say what you are trying to do because i seem to remember that writing to the cpu cache is wrong
0 Kudos
TimP
Honored Contributor III
663 Views
The Intel compiler documentation includes some advice about use of explicit prefetch, as well as the opt-prefetch global compile option, and loop level prefetch pragmas. There are additional specialized options for IA64 (Itanium). All recent Xeon and AMD CPUs have effective hardware prefetch implementations, so the role of software prefetch is limited to situations not covered by the hardware, such as early new page fetches where the programmer knows the addresses in advance, possibly in situations where some of the hardware prefetch options are disabled. The compiler options cover single level indirection in a loop. CPUs which are no longer in production, such as P-III, Athlon32, P4, allowed for use of prefetch in ways which aren't useful for current and future CPUs, such as those for which this forum was started. So, as the other reply said, we can't guess if you are on the right track, without some information from you.
0 Kudos
Reply