Skip to content

[SYCL] Deprecate SYCL 1.2.1 device selectors #6599

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

Conversation

cperkinsintel
Copy link
Contributor

Now that we have added the SYCL 2020 callable device selectors, we need to prepare for the removal of the older SYCL 1.2.1 device_selector class. The first step is to add the deprecation message to the 1.2.1 style device selectors, which this PR does. It also removes the usage of those from our own codebase so as to not trip on our own messages in the future.

@cperkinsintel cperkinsintel marked this pull request as ready for review August 18, 2022 02:02
@cperkinsintel cperkinsintel requested review from a team as code owners August 18, 2022 02:02
gmlueck
gmlueck previously approved these changes Aug 18, 2022
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Good cleaning.

Signed-off-by: Larsen, Steffen <[email protected]>
kbobrovs
kbobrovs previously approved these changes Aug 24, 2022
Copy link
Contributor

@kbobrovs kbobrovs left a comment

Choose a reason for hiding this comment

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

sycl/doc/extensions/experimental/sycl_ext_intel_esimd/sycl_ext_intel_esimd.md LGTM

@pvchupin pvchupin requested a review from bader September 6, 2022 20:41
pvchupin
pvchupin previously approved these changes Sep 6, 2022
@bader bader changed the title [SYCL] deprecation of 1.2.1 device selectors [SYCL] Deprecate 1.2.1 device selectors Sep 7, 2022
@bader bader changed the title [SYCL] Deprecate 1.2.1 device selectors [SYCL] Deprecate SYCL 1.2.1 device selectors Sep 7, 2022
Comment on lines 22 to 26
try {
sycl::default_selector device_selector;

sycl::range<1> BufSize{1};
sycl::buffer<int, 1> Buf(BufSize);

TestQueue Queue(device_selector);
TestQueue Queue(sycl::default_selector{});
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm... I didn't catch: what has changed here?
Didn't you intend to use sycl::default_selector_v?

Copy link
Contributor

Choose a reason for hiding this comment

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

At least an intermediate variable was removed so it is simpler.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but I suppose compiler will emit a warning about using a deprecated API here. Right?

@bader bader requested a review from keryell September 7, 2022 09:33
keryell
keryell previously approved these changes Sep 7, 2022
Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Getting closer to full SYCL 2020 support!

Comment on lines 22 to 26
try {
sycl::default_selector device_selector;

sycl::range<1> BufSize{1};
sycl::buffer<int, 1> Buf(BufSize);

TestQueue Queue(device_selector);
TestQueue Queue(sycl::default_selector{});
Copy link
Contributor

Choose a reason for hiding this comment

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

At least an intermediate variable was removed so it is simpler.

@@ -22,7 +22,7 @@ like in example below:
sycl::queue Queue;

int main() {
Queue = sycl::queue{sycl::default_selector{}.select_device()};
Queue = sycl::queue{sycl::default_selector_v};
Copy link
Contributor

Choose a reason for hiding this comment

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

This example might not be best suited here anymore. default_selector_v is a function in our implementation so there is no "race" between it and Queue object created at line 22.

Line 25 is also useless now as the Queue is already initialized to the default device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree about Line 25, but I think we should leave it. The whole text is about how you get undefined behavior when using global objects because the C++ standard does not specify creation/destruction order, and how the example seems syntactically correct, yet is still undefined behavior. If we remove 25 then the surrounding text isn't really making a point.

Copy link
Contributor

Choose a reason for hiding this comment

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

Where is UB here now?

Copy link
Contributor Author

@cperkinsintel cperkinsintel Sep 7, 2022

Choose a reason for hiding this comment

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

the queue is created outside main. The "seems syntactically correct" part is declaring the queue outside main but initializing it inside main. If we remove line 25 there is no "seems syntactically correct" part. The example is intended to be intentionally wrong. Read the entire section and you'll see what I mean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably the whole thing should be re-written, but that's outside the scope of this PR. I'm just trying to bring the example up to date, not address its overall point.

Copy link
Contributor

Choose a reason for hiding this comment

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

part is declaring the queue outside main but initializing it inside main

I don't think it's true. We do create and define a queue outside main. Then we override the value inside the variable with another one, while the original is being destroyed.

Copy link
Contributor Author

@cperkinsintel cperkinsintel Sep 7, 2022

Choose a reason for hiding this comment

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

correct. but to make that point, we need to keep line 25. This isn't real code, this is documentation talking about global object usage.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still, where is UB?

Copy link
Contributor Author

@cperkinsintel cperkinsintel Sep 7, 2022

Choose a reason for hiding this comment

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

@cperkinsintel cperkinsintel dismissed stale reviews from keryell and pvchupin via b132a74 September 7, 2022 18:38
@cperkinsintel
Copy link
Contributor Author

ping to reviewers. Addressed the latest feedback. This PR is getting old now and I'd like to get it approved and merged before it is forgotten about entirely.

@againull againull merged commit c058380 into intel:sycl Sep 7, 2022
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.

10 participants