Skip to content

[SYCL] Add support for platform name and platform version in device w… #890

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

Conversation

romanovvlad
Copy link
Contributor

…hitelist

PlatformName and PlatformVersion are now supported keys. Also all fields
are optional now, so SYCL_DEVICE_WHITE_LIST="" matches any device

Signed-off-by: Vlad Romanov [email protected]

@@ -58,16 +58,26 @@ struct DevDescT {

const char *devDriverVer = nullptr;
int devDriverVerSize = 0;

const char *pltName = nullptr;
int pltNameSize = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you replace "plt" with "platform" everywhere? Unlike "dev" it is not really obvious.

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.

@@ -140,8 +166,17 @@ static void filterWhiteList(vector_class<RT::PiDevice> &pi_devices) {
info::device::driver_version>::get(dev);

for (const DevDescT &desc : whiteList) {
// At least device name is required field to consider the filter so far
if (nullptr == desc.devName ||
if (nullptr != desc.pltName &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we get only one platform, can you move this check out of the "foreach devices" loop? And if the check for a platform failed, you can skip the rest.

Copy link
Contributor Author

@romanovvlad romanovvlad Nov 30, 2019

Choose a reason for hiding this comment

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

If I do it the filter
"PlatformName:{{ptl1}},DeviceName:{{dev1}}|PlatformName{{plt2}},DeviceName{{dev2}}
will match:

PlatformName = "plt2"
DeviceName = "dev1"

that is incorrect.

if (nullptr == desc.devName ||
if (nullptr != desc.pltName &&
!std::regex_match(
pltName, std::regex(std::string(desc.pltName, desc.pltNameSize))))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this patch: you can replace std::regex(std::string) constructor with std::regex(const char*, size_t) constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, already have it in the "refactor patch" I'm preparing.

@@ -12,25 +17,49 @@

using namespace cl;

static void replaceEscapeCharacters(std::string &Str) {
// As a stringwill be used as regexp pattern, we need to get rid of symbols
Copy link
Contributor

Choose a reason for hiding this comment

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

stringwill -> string will

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.

…hitelist

PlatformName and PlatformVersion are now supported keys. Also all fields
are optional now, so SYCL_DEVICE_WHITE_LIST="" matches any device

Signed-off-by: Vlad Romanov <[email protected]>
Signed-off-by: Vlad Romanov <[email protected]>
@romanovvlad romanovvlad force-pushed the private/vromanov/AddPlatformName branch from ce3da4f to 64d1380 Compare November 30, 2019 15:51
Signed-off-by: Vlad Romanov <[email protected]>
@romanovvlad romanovvlad requested a review from asavonic December 2, 2019 09:47
asavonic
asavonic previously approved these changes Dec 2, 2019
bader
bader previously approved these changes Dec 2, 2019
Signed-off-by: Vlad Romanov <[email protected]>
@romanovvlad romanovvlad dismissed stale reviews from bader and asavonic via 796505d December 2, 2019 10:29
@romanovvlad romanovvlad requested review from bader and asavonic December 2, 2019 10:30
@romanovvlad romanovvlad merged commit 7f2f668 into intel:sycl Dec 2, 2019
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.

3 participants