Skip to main content
The DirectML execution provider enables GPU acceleration across NVIDIA, AMD, and Intel GPUs on Windows platforms using the DirectX 12 API.

Requirements

Hardware

  • DirectX 12 capable GPU
  • Supported vendors:
    • NVIDIA (GeForce, Quadro, Tesla)
    • AMD (Radeon, Instinct)
    • Intel (Arc, Iris)
    • Qualcomm (Adreno)

Software

  • Windows 10 (version 1903 or later) or Windows 11
  • DirectX 12 runtime
  • Updated GPU drivers
DirectML is Windows-only and provides cross-vendor GPU support without vendor-specific SDKs.

Installation

Basic Configuration

Python API

genai_config.json

GPU Selection

Automatic Selection

By default, DirectML selects the primary GPU. To choose a specific GPU:

Device Filtering

Filter GPUs by hardware characteristics:
Vendor IDs:
  • NVIDIA: 4318 (0x10DE)
  • AMD: 4098 (0x1002)
  • Intel: 32902 (0x8086)

Windows ML Integration

Use Windows ML for automatic device selection:

Memory Management

D3D12 Resource Management

DirectML uses D3D12 resources for GPU memory:

Upload and Readback Heaps

DirectML uses specialized heaps for CPU-GPU transfers:
  • Upload Heap: Transfers data from CPU to GPU
  • Readback Heap: Transfers results from GPU to CPU

Configuration Options

Session Options

Performance Preferences

Optimizes for maximum throughput at the cost of power consumption.

Advanced Features

Command Queue Management

DirectML manages GPU command queues for efficient execution:

Synchronization

DirectML operations are asynchronous. The provider handles synchronization internally:

Multi-GPU Support

DirectML can be configured to use specific GPUs in multi-GPU systems:

Troubleshooting

DirectML Not Available

Performance Issues

Ensure you have the latest GPU drivers installed:
  • NVIDIA: GeForce Experience or nvidia.com
  • AMD: Adrenalin Software
  • Intel: Intel Driver & Support Assistant
Verify DirectX 12 is available under Display tab.

Memory Errors

Comparison with Other Providers

Best Practices

Model Selection

Use FP16 models when available for better performance on modern GPUs.

Batch Processing

Keep batch sizes small (1-4) for optimal latency on consumer GPUs.

Driver Updates

Regularly update GPU drivers for best DirectML compatibility.

Power Settings

Set Windows power plan to “High Performance” for optimal GPU utilization.

Next Steps

Windows ML Integration

Learn about Windows ML device selection

Performance Tuning

Optimize DirectML performance