Table of Contents

Struct DeviceMemory

Namespace
DotCompute.Abstractions
Assembly
DotCompute.Abstractions.dll

Represents a handle to device memory. This is a value type for AOT compatibility and zero allocations.

public readonly struct DeviceMemory : IEquatable<DeviceMemory>
Implements
Inherited Members

Constructors

DeviceMemory(nint, long)

Creates a new device memory handle.

public DeviceMemory(nint handle, long size)

Parameters

handle nint

The device memory pointer.

size long

The size of the allocation in bytes.

Properties

Handle

Gets the device memory pointer.

public nint Handle { get; }

Property Value

nint

Invalid

Creates an invalid device memory handle.

public static DeviceMemory Invalid { get; }

Property Value

DeviceMemory

IsValid

Gets whether this is a valid device memory handle.

public bool IsValid { get; }

Property Value

bool

Size

Gets the size of the memory allocation in bytes.

public long Size { get; }

Property Value

long

Methods

Equals(DeviceMemory)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(DeviceMemory other)

Parameters

other DeviceMemory

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(DeviceMemory, DeviceMemory)

public static bool operator ==(DeviceMemory left, DeviceMemory right)

Parameters

left DeviceMemory
right DeviceMemory

Returns

bool

operator !=(DeviceMemory, DeviceMemory)

public static bool operator !=(DeviceMemory left, DeviceMemory right)

Parameters

left DeviceMemory
right DeviceMemory

Returns

bool