IDMLCompiledOperator interface (directml.h)

Represents a compiled, efficient form of an operator suitable for execution on the GPU. To create this object, call IDMLDevice::CompileOperator. The IDMLCompiledOperator interface inherits from IDMLDispatchable.

Unlike IDMLOperator, compiled operators are "baked", and can be executed directly by the GPU. After an operator is compiled, you must initialize it exactly once before it can be executed. It's an error to initialize an operator more than once. Operator initializers are used to initialize compiled operators. You can use IDMLCommandRecorder::RecordDispatch to record the dispatch of an operator initializer which, when executed on the GPU, will initialize one or more operators.

In addition to input and output tensors, operators may require additional memory for execution. This additional memory must be provided by your application in the form of temporary and persistent resources.

A temporary resource is scratch memory that is only used during the execution of the operator, and doesn't need to persist after the call to IDMLCommandRecorder::RecordDispatch completes on the GPU. This means that your application may release or overwrite the temporary resource in between dispatches of the compiled operator. In contrast, the persistent resource must live at least until the last execute of the operator has completed on the GPU. Additionally, the contents of the persistent resource are opaque and must be preserved between executions of the operator.

The size of the temporary and persistent resources varies per operator. Call IDMLDispatchable::GetBindingProperties to query the required size, in bytes, of the persistent and temporary resources for this compiled operator. See IDMLBindingTable::BindTemporaryResource and IDMLBindingTable::BindPersistentResource for more information on binding temporary and persistent resources.

All methods on this interface are thread-safe.

Inheritance

The IDMLCompiledOperator interface inherits from the IDMLDispatchable interface.

Requirements

Requirement Value
Target Platform Windows
Header directml.h

See also

Binding in DirectML

IDMLDispatchable