From 5ddf3a215b21c48e2f8641275655b046402dc13d Mon Sep 17 00:00:00 2001 From: Ryan Lai Date: Thu, 29 Aug 2019 15:51:41 -0700 Subject: [PATCH] Can't use DXGI to print adapter name of VPU (#274) * Fix vpu break, can't print adaptername using dxcore * Spacing --- .../src/LearningModelDeviceHelper.cpp | 21 ++++++++++++------- Tools/WinMLRunner/src/OutputHelper.h | 6 +++--- Tools/WinMLRunner/src/Run.cpp | 1 - 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Tools/WinMLRunner/src/LearningModelDeviceHelper.cpp b/Tools/WinMLRunner/src/LearningModelDeviceHelper.cpp index 4fdc2324..fdd2b707 100644 --- a/Tools/WinMLRunner/src/LearningModelDeviceHelper.cpp +++ b/Tools/WinMLRunner/src/LearningModelDeviceHelper.cpp @@ -6,6 +6,7 @@ #include #include "Windows.AI.MachineLearning.Native.h" #include +#include "OutputHelper.h" using namespace winrt::Windows::Graphics::DirectX::Direct3D11; #ifdef DXCORE_SUPPORTED_BUILD @@ -83,11 +84,14 @@ void PopulateLearningModelDeviceList(CommandLineArgs& args, std::vector inspectableDevice; hr = CreateDirect3D11DeviceFromDXGIDevice(dxgiDevice.get(), inspectableDevice.put()); THROW_IF_FAILED(hr); - deviceList.push_back({ + LearningModelDeviceWithMetadata learningModelDeviceWithMetadata = + { LearningModelDevice::CreateFromDirect3D11Device(inspectableDevice.as()), deviceType, deviceCreationLocation - }); + }; + OutputHelper::PrintLearningModelDevice(learningModelDeviceWithMetadata); + deviceList.push_back(learningModelDeviceWithMetadata); } #ifdef DXCORE_SUPPORTED_BUILD else if ((TypeHelper::GetWinmlDeviceKind(deviceType) != LearningModelDeviceKind::Cpu) && @@ -216,11 +220,14 @@ void PopulateLearningModelDeviceList(CommandLineArgs& args, std::vectorGetDesc(&description))) { - std::wcout << L"\nCreating Session with GPU: " << description.Description << std::endl; + std::wcout << L"\nCreated LearningModelDevice with GPU: " << description.Description << std::endl; } } else diff --git a/Tools/WinMLRunner/src/Run.cpp b/Tools/WinMLRunner/src/Run.cpp index e42f8aee..646411fd 100644 --- a/Tools/WinMLRunner/src/Run.cpp +++ b/Tools/WinMLRunner/src/Run.cpp @@ -180,7 +180,6 @@ HRESULT CreateSession(LearningModelSession& session, LearningModel& model, const } try { - output.PrintLearningModelDevice(learningModelDevice); CreateSessionConsideringSupportForSessionOptions(session, model, profiler, args, learningModelDevice); } catch (hresult_error hr)