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.22k stars 297 forks source link

Propose to make the device wrapper of PyDirectML for C++ sample usage #84

Open huningxin opened 3 years ago

huningxin commented 3 years ago

The device wrapper of Python samples is a quite good helper for DirectML device and resource management. I propose to make it also useful for C++ sample, e.g. HelloDirectML . That would simplify the C++ sample and improve the code reuse.

Any thoughts?

jstoecker commented 3 years ago

It's an interesting suggestion! I believe the original intent with HelloDirectML was to write the shortest possible code sample, without any superfluous code, that does a step-by-step walk-through of the stages of initializing and executing a single operator. I personally agree that this sample could be cleaned up a bit, though it's tricky to introduce abstractions here without muddying key concepts like binding, operator initialization, and operator dispatching. The style of abstractions that work best really depend on the application.

huningxin commented 3 years ago

Probably HelloDirectML could have two code paths that illustrate both the step-by-step and the abstract ways. Just like it uses USE_DMLX for graph building.