Environment Variables - microsoft/tensorflow-directml GitHub Wiki

TensorFlow-DirectML Environment Variables

The table below summarizes the environment variables that are specific to the DirectML fork of TensorFlow. These variables are not expected to be useful for most users and are primarily for development and testing.

Variable Name Definition
TF_DIRECTML_PATH Overrides the search path used to locate the DirectML library. The value must be the path to a directory containing DirectML.dll (Windows) or libdirectml.so (WSL).

Default value: None (load DirectML using normal search order rules)
TF_DIRECTML_BATCH_FLUSH_SIZE Overrides the maximum number of D3D commands that may be batched in a command list before it is submitted to a hardware queue for execution.

Default value: "100"
TF_DIRECTML_BATCH_FLUSH_TIME Overrides the maximum duration (in microseconds) to wait before flushing any D3D command that may be batched in a command list.

Default value: "1000" (1 millisecond)
TF_DIRECTML_MAX_ALLOC_SIZE Overrides the maximum size, in bytes, of a single contiguous allocation made by the DirectML allocator. Keep in mind this limits the size of any single tensor.

Default value: "4293918720" (~4GB)
TF_DIRECTML_FORCE_PLACED_RESOURCES Overrides the preference for using D3D tiled resources when allocating DirectML resources. Setting this to "true" will force most allocations to instead used D3D placed resources. The default behavior of the allocator is used reserved resource unless the hardware does not support this feature.

Default value: "false"
TF_DIRECTML_MAX_HEAP_TILES Overrides the limit on the number of D3D tiles per heap when using tiled resources. Each tile is 64KB in size. A higher value will result in memory allocations comprising more contiguous physical memory; however, this may also prevent allocations from utilizing available local video memory.

Default value: "512" (32MB per heap)
TF_DIRECTML_KERNEL_CACHE_SIZE Overrides the limit on the number of DirectML kernels that may be cached. Increasing this value may improve performance in models with a large number of unique operators: constructing DirectML kernels typically involves expensive operations such as compiling shader bytecode. However, a too-large cache may be wasteful in memory.

Default value: "1024"
⚠️ **GitHub.com Fallback** ⚠️