Skip to content

[SYCL] Change priority of devices in default_selector #1264

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

Merged
merged 4 commits into from
Apr 3, 2020
Merged
Changes from all commits
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
8 changes: 5 additions & 3 deletions sycl/source/device_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <CL/sycl/detail/force_device.hpp>
#include <CL/sycl/device.hpp>
#include <CL/sycl/device_selector.hpp>
#include <CL/sycl/exception.hpp>
Expand Down Expand Up @@ -54,12 +55,13 @@ int default_selector::operator()(const device &dev) const {
}
}

// override always wins
if (dev.get_info<info::device::device_type>() == detail::get_forced_type())
Copy link
Contributor

Choose a reason for hiding this comment

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

I think when the device type is forced we only return devices of the forced type. Thus, this is redundant. Can someone who knows the device internals better confirm that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't actually do that apparently. We will limit the devices enumerated to that type plus the host device since the host device must always be available. In that case, the fact that the host device is available with higher priority means it gets selected.

return 1000;

if (dev.is_gpu())
return 500;

if (dev.is_accelerator())
return 400;

if (dev.is_cpu())
return 300;

Expand Down