IDMLBindingTable interface (directml.h)
Wraps a range of an application-managed descriptor heap, and is used by DirectML to create bindings for resources. To create this object, call IDMLDevice::CreateBindingTable. The IDMLBindingTable interface inherits from IDMLDeviceChild.
The binding table is created over a range of CPU and GPU descriptor handles. When an IDMLBindingTable::Bind* method is called, DirectML writes one or more descriptors into the range of CPU descriptors. When you use the binding table during a call to IDMLCommandRecorder::RecordDispatch, DirectML binds the corresponding GPU descriptors to the pipeline.
The CPU and GPU descriptor handles aren't required to point to the same entries in a descriptor heap, however it is then your application's responsibility to ensure that the entire descriptor range referred to by the CPU descriptor handle is copied into the range referred to by the GPU descriptor handle prior to execution using this binding table.
It is your application's responsibility to perform correct synchronization between the CPU and GPU work that uses this binding table. For example, you must take care not to overwrite the bindings created by the binding table (for example, by calling Bind* again on the binding table, or by overwriting the descriptor heap manually) until all work using the binding table has completed execution on the GPU. In addition, since the binding table doesn't maintain a reference on the descriptor heap it writes into, you must not release the backing shader-visible descriptor heap until all work using that binding table has completed execution on the GPU.
The binding table is associated with exactly one dispatchable object (an operator initializer, or a compiled operator), and represents the bindings for that particular object. You can reuse a binding table by calling IDMLBindingTable::Reset, however. Note that since the binding table doesn't own the descriptor heap itself, it is safe to call Reset and reuse the binding table for a different dispatchable object even before any outstanding executions have completed on the GPU.
The binding table doesn't keep strong references on any resources bound using it—your application must ensure that resources are not deleted while still in use by the GPU.
This object is not thread safe—your application must not call methods on the binding table simultaneously from different threads without synchronization.
Inheritance
The IDMLBindingTable interface inherits from the IDMLDeviceChild interface.
Methods
The IDMLBindingTable interface has these methods.
IDMLBindingTable::BindInputs Binds a set of resources as input tensors. |
IDMLBindingTable::BindOutputs Binds a set of resources as output tensors. |
IDMLBindingTable::BindPersistentResource Binds a buffer as a persistent resource. You can determine the required size of this buffer range by calling IDMLDispatchable::GetBindingProperties. |
IDMLBindingTable::BindTemporaryResource Binds a buffer to use as temporary scratch memory. You can determine the required size of this buffer range by calling IDMLDispatchable::GetBindingProperties. |
IDMLBindingTable::Reset Resets the binding table to wrap a new range of descriptors, potentially for a different operator or initializer. This allows dynamic reuse of the binding table. |
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | directml.h |