IDMLBindingTable::BindTemporaryResource method

Binds a buffer to use as temporary scratch memory. You can determine the required size of this buffer range by calling IDMLDispatchable::GetBindingProperties.

If the binding properties for the IDMLDispatchable specify a size of zero for the temporary resource, then you may supply nullptr to this method (which indicates no resource to bind). Otherwise, a binding of type DML_BINDING_TYPE_BUFFER must be supplied that is at least as large as the required TemporaryResourceSize returned by IDMLDispatchable::GetBindingProperties.

The temporary resource is typically used as scratch memory during execution of an operator. The contents of a temporary resource need not be defined prior to execution. For example, DirectML doesn't require that you zero the contents of the temporary resource prior to binding or executing an operator.

You don't need to preserve the contents of the temporary buffer, and your application is free to overwrite or reuse its contents as soon as execution of an operator or initializer completes on the GPU. This is in contrast to a persistent resource, whose contents must be preserved and lifetime extended for the lifetime of the operator.

The supplied buffer range to be bound as the temporary buffer must have its start offset aligned to DML_TEMPORARY_BUFFER_ALIGNMENT. The type of the heap underlying the buffer must be D3D12_HEAP_TYPE_DEFAULT.

Syntax

void BindTemporaryResource(
  const DML_BINDING_DESC *binding
);

Parameters

binding

Type: const DML_BINDING_DESC*

An optional pointer to a DML_BINDING_DESC containing the description of a tensor resource to bind.

Return Value

This method does not return a value.

Requirements

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

See Also

Binding in DirectML

IDMLBindingTable