Scenarios where manual pre-training software is reasonable

I read about it on x86 and x86-64 Intel gccprovides special prefetch instructions:

#include <xmmintrin.h>
enum _mm_hint
{
_MM_HINT_T0 = 3,
_MM_HINT_T1 = 2,
_MM_HINT_T2 = 1,
_MM_HINT_NTA = 0
};
void _mm_prefetch(void *p, enum _mm_hint h);

Programs can use the built-in _mm_prefetchfor any pointer in the program. And various tips to be used with the _mm_prefetch implementation completed. It is generally said that each of the hints has its own meaning.

_MM_HINT_T0 retrieves data at all cache levels for inclusive caches and to the lowest level cache for exclusive caches

_MM_HINT_T1 hint displays data in L2 and not in L1d. If there is L3 cache, _MM_HINT_T2 hints can do something similar for it

_MM_HINT_NTA,

- , ?

?

+3
1

:

  • .
    1 , 2.
  • .
    - / 3 4.

, , , , .
, , - , ; .

- , ( ISA). Intel AMD , .
, , , . , .
, - .

, - , .
, , , , , .

, , (L1 - L4) .

, prefetch0 , /, , , .
, , , , . , , , , , .

prefetch1 ( , L2 ) L1.
, , ( ).
, L1, , .

prefetch2 , , L3.
L1 L2, , , ( ) .

prefetchnta , - . , .

prefetchw/prefetchwnt1 , Exclusive , . , , MESI ( ).

, , L3, L1 ( , ).

, , .
( , L1, L2), .
, , , , .


, .
- .
, , , , .

, , .
, , , .
L3, CPU L3, L2 .

, .


1 - " ", "".
2 , . : , , L1 L3/L4. L3/L4 . L1 , L2 L1, - L2, .
3 - . (, TLB).
4 , , , @Leeor Linux.

+5

Source: https://habr.com/ru/post/1667425/


All Articles