IDMLBindingTable::BindInputs method

Binds a set of resources as input tensors.

If binding for a compiled operator, the number of bindings must exactly match the number of inputs of the operator, including optional tensors. This can be determined from the operator description used to create the operator. If too many or too few bindings are provided, device removal will occur. For optional tensors, you may use DML_BINDING_TYPE_NONE to specify 'no binding'. Otherwise, the binding type must match the tensor type when the operator was created.

For operator initializers, input bindings are expected to be of type DML_BINDING_TYPE_BUFFER_ARRAY with one input binding per operator to initialize, supplied in the order that you specified the operators during creation or reset of the initializer. Each buffer array should have a size equal to the number of inputs of its corresponding operator to initialize. Input tensors that had the DML_TENSOR_FLAG_OWNED_BY_DML flag set should be bound during initialize—otherwise, nothing should be bound for that tensor. If there is nothing to be bound as input for initialization of an operator (that is, there are no tensors with the DML_TENSOR_FLAG_OWNED_BY_DML flag set) then you may supply nullptr or an empty DML_BUFFER_ARRAY_BINDING to indicate 'no binding'.

To unbind all input resources, supply a rangeCount of 0, and a value of nullptr for bindings.

If an input tensor has the DML_TENSOR_FLAG_OWNED_BY_DML flag set, it may only be bound when executing an operator initializer. Otherwise, if the DML_TENSOR_FLAG_OWNED_BY_DML flag is not set, the opposite is true—the input tensor must not be bound when executing the initializer, but must be bound when executing the operator itself.

All buffers being bound as input must have heap type D3D12_HEAP_TYPE_DEFAULT, except when the DML_TENSOR_FLAG_OWNED_BY_DML flag is set. If the DML_TENSOR_FLAG_OWNED_BY_DML is set for a tensor that is being bound as input for an initializer, the buffer's heap type may be either D3D12_HEAP_TYPE_DEFAULT or D3D12_HEAP_TYPE_UPLOAD.

Each binding is not required to point to a unique resource. It is legal, for example, to supply all inputs as suballocations from the same Direct3D 12 buffer resource. Ranges for inputs are permitted to overlap. No Direct3D 12 resource bound for input may simultaneously be bound for output, except if the operator explicitly permits in-place execution. If using in-place execution, the input and output tensors must have the exact same sizes, strides, and total tensor size. Additionally, the input and output bindings must have the exact same offset size.

Syntax

void BindInputs(
  UINT                   bindingCount,
  const DML_BINDING_DESC *bindings
);

Parameters

bindingCount

Type: UINT

This parameter determines the size of the bindings array (if provided).

bindings

Type: const DML_BINDING_DESC*

An optional pointer to a constant array of DML_BINDING_DESC containing descriptions of the tensor resources to bind.

Return Value

This method doesn't return a value.

Requirements

   
Target Platform Windows
Header directml.h
Library DirectML.lib
DLL DirectML.dll

See Also

Binding in DirectML

IDMLBindingTable