Skip to content

[SYCL] Make host device and host platform always available, even when forcin… #992

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 5 commits into from
Jan 15, 2020

Conversation

jbrodman
Copy link
Contributor

@jbrodman jbrodman commented Jan 9, 2020

…g a device type with SYCL_DEVICE_TYPE

The current behavior violates the SYCL Specification. The host device/platform should always be available.

int main() {
device myHost(host_selector{});
return 0;
}

That fails when run with SYCL_DEVICE_TYPE=CPU/GPU/ACC and it shouldn't.

Signed-off-by: James Brodman [email protected]

…g a device type with SYCL_DEVICE_TYPE

Signed-off-by: James Brodman <[email protected]>
@jbrodman jbrodman requested a review from bader January 9, 2020 16:29
@vladimirlaz
Copy link
Contributor

Please add LIT test following example in the PR description.

@jbrodman
Copy link
Contributor Author

jbrodman commented Jan 9, 2020

Please add LIT test following example in the PR description.

Added a test for host device and another for host platform.

Signed-off-by: James Brodman <[email protected]>
@jbrodman jbrodman requested a review from vladimirlaz January 10, 2020 15:02
vladimirlaz
vladimirlaz previously approved these changes Jan 13, 2020
KarachunIvan
KarachunIvan previously approved these changes Jan 13, 2020
if (plt.is_host()) {
vector_class<device> host_device(
plt.get_devices(info::device_type::host));
if (!host_device.empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this if redundant? I think insert will correctly handle case when begin iterator == end iterator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No - get_devices is supposed to only return devices of the passed type, hence the special casing for host devices.

@jbrodman jbrodman dismissed stale reviews from KarachunIvan and vladimirlaz via fd977d2 January 13, 2020 19:33
@bader bader requested a review from romanovvlad January 14, 2020 08:26
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@jbrodman
Copy link
Contributor Author

LGTM. Thanks!

👍
Good to merge? This is gating another priority PR I need to file.

@bader bader merged commit 6104f16 into intel:sycl Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants