Table of Contents

Class KernelArgument

Namespace
DotCompute.Abstractions.Kernels
Assembly
DotCompute.Abstractions.dll

Represents a single argument passed to a kernel

public sealed class KernelArgument
Inheritance
KernelArgument
Inherited Members

Constructors

KernelArgument()

Creates a new KernelArgument

public KernelArgument()

KernelArgument(string, object?)

Creates a new KernelArgument with the specified name and value

public KernelArgument(string name, object? value)

Parameters

name string

The argument name

value object

The argument value

KernelArgument(string, Type, object?)

Creates a new KernelArgument with the specified name, type, and value

public KernelArgument(string name, Type type, object? value)

Parameters

name string

The argument name

type Type

The argument type

value object

The argument value

Properties

Alignment

Gets or sets the alignment requirement for this argument

public int Alignment { get; set; }

Property Value

int

Direction

Gets or sets the parameter direction (input, output, or bidirectional)

public ParameterDirection Direction { get; set; }

Property Value

ParameterDirection

IsConstant

Gets or sets whether this argument is constant

public bool IsConstant { get; set; }

Property Value

bool

IsDeviceMemory

Gets or sets whether this argument represents device memory

public bool IsDeviceMemory { get; set; }

Property Value

bool

IsOutput

Gets or sets whether this argument is an output parameter

public bool IsOutput { get; set; }

Property Value

bool

IsPointer

Gets or sets whether this argument is a pointer/reference type

public bool IsPointer { get; set; }

Property Value

bool

MemoryBuffer

Gets or sets the memory buffer associated with this argument

public object? MemoryBuffer { get; set; }

Property Value

object

MemorySpace

Gets or sets the memory space where this argument resides

public MemorySpace MemorySpace { get; set; }

Property Value

MemorySpace

Name

Gets or sets the argument name

public string Name { get; set; }

Property Value

string

Size

Gets or sets the size of the argument in bytes

public int Size { get; set; }

Property Value

int

SizeInBytes

Gets or sets the size of the argument in bytes (alias for Size).

public int SizeInBytes { get; set; }

Property Value

int

Type

Gets or sets the argument type

public Type Type { get; set; }

Property Value

Type

Value

Gets or sets the argument value

public object? Value { get; set; }

Property Value

object

Methods

CreateBuffer(string, object, ParameterDirection)

Creates a pointer/buffer argument

public static KernelArgument CreateBuffer(string name, object buffer, ParameterDirection direction = ParameterDirection.In)

Parameters

name string

The argument name

buffer object

The buffer

direction ParameterDirection

The parameter direction

Returns

KernelArgument

A new KernelArgument

Create<T>(string, T)

Creates a typed kernel argument

public static KernelArgument Create<T>(string name, T value)

Parameters

name string

The argument name

value T

The argument value

Returns

KernelArgument

A new KernelArgument

Type Parameters

T

The argument type

ToString()

Returns a string representation of the argument

public override string ToString()

Returns

string