-
Notifications
You must be signed in to change notification settings - Fork 81
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
Implement tests for SYCL_KHR_DEFAULT_CONTEXT
extension
#960
Conversation
Signed-off-by: Michael Aziz <[email protected]>
Spec: KhronosGroup/SYCL-Docs#624 sycl-cts: KhronosGroup/SYCL-CTS#960 This patch is intended to be merged only when there are sycl-cts tests and the ratified khr extension.
Spec: KhronosGroup/SYCL-Docs#624 sycl-cts: KhronosGroup/SYCL-CTS#960 This patch is intended to be merged only when there are sycl-cts tests and the ratified khr extension.
Signed-off-by: Michael Aziz <[email protected]>
sycl_ext_oneapi_default_context
extensionSYCL_KHR_DEFAULT_CONTEXT
extension
Signed-off-by: Michael Aziz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the first KHR extension test, we should think about how we want to approach this in general. Currently you have both a CMake option to enable/disable compilation of tests for the extension, as well as compile-time guards that check whether the extension is available. I'm wondering whether we need both.
If we keep the former (which I think is a good idea, at least for now -- we'll see whether it scales), I'd argue we can get rid of the #ifdef SYCL_KHR_DEFAULT_CONTEXT
. If someone wants to test the extension, they'd likely want to know that it isn't available during compilation, not at runtime.
I think this makes sense. If the CTS is run with |
Signed-off-by: Michael Aziz <[email protected]>
Signed-off-by: Michael Aziz <[email protected]>
@psalz, @gmlueck, thanks for taking a look at this!
I think we need both. I did this to make the new extension test consistent with the other extension tests in the CTS. We have a similar CMake option for
If I get rid of this macro, someone that wants to test an implementation that implements most features and not this one would need to enumerate all of the relevant CMake options. They wouldn't be able to use the
Catch2 distinguishes passing test cases from skipped ones. Here's the output for this test when the macro is not defined:
If you both still agree that the |
Is that really a common use-case though? Realistically, I would assume that it's mostly going to be Intel that runs the CTS for the time being. If it does get out of hand, we could always provide CMake presets for the supported implementations.
True, I'm just not sure whether having that skip message is worth sacrificing legibility of the code by either grouping the tests into guarded functions instead of using individual |
Of course we could also get fancy and do a configuration-time check ( |
This requires a human to examine the test output, though. I think it would be better for the test to fail (return a non-zero exit status) if the macro isn't defined. This will make the tests easier to run in a CI system, which just tests the exit status. I think it would also be good for the Khronos workgroup when a vendor submits a conformance report. The WG won't want to look through the test output to see if there are SKIPPED messages. It will be easier for the WG to just rely on the fact that the CTS passed when determining a vendor's conformance.
I think we should go a step further. We should remove the macro guard, and also add a test that explicitly tests that the macro is defined. Part of an extension's API is that the macro is supposed to be set, so the CTS should check this.
The other extensions are all "oneapi" extensions, right? Putting my Khronos hat on ... these extensions exist in the Khronos CTS as a convenience to DPC++, so DPC++ can decide what works best for them. Putting my DPC++ hat on ... I think this probably does make sense. We've had situations in the past where we forgot to define the macro for an extension. Restructuring the tests like this would catch these errors. Of course, we'd need to have some cmake option to control when the oneapi tests are run. Do we have something like
One more comment about this. When vendors submit official conformance results, I think we do not want them to use |
Signed-off-by: Michael Aziz <[email protected]>
I don't think it's common and we likely don't need to provide any presets. I just wanted to make sure I understood the difference with your suggested approach.
I think this makes sense. The updated test case will fail due to a
I've added a test case for this using
Yes, all other extensions are oneAPI extensions. We have the
I don't have any experience reviewing conformance results but your suggestion seems reasonable. Conformance submissions using the |
"the default context extension defines the SYCL_KHR_DEFAULT_CONTEXT macro", | ||
"[khr_default_context]") { | ||
#ifndef SYCL_KHR_DEFAULT_CONTEXT | ||
static_assert(false, "SYCL_KHR_DEFAULT_CONTEXT is not defined"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good solution!
sycl::context defaultContext = sycl::platform{}.khr_get_default_context(); | ||
|
||
// Check that a default-constructed context is not the default context. | ||
CHECK(syclContext != defaultContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: This could be pulled out into it's own test case IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks great!
If you are on a roll with tests for default context behavior, we also need tests for #943. Note that those tests are for the core spec, so they are not tied to the extension.
Thanks! Waiting for further feedback from AdaptiveCpp. |
WG approved to merge. |
Implement the tests from #944.