Skip to content

[API Proposal]: x64 CLDEMOTE Intrinsics #107022

Open

Description

@MineCake147E

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

  1. added
    api-suggestion
    on Aug 27, 2024
  2. added
    untriaged
    on Aug 27, 2024
  3. dotnet-policy-service commented on Aug 27, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
    See info in area-owners.md if you want to be subscribed.

  4. added this to the Future milestone on Sep 17, 2024
  5. added
    needs-further-triage
    and removed
    untriaged
    on Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionarea-System.Runtime.Intrinsicsneeds-further-triage

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions