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
KernelArgument(string, Type, object?)
Creates a new KernelArgument with the specified name, type, and value
public KernelArgument(string name, Type type, object? value)
Parameters
Properties
Alignment
Gets or sets the alignment requirement for this argument
public int Alignment { get; set; }
Property Value
Direction
Gets or sets the parameter direction (input, output, or bidirectional)
public ParameterDirection Direction { get; set; }
Property Value
IsConstant
Gets or sets whether this argument is constant
public bool IsConstant { get; set; }
Property Value
IsDeviceMemory
Gets or sets whether this argument represents device memory
public bool IsDeviceMemory { get; set; }
Property Value
IsOutput
Gets or sets whether this argument is an output parameter
public bool IsOutput { get; set; }
Property Value
IsPointer
Gets or sets whether this argument is a pointer/reference type
public bool IsPointer { get; set; }
Property Value
MemoryBuffer
Gets or sets the memory buffer associated with this argument
public object? MemoryBuffer { get; set; }
Property Value
MemorySpace
Gets or sets the memory space where this argument resides
public MemorySpace MemorySpace { get; set; }
Property Value
Name
Gets or sets the argument name
public string Name { get; set; }
Property Value
Size
Gets or sets the size of the argument in bytes
public int Size { get; set; }
Property Value
SizeInBytes
Gets or sets the size of the argument in bytes (alias for Size).
public int SizeInBytes { get; set; }
Property Value
Type
Gets or sets the argument type
public Type Type { get; set; }
Property Value
Value
Gets or sets the argument value
public object? Value { get; set; }
Property Value
Methods
CreateBuffer(string, object, ParameterDirection)
Creates a pointer/buffer argument
public static KernelArgument CreateBuffer(string name, object buffer, ParameterDirection direction = ParameterDirection.In)
Parameters
namestringThe argument name
bufferobjectThe buffer
directionParameterDirectionThe 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
namestringThe argument name
valueTThe argument value
Returns
- KernelArgument
A new KernelArgument
Type Parameters
TThe argument type
ToString()
Returns a string representation of the argument
public override string ToString()