Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter CPU case for IsFloat16Supported #2802

Merged
merged 2 commits into from
Jan 13, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions winml/lib/Api.Image/DeviceHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ static HRESULT IsFloat16Blocked(ID3D12Device& device, bool* isBlocked) {
}

bool IsFloat16Supported(const winrt::Windows::AI::MachineLearning::LearningModelDevice& device) {
if (device.AdapterId().HighPart == 0 && device.AdapterId().LowPart == 0) {
Copy link
Contributor

@ryanlai2 ryanlai2 Jan 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, there's an internal implementation of LearningModelDevice you can call.

device.as<winrt::Windows::AI::MachineLearning::implementation::LearningModelDevice>()
or device.as<winmlp::LearningModelDevice>()

and then you can call IsCpuDevice()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

return true;
}
winrt::com_ptr<ID3D12Device> d3d12Device;
if (FAILED(GetD3D12Device(device, d3d12Device.put()))) {
return false;
Expand Down