void array_cache_flush(array_container_t* B) { const int32_t CACHELINESIZE = computecacheline(); // 64 bytes per cache line for (int32_t k = 0; k < B->cardinality; k += CACHELINESIZE / (int32_t)sizeof(uint16_t)) { __builtin_ia32_clflush(B->array + k); } }
// flushes the array from cache void run_cache_flush(run_container_t* B) { const int32_t CACHELINESIZE = computecacheline(); // 64 bytes per cache line for (int32_t k = 0; k < B->n_runs * 2; k += CACHELINESIZE / (int32_t)sizeof(uint16_t)) { __builtin_ia32_clflush(B->runs + k); } }
// flushes the array of words from cache void bitset_cache_flush(bitset_container_t* B) { const int32_t CACHELINESIZE = computecacheline(); // 64 bytes per cache line for (int32_t k = 0; k < BITSET_CONTAINER_SIZE_IN_WORDS; k += CACHELINESIZE / (int32_t)sizeof(uint64_t)) { __builtin_ia32_clflush(B->array + k); } }
// tries to put array of words in cache void bitset_cache_prefetch(bitset_container_t* B) { #ifdef IS_X64 const int32_t CACHELINESIZE = computecacheline(); // 64 bytes per cache line #else const int32_t CACHELINESIZE = 64; #endif for (int32_t k = 0; k < BITSET_CONTAINER_SIZE_IN_WORDS; k += CACHELINESIZE / (int32_t)sizeof(uint64_t)) { __builtin_prefetch(B->array + k); } }
// tries to put the array in cache void array_cache_prefetch(array_container_t* B) { #ifdef IS_X64 const int32_t CACHELINESIZE = computecacheline(); // 64 bytes per cache line #else const int32_t CACHELINESIZE = 64; #endif #if !(defined(_MSC_VER) && !defined(__clang__)) for (int32_t k = 0; k < B->cardinality; k += CACHELINESIZE / (int32_t)sizeof(uint16_t)) { __builtin_prefetch(B->array + k); } #endif }