You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For NPU Sample, add flexibility in device creation options and fix Generic ML Device logic (#624)
* For NPU Sample, add flexibility in device creation options and fix Generic ML Device logic Expand NPU sample's capabilities for creating devices based on attributes. More specifically, allow options to filter based on allowed, unallowed, and required attributes. Then add some flags for the most commonly needed options for this sample. The logic for how each interacts with CreateAdapterList is a bit unconventional since CreateAdapterList ANDs the passed in attributes. Tested locally on Intel NPU. * Fix comment typo in NPU Sample * Set D3D Feature Level Requirement to Generic, Optimize Adapter Selection * Add flags to filter for GENERIC_ML only without COMPUTE * Improve labelling of flags & lists for developer friendliness * Minor smaller PR feedback in comments & loop optimization * address initial PR feedback * Simplify adapter discovery logic * Update Package Versions, Simplify Device-Querying Logic * Address PR feedback * Additional PR feedback * Improve documentation to add context for NPU creation * minor fix to sample output * Address Initial PR feedback * Create adapter under COMPUTE feature level if CORE adapters are not availible * Add comments noting that HMODULEs should be freed after usage --------- Co-authored-by: Zu Shi <zuomingshi@microsoft.com>
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ See the following sections for more information:
63
63
64
64
DirectML C++ sample code is available under [Samples](./Samples).
65
65
*[HelloDirectML](./Samples/HelloDirectML): A minimal "hello world" application that executes a single DirectML operator.
66
+
*[DirectMLNpuInference](./Samples\DirectMLNpuInference): A sample that showcases how to utilize NPU hardware with DirectML.
66
67
*[DirectMLSuperResolution](./Samples/DirectMLSuperResolution): A sample that uses DirectML to execute a basic super-resolution model to upscale video from 540p to 1080p in real time.
67
68
*[yolov4](./Samples/yolov4): YOLOv4 is an object detection model capable of recognizing up to 80 different classes of objects in an image. This sample contains a complete end-to-end implementation of the model using DirectML, and is able to run in real time on a user-provided video stream.
// Note: this module is not currently properly freed. Outside of sample usage, this module should freed e.g. with an explicit free or through wil::unique_hmodule.
if (TryGetProperty(adapter.Get(), DXCoreAdapterProperty::DriverDescription, adapterName))
99
+
{
100
+
printf("Successfully found adapter %s\n", adapterName.c_str());
101
+
}
102
+
else
103
+
{
104
+
printf("Failed to get adapter description.\n");
61
105
}
62
106
}
107
+
63
108
// Create the D3D12 Device
64
109
ComPtr<ID3D12Device1> d3dDevice;
65
110
if (adapter)
66
111
{
112
+
// Note: this module is not currently properly freed. Outside of sample usage, this module should freed e.g. with an explicit free or through wil::unique_hmodule.
// Note: this module is not currently properly freed. Outside of sample usage, this module should freed e.g. with an explicit free or through wil::unique_hmodule.
0 commit comments