Open
Description
opened on Aug 27, 2024
Background and motivation
CLDEMOTE
is supported by Intel in the Sapphire Rapids and newer architectures.
It allows us to let the CPU move the specified cache line to a level more distant from the core without writing back to memory, accelerating subsequent accesses to the line by other cores in the same coherence domain.
This might be useful for passing some data between cores using shared memory.
API Proposal
namespace System.Runtime.Intrinsics.X86;
public abstract class CLDemote : X86Base
{
public static bool IsSupported { get; }
public static unsafe void DemoteCacheLine(void* address);
public abstract class X64 : X86Base.X64
{
public static bool IsSupported { get; }
}
}
API Usage
// Somewhere in a class
private uint v;
// In a function
v = 0;
CLDemote.DemoteCacheLine(Unsafe.AsPointer(ref v));
Alternative Designs
- There may be a better name for
CLDemote
Risks
None
Activity