Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

hardware prefetching programmatically

roberto_g_2
New Contributor I
445 Views

We know how to perform software prefetching using C++ intrinsics.

As for hardware prefetching to improve cache performance, Chapter 8 in the document Intel 64 and IA-32 Architectures Optimization Reference Manual shows how to do that using inline asm. Following that suggestion, we could use the following inline assembly to hw prefect 512 bytes (where, alternatively, mov r9 can be replaced by vmovaps ymm0):

 

inline void Prefetch512_HW(void* address)
{
 _asm {
       mov rsi, address
       mov r9, [rsi]
       mov r9, [rsi+64]
       mov r9, [rsi+128]
       mov r9, [rsi+192]
       mov r9, [rsi+256]
       mov r9, [rsi+320]
       mov r9, [rsi+384]
       mov r9, [rsi+448]
      }
}

 

  1. Is there a lighter (faster) way to attain the same goal? Loading a byte in each mov instruction? Using some alternative instruction to mov for those addresses?
  2. Suppose that we have a large number of 4KiB virtual pages and want to improve TLB caching (page walk) of those addresses: how can we make it easy programmatically? 

Thank you

-Roberto

0 Kudos
1 Solution
PrasanthD_intel
Moderator
415 Views

Hi Roberto,


Due to some error, your query has been marked spam. But you have already raised another thread. So we are closing this thread as this became a duplicate

of the new thread - https://community.intel.com/t5/Intel-C-Compiler/hardware-prefetching-programmatically-posted-again/m...


Regards

Prasanth


View solution in original post

2 Replies
PrasanthD_intel
Moderator
416 Views

Hi Roberto,


Due to some error, your query has been marked spam. But you have already raised another thread. So we are closing this thread as this became a duplicate

of the new thread - https://community.intel.com/t5/Intel-C-Compiler/hardware-prefetching-programmatically-posted-again/m...


Regards

Prasanth


View solution in original post

roberto_g_2
New Contributor I
403 Views

Yes please, thank you Prasanth!

-Roberto

Reply