Class IAcceleratorExtensions
- Namespace
- DotCompute.Core.Extensions
- Assembly
- DotCompute.Core.dll
Extension methods for IAccelerator to provide backward compatibility and additional properties required by tests and legacy code.
public static class IAcceleratorExtensions
- Inheritance
-
IAcceleratorExtensions
- Inherited Members
Methods
CreateStream(IAccelerator)
Creates a new compute execution context for asynchronous operations. For CUDA accelerators, this creates a CUDA stream. For other accelerators, returns a stub implementation.
[UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "Dynamic method lookup for accelerator-specific CreateStream method is intentional")]
public static IComputeExecution CreateStream(this IAccelerator accelerator)
Parameters
acceleratorIAcceleratorThe accelerator instance.
Returns
- IComputeExecution
A compute execution context for the accelerator.
Description(IAccelerator)
Gets the accelerator description by combining vendor and device type.
public static string Description(this IAccelerator accelerator)
Parameters
acceleratorIAcceleratorThe accelerator instance.
Returns
- string
The accelerator description.
GetMemoryInfoAsync(IAccelerator)
Gets memory information for the accelerator.
public static ValueTask<MemoryInfo> GetMemoryInfoAsync(this IAccelerator accelerator)
Parameters
acceleratorIAcceleratorThe accelerator instance.
Returns
- ValueTask<MemoryInfo>
A task returning memory information.
GetPerformanceMetrics(IAccelerator)
Gets performance metrics for the accelerator. This provides a consistent interface for performance monitoring across all accelerator types.
[UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "Dynamic method lookup for accelerator-specific GetPerformanceMetrics method is intentional")]
public static IPerformanceMetrics GetPerformanceMetrics(this IAccelerator accelerator)
Parameters
acceleratorIAcceleratorThe accelerator instance.
Returns
- IPerformanceMetrics
Performance metrics for the accelerator.
IsAvailable(IAccelerator)
Gets whether the accelerator is available for use. This is a simplified check that assumes the accelerator is available if it can be accessed.
public static bool IsAvailable(this IAccelerator accelerator)
Parameters
acceleratorIAcceleratorThe accelerator instance.
Returns
- bool
True if the accelerator is available, false otherwise.
IsDisposed(IAccelerator)
Determines if the accelerator has been disposed. Since IAccelerator implements IAsyncDisposable, we can't directly check disposal status. This provides a reasonable assumption for test compatibility.
public static bool IsDisposed(this IAccelerator accelerator)
Parameters
acceleratorIAccelerator
Returns
Name(IAccelerator)
Gets the accelerator name from the Info property.
public static string Name(this IAccelerator accelerator)
Parameters
acceleratorIAcceleratorThe accelerator instance.
Returns
- string
The accelerator name.
SupportsFeature(IAccelerator, string)
Checks if the accelerator supports a specific feature.
public static bool SupportsFeature(this IAccelerator accelerator, string feature)
Parameters
acceleratorIAcceleratorThe accelerator instance.
featurestringThe feature to check.
Returns
- bool
True if the feature is supported, false otherwise.