2013年9月12日 星期四

_mm_prefetch

void _mm_prefetch(char *bytep, int hint);


Discribe:
 The _mm_prefetch function fetches the line of data from memory that contains the byte pointed to by bytep, to a location in the cache hierarchy specified by the constant in hint.

char *bytep-->address

hint
為下面其中一個macro:
_MM_HINT_T0   T0 (temporal data) - prefetch data into all levels of the cache hierarchy.
_MM_HINT_T1   T1 (temporal data with respect to first level cache) - prefetch data into level 2 cache and higher.
_MM_HINT_T2   T2 (temporal data with respect to second level cache) - prefetch data into level 2 cache and higher.
_MM_HINT_NTA  NTA (non-temporal data with respect to all cache levels) - prefetch data into non-temporal cache structure and into a location close to the processor, minimizing cache pollution.

每次cache抓取的Size為一個cache line的Size
cache line size 是 16 words (address 0~3)


Example:(VIsual Studio 2008, 2010)
#include <xmmintrin.h>

int main()
{

    _mm_prefetch(0,0);

    return 0;
}



參考網址:
http://stackoverflow.com/questions/12418622/where-is-mm-prefetch-in-visual-studio-2012
http://www.neatinfo.com/net-wrench.com/snippets/c/~%20tutors/pellec-help-html-ver/crt/_mm_prefetch.htm
http://realchecko.blogspot.tw/2010/08/cache.html


http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/intref_cls/common/intref_sse_cacheability.htm
http://blog.csdn.net/zhuliting/article/details/6009672
http://www.mirabilisdesign.com/Pages/Demonstrations/systemarchitecture/Cache_System/Functional_Cache_Model_Overview.html

沒有留言:

張貼留言