Skip to content

[SYCL] Added support for get_backend() API. #1879

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 7 commits into from
Jun 29, 2020

Conversation

glyons-intel
Copy link
Contributor

This API returns the backend associated with a platform.
A LIT test has also been added.

Signed-off-by: Gail Lyons [email protected]

This API returns the backend associated with a platform.
A LIT test has also been added.

Signed-off-by: Gail Lyons <[email protected]>
@glyons-intel glyons-intel requested a review from a team as a code owner June 12, 2020 12:41
@glyons-intel glyons-intel requested a review from v-klochkov June 12, 2020 12:41
Copy link
Contributor

@Ruyk Ruyk left a comment

Choose a reason for hiding this comment

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

Just a few comments :-)

<< plt.get_info<info::platform::name>() << ": "
<< plt.get_info<info::platform::version>();
if (!plt.is_host()) {
std::cout << " BE: " << get_string(plt.get_backend());
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is related somehow to the SYCL 2020 proposal, the host is also a backend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not. The L0 PI knows the BE, and it returning it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

<< dev.get_info<info::device::name>()
<< " (" << dev.get_info<info::device::driver_version>() << "): "
<< dev.get_info<info::device::version>()
<< std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not really testing anything, but you could try to match testing for "OpenCL" with returning at least the "OpenCL" backend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It checks for "opencl", which is the what the test prints for OpenCL backend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored the test.

A LIT test has also been added.
Incorporated code review comments.

Signed-off-by: Gail Lyons <[email protected]>
Signed-off-by: Gail Lyons <[email protected]>
@v-klochkov v-klochkov requested review from Ruyk and smaslov-intel June 20, 2020 02:40
Comment on lines 36 to 37
default:
Out << std::string("unknown");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm afraid, this can trigger -Wcovered-switch-default warning on newer compilers as you've already covered all of enum values:

enum class backend : char { host, opencl, level0, cuda };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

smaslov-intel
smaslov-intel previously approved these changes Jun 22, 2020
@v-klochkov
Copy link
Contributor

v-klochkov commented Jun 22, 2020

Windows build failed with error:

backend_types.hpp(31): error C2679: binary '<<': no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

Perhaps, adding
#include <string>

will fix that.

Signed-off-by: Gail Lyons <[email protected]>
Signed-off-by: Gail Lyons <[email protected]>
@bader bader merged commit 0ddb9fe into intel:sycl Jun 29, 2020
@glyons-intel glyons-intel deleted the glyons-backend branch October 28, 2020 19:09
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.

6 participants