This change adds a new execution provider powered by [DirectML](https://aka.ms/DirectML). DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning on Windows. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported hardware and drivers. The DirectML execution provider is capable of greatly improving evaluation time of models using commodity GPU hardware, without sacrificing broad hardware support or requiring vendor-specific extensions to be installed. **Note** that the DML EP code was moved verbatim from the existing WindowsAI project, which is why it doesn't yet conform to the onnxruntime coding style. This is something that can be fixed later; we would like to keep formatting/whitespace changes to a minimum for the time being to make it easier to port fixes from WindowsAI to ORT during this transition. Summary of changes: * Initial commit of DML EP files under onnxruntime/core/providers/dml * Add cmake entries for building the DML EP and for pulling down the DirectML redist using nuget * Add a submodule dependency on the Windows Implementation Library (WIL) * Add docs under docs/execution_providers/DirectML-ExecutionProvider.md * Add support for DML EP to provider tests and perf tests * Add support for DML EP to fns_candy_style_transfer sample * Add entries to the C ABI for instantiating the DML EP |
||
|---|---|---|
| .. | ||
| fns_candy_style_transfer | ||
| imagenet | ||
| include | ||
| MNIST | ||
| CMakeLists.txt | ||
| README.md | ||
| vs.png | ||
This directory contains a few C/C++ sample applications for demoing onnxruntime usage:
- fns_candy_style_transfer: A C application that uses the FNS-Candy style transfer model to re-style images.
- MNIST: A windows GUI application for doing handwriting recognition
- imagenet: An end-to-end sample for the ImageNet Large Scale Visual Recognition Challenge 2012
How to build
Prerequisites
- Visual Studio 2015/2017/2019
- cmake(version >=3.13)
- (optional) libpng 1.6
You may get a precompiled libpng library from https://onnxruntimetestdata.blob.core.windows.net/models/libpng.zip
Install ONNX Runtime
You may either get a prebuit onnxruntime from nuget.org, or build it from source by following the BUILD.md document. If you build it by yourself, you must append the "--build_shared_lib" flag to your build command. Like:
build.bat --config RelWithDebInfo --build_shared_lib --parallel
When the build is done, run Visual Studio as administrator and open the onnxruntime.sln file in your build directory.

When the solution is loaded, change the build configuration to "RelWithDebInfo"(which must match your previous build command), then select the "INSTALL" project, and build it. It will install your onnxruntime to "C:\Program Files (x86)\onnxruntime"
Build the samples
Open cmd.exe, change your current directory to samples\c_cxx, then run
mkdir build
cmake .. -A x64 -T host=x64 -DLIBPNG_ROOTDIR=C:\path\to\your\libpng\binary
You may omit the "-DLIBPNG_ROOTDIR=..." argument if you don't have the libpng library.
You may append "-Donnxruntime_USE_CUDA=ON" or "-Donnxruntime_USE_DML=ON" to the last command args if your onnxruntime binary was built with CUDA or DirectML support respectively.
Then you can open the onnxruntime_samples.sln file in the "build" directory and build the solution.