Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] new tests for SYCL 2020 callable device selector interfaces #1119

Conversation

cperkinsintel
Copy link

intel/llvm#6486 introduces new callable device selectors. This PR adds new testing for them.

Signed-off-by: Chris Perkins [email protected]

Signed-off-by: Chris Perkins <[email protected]>
@cperkinsintel
Copy link
Author

/verify with intel/llvm#6486

assert(lastQueueWithHandler.get_device() == lastDevice &&
"queue created by selecting a device should have that same device");

context ctx = lastQueue.get_context();

Choose a reason for hiding this comment

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

What are the devices in the ctx at this point? Everything from last device's platform?

Copy link
Author

Choose a reason for hiding this comment

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

who knows? It's most likely a context of one device, but it could be every device in the platform, or the main device plus a bunch of sub-devices. At least in theory.

Choose a reason for hiding this comment

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

If it's one device only, then we're not testing much here...

Choose a reason for hiding this comment

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

I'd rather do

{
  context ctx(platform.get_all_devices()); // or whatever.
  queue q(ctx, ...);
}

Copy link
Author

Choose a reason for hiding this comment

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

done. It's a bit more complicated than that, but I agree that it's best to try to make the test not-so-trivial.

Comment on lines 49 to 51
queue lastQueueViaContext(ctx, select_last_device);
assert(lastQueueWithHandler.get_device() == lastDevice &&
"queue created by selecting a device should have that same device");

Choose a reason for hiding this comment

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

I don't think we really "test" that only ctx'devices are processed here.

Copy link
Author

Choose a reason for hiding this comment

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

Correct. We are just testing that it a) compiles correctly, and b) gets the device for the queue from the context.

@aelovikov-intel
Copy link

Are aspect_selectors going to be implemented separately?

Signed-off-by: Chris Perkins <[email protected]>
@cperkinsintel
Copy link
Author

/verify with intel/llvm#6486

@cperkinsintel
Copy link
Author

cperkinsintel commented Jul 28, 2022

@aelovikov-intel - yeah aspect selectors will be something else. This is just for the new SYCL2020 Callable device selectors.

Also, the standalone syc::gpu_selector_v etc. are coming. But with the Callable support, a lot of these things should be trivial.

assert(lastQueueWithHandler.get_device() == lastDevice &&
"queue created by selecting a device should have that same device");

context ctx = lastQueue.get_context();

Choose a reason for hiding this comment

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

I'd rather do

{
  context ctx(platform.get_all_devices()); // or whatever.
  queue q(ctx, ...);
}


// Check exceptions and failures.
try {
platform refusedPlatform(refuse_any_device_lambda);

Choose a reason for hiding this comment

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

If the above suggestion is implemented, then we can use p/q/d as the variables' names.

@cperkinsintel
Copy link
Author

/verify with intel/llvm#6486

@cperkinsintel
Copy link
Author

/verify with intel/llvm#6486

@againull againull merged commit 9d35612 into intel:intel Aug 5, 2022
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Mar 22, 2023
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants