Rename Prefetch to MemoryPrefetch

This commit is contained in:
Wojtek Figat
2025-06-06 22:55:14 +02:00
parent 462f75abd0
commit 125a973ff2
6 changed files with 20 additions and 19 deletions

View File

@@ -30,6 +30,10 @@ public:
{
__sync_synchronize();
}
FORCE_INLINE static void MemoryPrefetch(void const* ptr)
{
__builtin_prefetch(static_cast<char const*>(ptr));
}
FORCE_INLINE static int64 InterlockedExchange(int64 volatile* dst, int64 exchange)
{
return __sync_lock_test_and_set(dst, exchange);
@@ -74,10 +78,6 @@ public:
{
__atomic_store(dst, &value, __ATOMIC_RELAXED);
}
FORCE_INLINE static void Prefetch(void const* ptr)
{
__builtin_prefetch(static_cast<char const*>(ptr));
}
static bool Is64BitPlatform();
static String GetSystemName();
static Version GetSystemVersion();

View File

@@ -21,6 +21,10 @@ public:
{
__sync_synchronize();
}
FORCE_INLINE static void MemoryPrefetch(void const* ptr)
{
__builtin_prefetch(static_cast<char const*>(ptr));
}
FORCE_INLINE static int64 InterlockedExchange(int64 volatile* dst, int64 exchange)
{
return __sync_lock_test_and_set(dst, exchange);
@@ -62,9 +66,6 @@ public:
__atomic_store_n((volatile int64*)dst, value, __ATOMIC_RELAXED);
}
FORCE_INLINE static void Prefetch(void const* ptr)
{
__builtin_prefetch(static_cast<char const*>(ptr));
}
static bool Is64BitPlatform();
static String GetSystemName();
static Version GetSystemVersion();

View File

@@ -239,6 +239,12 @@ public:
/// </summary>
static void MemoryBarrier() = delete;
/// <summary>
/// Indicates to the processor that a cache line will be needed in the near future.
/// </summary>
/// <param name="ptr">The address of the cache line to be loaded. This address is not required to be on a cache line boundary.</param>
static void Prefetch(void const* ptr) = delete;
/// <summary>
/// Sets a 64-bit variable to the specified value as an atomic operation. The function prevents more than one thread from using the same variable simultaneously.
/// </summary>
@@ -317,12 +323,6 @@ public:
/// <param name="value">The value to be set.</param>
static void AtomicStore(int64 volatile* dst, int64 value) = delete;
/// <summary>
/// Indicates to the processor that a cache line will be needed in the near future.
/// </summary>
/// <param name="ptr">The address of the cache line to be loaded. This address is not required to be on a cache line boundary.</param>
static void Prefetch(void const* ptr) = delete;
#if COMPILE_WITH_PROFILER
static void OnMemoryAlloc(void* ptr, uint64 size);
static void OnMemoryFree(void* ptr);

View File

@@ -45,6 +45,10 @@ public:
{
__sync_synchronize();
}
FORCE_INLINE static void MemoryPrefetch(void const* ptr)
{
__builtin_prefetch(static_cast<char const*>(ptr));
}
FORCE_INLINE static int64 InterlockedExchange(int64 volatile* dst, int64 exchange)
{
return __sync_lock_test_and_set(dst, exchange);
@@ -89,10 +93,6 @@ public:
{
__atomic_store(dst, &value, __ATOMIC_SEQ_CST);
}
FORCE_INLINE static void Prefetch(void const* ptr)
{
__builtin_prefetch(static_cast<char const*>(ptr));
}
static bool Is64BitPlatform();
static String GetSystemName();
static Version GetSystemVersion();

View File

@@ -251,7 +251,7 @@ void Win32Platform::MemoryBarrier()
#endif
}
void Win32Platform::Prefetch(void const* ptr)
void Win32Platform::MemoryPrefetch(void const* ptr)
{
#if _M_ARM64
__prefetch((char const*)ptr);

View File

@@ -23,6 +23,7 @@ public:
static bool Init();
static void Exit();
static void MemoryBarrier();
static void MemoryPrefetch(void const* ptr);
static int64 InterlockedExchange(int64 volatile* dst, int64 exchange)
{
#if WIN64
@@ -83,7 +84,6 @@ public:
_interlockedexchange64(dst, value);
#endif
}
static void Prefetch(void const* ptr);
static void* Allocate(uint64 size, uint64 alignment);
static void Free(void* ptr);
static void* AllocatePages(uint64 numPages, uint64 pageSize);