Class CommandQueueOptions
- Namespace
- DotCompute.Abstractions.Models.Device
- Assembly
- DotCompute.Abstractions.dll
Configuration options for command queue creation. Provides settings to control command queue behavior, performance characteristics, and execution properties when creating command queues for compute devices.
public sealed class CommandQueueOptions
- Inheritance
-
CommandQueueOptions
- Inherited Members
Remarks
Command queues are used to manage the execution of compute operations on devices. These options allow fine-tuning of queue behavior for optimal performance based on specific use cases and hardware capabilities.
Constructors
CommandQueueOptions()
Initializes a new instance of the CommandQueueOptions class with default settings.
public CommandQueueOptions()
Remarks
Creates options with profiling disabled, in-order execution enabled, and normal priority. These settings provide a good balance between performance and predictability for most use cases.
CommandQueueOptions(bool, bool, QueuePriority)
Initializes a new instance of the CommandQueueOptions class with the specified configuration.
public CommandQueueOptions(bool enableProfiling, bool enableOutOfOrderExecution, QueuePriority priority)
Parameters
enableProfilingboolWhether to enable profiling.
enableOutOfOrderExecutionboolWhether to enable out-of-order execution.
priorityQueuePriorityThe queue priority level.
Remarks
This constructor allows explicit configuration of all queue options in a single call, providing a convenient way to create customized queue configurations.
Properties
Default
Gets the default command queue options.
public static CommandQueueOptions Default { get; }
Property Value
- CommandQueueOptions
A CommandQueueOptions instance with default settings: profiling disabled, in-order execution, and normal priority.
Remarks
This provides a convenient way to obtain standard options without explicitly creating and configuring a new instance. The default options are suitable for most general-purpose scenarios.
EnableOutOfOrderExecution
Gets or sets whether to enable out-of-order execution for the command queue.
public bool EnableOutOfOrderExecution { get; set; }
Property Value
- bool
trueto allow commands to execute out of order when dependencies permit, potentially improving performance; otherwise,falsefor strict in-order execution. Default isfalse.
Remarks
Out-of-order execution can improve performance by allowing independent operations to run concurrently. However, it requires careful consideration of data dependencies and may complicate debugging. Use barriers or explicit synchronization when needed.
EnableProfiling
Gets or sets whether to enable profiling for the command queue.
public bool EnableProfiling { get; set; }
Property Value
- bool
trueto enable profiling, which allows measuring execution times and performance metrics for queued operations; otherwise,false. Default isfalse.
Remarks
Enabling profiling may introduce slight performance overhead but provides valuable timing information for optimization purposes. This is particularly useful during development and performance tuning phases.
Priority
Gets or sets the priority level for the command queue.
public QueuePriority Priority { get; set; }
Property Value
- QueuePriority
A QueuePriority value indicating the execution priority. Default is Normal.
Remarks
Higher priority queues may receive preferential scheduling by the device driver, but the actual behavior depends on the underlying compute platform and device capabilities. Not all devices support priority-based scheduling.
Methods
Clone()
Creates a copy of this CommandQueueOptions instance.
public CommandQueueOptions Clone()
Returns
- CommandQueueOptions
A new CommandQueueOptions instance with the same settings as the current instance.
Remarks
This method performs a shallow copy of the options, creating an independent instance that can be modified without affecting the original.
Equals(object?)
Determines whether the specified object is equal to the current instance.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
trueif the specified object is equal to the current instance; otherwise,false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
ToString()
Returns a string representation of the command queue options.
public override string ToString()
Returns
- string
A string containing the current option values in a readable format.
Operators
operator ==(CommandQueueOptions?, CommandQueueOptions?)
Determines whether two CommandQueueOptions instances are equal.
public static bool operator ==(CommandQueueOptions? left, CommandQueueOptions? right)
Parameters
leftCommandQueueOptionsThe first instance to compare.
rightCommandQueueOptionsThe second instance to compare.
Returns
- bool
trueif the instances are equal; otherwise,false.
operator !=(CommandQueueOptions?, CommandQueueOptions?)
Determines whether two CommandQueueOptions instances are not equal.
public static bool operator !=(CommandQueueOptions? left, CommandQueueOptions? right)
Parameters
leftCommandQueueOptionsThe first instance to compare.
rightCommandQueueOptionsThe second instance to compare.
Returns
- bool
trueif the instances are not equal; otherwise,false.