MU Library
cache.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright 2024 XCENA Inc.
3 
4 #pragma once
5 
6 #include <cstdint>
7 
8 namespace mu
9 {
18 uint64_t readGlobal(const void* src);
19 
28 void writeGlobal(void* dst, uint64_t value);
29 
39 void memcpyGlobal(void* dst, const void* src, uint64_t size);
40 
51 void flushCache(const void* addr, uint64_t size = 64);
52 
61 
71 void prefetch(const void* addr, uint64_t size = 64);
72 
88 void prefetchStride(const void* addr, uint64_t count, uint64_t offset = 64);
89 
104 bool prefetchLinkedList(const void* addr, uint64_t count, uint64_t ptrOffset);
105 
106 } // namespace mu
Definition: assert.hpp:9
void flushCache(const void *addr, uint64_t size=64)
Flush cache lines for a memory region.
void prefetchStride(const void *addr, uint64_t count, uint64_t offset=64)
Prefetch multiple cache lines at regular stride intervals.
bool prefetchLinkedList(const void *addr, uint64_t count, uint64_t ptrOffset)
Prefetch cache lines by traversing a linked list.
void writeGlobal(void *dst, uint64_t value)
Write a value to global cache.
void flushCacheAll()
Flush all cache lines for current thread.
void prefetch(const void *addr, uint64_t size=64)
Prefetch a contiguous memory region into cache.
void memcpyGlobal(void *dst, const void *src, uint64_t size)
Copy data to global cache.
uint64_t readGlobal(const void *src)
Read a value from global cache.