microsoft / DirectML

DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported hardware and drivers, including all DirectX 12-capable GPUs from vendors such as AMD, Intel, NVIDIA, and Qualcomm.
MIT License
2.19k stars 290 forks source link

Device support #468

Open RoySegal opened 1 year ago

RoySegal commented 1 year ago

Hello,

I would like to learn how to add a new proprietary AI processor capabilities under DirectML.

As far as I understand, the current support is for Direct3D, DirectX 12 devices, which means GPUs only.

DirectML official documentation is stating:

DirectML requires a DirectX 12 capable device. Almost all commercially-available graphics cards released in the last several years support DirectX 12.

I also found the following in the official documentation of WindowsML:

Windows ML (WinML) is a high-performance, reliable API for deploying hardware-accelerated ML inferences on Windows devices. DirectML provides the GPU backend for Windows ML.

However, my intention is to add a new AI processor device (and not a display device), which I want to support in order for others to be able to use WindowsML for NN deployment over my AI processor.

Does implementing DirectML API is the right way to go? If so, can you please direct me to the relevant APIs?

If not, what is the right layer I should interface to?

Many thanks, Roy

jstoecker commented 1 year ago

The interface layers are DirectML -> Direct3D 12 -> WDDM/MCDM -> Hardware Driver -> Hardware. Supporting a new DirectX-visible hardware device means providing drivers that implement either WDDM or MCDM:

If you are able to implement MCDM for your AI processor, then DirectML should simply work out of the box. Of course, custom silicon often means unique constraints, and I don't want to trivialize the effort required here. Implementing a compliant driver is not a small task, so I suggest e-mailing us askdirectml@microsoft.com if you want to discuss this in more depth!

RoySegal commented 1 year ago

Thank you for the quick and elaborate reply. I will definitely look into MCDM which is much more suitable for this usecase. To your knowledge - are there any non-GPU devices currently supported by DirectML? Alternatively - are these devices using the MCDM?

Again, your help is appreciated.

jstoecker commented 1 year ago

Yes, one example of a non-GPU device that works with DirectML is "Intel’s new neural VPU - a dedicated, power efficient hardware block focused on AI acceleration at low power which is integrated into the upcoming Meteor Lake platform." See https://community.intel.com/t5/Blogs/Tech-Innovation/Client/New-AI-Engine-Delivers-Power-Efficient-AI-with-DirectML/post/1489703.