What Is DirectML? Choosing a DirectX 12 Inference Path and Windows ML
DirectML (Direct Machine Learning) is a low-level GPU API that lets Windows apps run machine-learning inference on Direct3D 12 devices. It fits game engines and real-time apps that need to connect inference directly to graphics resources and commands, but the app must manage the model operations, tensor memory, and execution order. Microsoft says DirectML remains supported while new feature development has moved to Windows ML, so new ONNX apps should compare the current provider-selection path as well.
What Is DirectML? Choosing a DirectX 12 Inference Path and Windows ML
DirectML (Direct Machine Learning) is a low-level GPU API that lets Windows apps run machine-learning inference on Direct3D 12 devices. It fits game engines and real-time apps that need to connect inference directly to graphics resources and commands, but the app must manage the model operations, tensor memory, and execution order. Microsoft says DirectML remains supported while new feature development has moved to Windows ML, so new ONNX apps should compare the current provider-selection path as well.
What DirectML does—and leaves to the app
Inference runs input data through operations to produce a prediction or transformed output. An image-restoration model, for example, may apply convolution, activation, and addition operations in sequence. DirectML is a library of hardware-accelerated operators for running such work on a GPU. It has a native C++ nano-COM interface in the DirectX 12 style and broad support across DirectX 12-compatible devices. That does not mean every model, operator, data type, or tensor shape runs automatically: check the support conditions for the exact operations and target device.
DirectML is not a complete model runtime that loads a model from a training framework and runs it as-is. The app represents the model as operators or a graph, uploads weights into Direct3D 12 resources, and binds tensor inputs and outputs to those resources. The app also owns device and operator creation, memory allocation, resource binding, command-list recording, GPU synchronization, and resource lifetime. A helper such as DirectMLX can make C++ graph composition shorter, but does not remove the underlying DirectML and Direct3D 12 constraints. DirectML overview DirectMLX graphs
When to choose raw DirectML, ONNX Runtime, or Windows ML
These paths provide different levels of abstraction. Raw DirectML suits apps that need to schedule GPU work alongside rendering. If the model is already ONNX, the ONNX Runtime DirectML execution provider (EP) avoids assembling D3D12 operators by hand. Current Windows ML is Microsoft's ONNX Runtime distribution and provider-selection layer for Windows apps. Its current documentation lists CPU and legacy DirectML as included providers. Some hardware-specific providers can be downloaded on Windows 11 24H2 (build 26100) or later when the device and driver are compatible. Availability also depends on the Windows ML app/API version. Windows ML overview Windows ML execution providers
| Path | Consider it first when | Check before deciding |
|---|---|---|
| DirectML API directly | Inference must sit inside D3D12 rendering or compute work, with direct control over resources and command order | Cost of translating the model into an operator graph; operator/tensor-format support; app-managed synchronization and memory ownership |
| ONNX Runtime + DirectML EP | An existing ONNX Runtime app needs GPU execution with DirectML compatibility | Supported ONNX operators, versions, shapes, and execution options for the target provider. DirectML remains supported, but is in sustained engineering for new feature work |
| Current Windows ML + ONNX Runtime | A Windows app should keep ONNX APIs while selecting and installing providers for the device | Windows ML API/deployment mode, compatible OS, and provider catalog, licenses, and driver requirements. DirectML is the included legacy path |
Do not choose DirectML for a new app solely because it supports DirectX 12 GPUs. Microsoft's support and version-history pages say it remains supported, while new feature development for Windows ONNX Runtime deployments has moved to Windows ML. An existing app can keep DirectML when compatibility and operating cost justify it. For new models and hardware acceleration, first evaluate Windows ML and the dedicated providers currently available for the target devices. No provider is guaranteed to be faster for every device or model, so measure under matching conditions. DirectML version history
Follow an image-restoration example through the execution path
The following is an illustrative scenario. A game produces a low-resolution frame, uses a neural network to sharpen it, and passes the resulting texture to the next rendering stage. With raw DirectML, the app must fit the model execution into its graphics resources and command flow. Microsoft also describes upscaling and denoising as DirectML use cases that can be integrated with D3D12 rendering. DirectML overview and workflow
**Fix the target and model requirements.** Set the Windows/SDK, DirectML runtime, GPU, and driver range. Record the model's input/output shapes, operators, tensor types, and layouts, then check that exact combination. If the app needs to load an ONNX file directly, evaluate ONNX Runtime or Windows ML first.
**Create the D3D12 device and DirectML operators.** Set up the Direct3D 12 device, command queue, and command list, then create the DirectML device and operator instances. Match operator parameters, such as convolution filter size and input/output tensor descriptions, to the model. Choose layer-by-layer execution or a graph of operator nodes and tensor edges.
**Bind weights and frames to GPU resources.** Prepare the trained weights and low-resolution frame as D3D12 resources. Bind them with sizes, layouts, and resource states that match the tensor descriptions; add the correct resource barriers when access changes, such as from writing to reading. Do not release resources or DirectML objects while the GPU still uses them.
**Record commands and synchronize before using the result.** Record operator bindings and execution in a command list, then submit it to the queue. Do not read or reuse the output texture before GPU work completes. Once completion is known, pass the restored frame to the next rendering stage.
**Verify quality and total cost.** Compare output against an expected result on supported target GPUs and drivers. Check image-quality tolerance, variable input sizes, and memory use. Measure the full frame latency, including copies, synchronization waits, graph initialization, and interference with rendering—not just operator time.
Layer-by-layer execution makes it easier to interleave rendering and inference commands and control memory flow, but the app manages more ordering and bindings. Graph execution describes the model as nodes and edges, reducing connection work and letting DirectML organize execution, but provides less direct control over command placement. Neither is always faster. DirectML layer-by-layer and graph workflows
What to check before adopting, keeping, or migrating
DirectML is strongest when a product needs low-level GPU control and the team already works with DirectX 12. If the app mainly runs ONNX models and has no reason to manage GPU commands or weight memory directly, an execution-provider path can reduce the implementation burden. An existing DirectML app does not need to be replaced just because it uses DirectML; when adding features, reassess maintenance cost, model compatibility, and the Windows versions you ship.
**Platform scope:** Set the target OS, Windows SDK, DirectML package, GPU, and driver combination, and verify each. DirectML has shipped as a Windows system component since Windows 10 version 1903; a separately redistributable package has been available since 1.4.0. Confirm the deployment contract for the runtime your app uses. [DirectML version and distribution history](https://learn.microsoft.com/en-us/windows/ai/directml/dml-version-history)
**Model compatibility:** Check every operator, type, tensor dimension, and layout against the selected provider's documentation. “Runs on most DirectX 12 GPUs” is not the same as “every model runs without conversion.”
**Quality and memory:** Use representative and boundary inputs to verify output quality, accuracy, and memory needs. If conversion or a format change moves accuracy outside the acceptable range, consider the original format, another model path, or CPU execution.
**Measurement:** Measure first-run and repeated-run behavior on actual target devices. Confirm that inference uses the GPU and separate initialization, copies, waits, rendering, and resource contention. If performance disappoints, first reduce unnecessary copies and synchronization, then compare another provider under the same conditions.
**Recovery path:** If the model/operator/provider combination is unsupported or not reproducible on deployment devices, do not force it as the default. Isolate the cause with a reproducible minimal model, then adjust the model to supported operations or move to a compatible Windows ML provider, CPU execution, or another runtime. Check the runtime-version documentation for each provider's fallback and partitioning behavior.
The Windows ML provider catalog does not validate model accuracy or guarantee acceleration on a particular device. Windows ML supplies ONNX Runtime APIs and provider management; results and speed still depend on the model, provider, hardware, and driver. This platform comparison reflects documentation read on 2026-11-23. Recheck the current provider list before deployment because support status and requirements can change. Get started with Windows ML
Sources
[Microsoft Learn, DirectML overview](https://learn.microsoft.com/en-us/windows/ai/directml)
[Microsoft Learn, DirectML version history](https://learn.microsoft.com/en-us/windows/ai/directml/dml-version-history)
[Microsoft Learn, DirectMLX graph helper](https://learn.microsoft.com/en-us/windows/ai/directml/dml-directmlx)
[Microsoft Learn, Windows ML overview](https://learn.microsoft.com/en-us/windows/ai/new-windows-ml/overview)
[Microsoft Learn, Windows ML execution providers](https://learn.microsoft.com/en-us/windows/ai/new-windows-ml/supported-execution-providers)
[Microsoft Learn, Get started with Windows ML](https://learn.microsoft.com/en-us/windows/ai/new-windows-ml/get-started)
[ONNX Runtime, DirectML Execution Provider](https://onnxruntime.ai/docs/execution-providers/DirectML-ExecutionProvider.html)
[ONNX Runtime, Execution Providers](https://onnxruntime.ai/docs/execution-providers/)