Class AcceleratorInfo
- Namespace
- DotCompute.Abstractions
- Assembly
- DotCompute.Abstractions.dll
Represents information about an accelerator device.
public class AcceleratorInfo
- Inheritance
-
AcceleratorInfo
- Inherited Members
Constructors
AcceleratorInfo()
Parameterless constructor for test compatibility. Creates a default AcceleratorInfo for testing.
[SetsRequiredMembers]
public AcceleratorInfo()
AcceleratorInfo(AcceleratorType, string, string, long)
Legacy constructor for backward compatibility with tests.
[SetsRequiredMembers]
public AcceleratorInfo(AcceleratorType type, string name, string driverVersion, long memorySize)
Parameters
typeAcceleratorTypenamestringdriverVersionstringmemorySizelong
AcceleratorInfo(AcceleratorType, string, string, long, int, int, Version?, long, bool)
Extended constructor for tests.
[SetsRequiredMembers]
public AcceleratorInfo(AcceleratorType type, string name, string driverVersion, long memorySize, int computeUnits, int maxClockFrequency, Version? computeCapability, long maxSharedMemoryPerBlock, bool isUnifiedMemory)
Parameters
typeAcceleratorTypenamestringdriverVersionstringmemorySizelongcomputeUnitsintmaxClockFrequencyintcomputeCapabilityVersionmaxSharedMemoryPerBlocklongisUnifiedMemorybool
AcceleratorInfo(string, string, string, AcceleratorType, double, int, int, long, long)
Constructor for tests with full parameters.
[SetsRequiredMembers]
public AcceleratorInfo(string name, string vendor, string driverVersion, AcceleratorType type, double computeCapability, int maxThreadsPerBlock, int maxSharedMemory, long totalMemory, long availableMemory)
Parameters
namestringvendorstringdriverVersionstringtypeAcceleratorTypecomputeCapabilitydoublemaxThreadsPerBlockintmaxSharedMemoryinttotalMemorylongavailableMemorylong
Properties
Architecture
Gets the GPU architecture name (e.g., "Ampere", "RDNA2", "Xe", "Apple M1"). This is derived from the Capabilities dictionary or vendor-specific information.
public string Architecture { get; init; }
Property Value
AvailableMemory
Gets or sets the available device memory in bytes.
public long AvailableMemory { get; init; }
Property Value
Capabilities
Gets or sets device-specific capabilities.
public Dictionary<string, object>? Capabilities { get; init; }
Property Value
ComputeCapability
Gets or sets the compute capability or version.
public Version? ComputeCapability { get; init; }
Property Value
ComputeCapabilityVersionSafe
Gets the compute capability as a non-nullable version for test compatibility. Returns a default version (6.0) if ComputeCapability is null.
public Version ComputeCapabilityVersionSafe { get; }
Property Value
ComputeUnits
Gets or sets the number of compute units.
public int ComputeUnits { get; init; }
Property Value
DeviceIndex
Gets or sets the device index (for multi-device systems).
public int DeviceIndex { get; init; }
Property Value
DeviceType
Gets or sets the device type (e.g., "CPU", "GPU", "TPU").
public required string DeviceType { get; init; }
Property Value
DriverVersion
Gets or sets the driver version.
public string? DriverVersion { get; init; }
Property Value
Extensions
Gets the collection of backend-specific extensions supported by this accelerator. Examples: OpenCL extensions, CUDA PTX features, Metal feature sets.
public IReadOnlyCollection<string> Extensions { get; init; }
Property Value
Features
Gets the collection of hardware features supported by this accelerator. This provides a strongly-typed view of accelerator capabilities.
public IReadOnlyCollection<AcceleratorFeature> Features { get; init; }
Property Value
GlobalMemorySize
Gets or sets the total global memory size in bytes. This represents the total amount of memory accessible by compute kernels.
public long GlobalMemorySize { get; init; }
Property Value
Id
Gets or sets the unique identifier for this device.
public required string Id { get; init; }
Property Value
IsUnifiedMemory
Gets or sets whether the device uses unified memory.
public bool IsUnifiedMemory { get; init; }
Property Value
LanguageVersion
Gets the Metal Shading Language version supported by this device. Example: "2.4", "3.0", "3.1"
public string LanguageVersion { get; }
Property Value
LocalMemorySize
Gets or sets the local memory size in bytes.
public long LocalMemorySize { get; init; }
Property Value
MajorVersion
Gets the compute capability major version. For CUDA: The major version of compute capability (e.g., 8 for CC 8.6). For other backends: Derived from ComputeCapability or default to 0.
public int MajorVersion { get; }
Property Value
MaxClockFrequency
Gets or sets the maximum clock frequency in MHz.
public int MaxClockFrequency { get; init; }
Property Value
MaxComputeUnits
Gets or sets the maximum number of compute units available on this accelerator. For GPUs, this typically represents streaming multiprocessors or compute units. For CPUs, this represents the number of CPU cores or logical processors.
public int MaxComputeUnits { get; init; }
Property Value
MaxMemoryAllocationSize
Gets or sets the maximum memory allocation size in bytes.
public long MaxMemoryAllocationSize { get; init; }
Property Value
MaxSharedMemoryPerBlock
Gets or sets the maximum shared memory per block in bytes.
public long MaxSharedMemoryPerBlock { get; init; }
Property Value
MaxThreadExecutionWidth
Gets the maximum thread execution width for Metal GPUs. This represents the SIMD width of the GPU (typically 32 for Apple GPUs).
public int MaxThreadExecutionWidth { get; }
Property Value
MaxThreadsPerBlock
Gets or sets the maximum threads per block.
public int MaxThreadsPerBlock { get; init; }
Property Value
MaxThreadsPerThreadgroup
Gets the maximum threads per threadgroup for Metal GPUs. This is equivalent to MaxThreadsPerBlock but uses Metal terminology.
public int MaxThreadsPerThreadgroup { get; }
Property Value
MaxWorkGroupSize
Gets or sets the maximum work group size (alias for MaxThreadsPerBlock).
public int MaxWorkGroupSize { get; init; }
Property Value
MaxWorkItemDimensions
Gets the maximum work-item dimensions supported by this accelerator. This is typically 3 (x, y, z) for most modern GPUs.
public int MaxWorkItemDimensions { get; init; }
Property Value
Remarks
This determines how many dimensions you can use when launching kernels. Most GPU compute APIs support 3D work-item grids (x, y, z).
MemorySize
Gets or sets the total device memory in bytes (alias for TotalMemory).
public long MemorySize { get; }
Property Value
MinorVersion
Gets the compute capability minor version. For CUDA: The minor version of compute capability (e.g., 6 for CC 8.6). For other backends: Derived from ComputeCapability or default to 0.
public int MinorVersion { get; }
Property Value
Name
Gets or sets the friendly name of this device.
public required string Name { get; init; }
Property Value
RecommendedMaxWorkingSetSize
Gets the recommended maximum working set size for Metal unified memory. This represents the optimal amount of memory to use for best performance.
public ulong RecommendedMaxWorkingSetSize { get; }
Property Value
SupportsFloat64
Gets or sets whether this accelerator supports double-precision (64-bit) floating-point operations. This is important for scientific computing applications requiring high precision.
public bool SupportsFloat64 { get; init; }
Property Value
SupportsInt64
Gets or sets whether this accelerator supports 64-bit integer operations. This affects the availability of long and ulong data types in compute kernels.
public bool SupportsInt64 { get; init; }
Property Value
TotalMemory
Gets or sets the total device memory in bytes.
public long TotalMemory { get; init; }
Property Value
Type
Gets or sets the device type for legacy compatibility.
public string Type { get; }
Property Value
Vendor
Gets or sets the vendor name.
public required string Vendor { get; init; }
Property Value
WarpSize
Gets the warp/wavefront size for this accelerator.
- NVIDIA CUDA: 32 threads
- AMD ROCm: 64 threads (wavefront)
- Intel: 8-32 threads (SIMD width)
- CPU: 1 (no warp concept)
public int WarpSize { get; init; }
Property Value
Remarks
This is critical for optimizing memory access patterns and thread synchronization. Applications should align thread block sizes to multiples of WarpSize for optimal performance.