-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add SYCL version check #989
base: main
Are you sure you want to change the base?
Add SYCL version check #989
Conversation
tests/header/header_test.cpp
Outdated
@@ -45,6 +45,7 @@ class TEST_NAME : public util::test_base { | |||
#define TEST_FAIL | |||
log.note("SYCL_LANGUAGE_VERSION not present"); | |||
#else | |||
static_assert(SYCL_LANGUAGE_VERSION, "202012L"); |
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.
Shouldn't this be something like:
static_assert(SYCL_LANGUAGE_VERSION == 202012L)
Followed by a check that the type is really long
.
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.
Agree, fixed
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.
Followed by a check that the type is really
long
.
Something like:
static_assert(std::is_same_v<decltype(SYCL_LANGUAGE_VERSION), long>);
tests/header/header_test.cpp
Outdated
@@ -45,6 +45,7 @@ class TEST_NAME : public util::test_base { | |||
#define TEST_FAIL | |||
log.note("SYCL_LANGUAGE_VERSION not present"); | |||
#else | |||
static_assert(SYCL_LANGUAGE_VERSION, "202012L"); | |||
log.note("SYCL_LANGUAGE_VERSION = %d", static_cast<int>(SYCL_LANGUAGE_VERSION)); |
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.
Not sure if this log message is still useful since we are now checking for a specific value.
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.
As for me, we can remove this log message due to static_assert.
Ping |
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.
Thanks.
By the way, it is better to write SYCL in uppercase everywhere, even in the commit messages.
@dklochkov-emb, please, address this feedback by fixing commit message. Alternatively, I can do it myself by squashing all commits with my own commit message. Please, fix CI failures. |
Please bump the DPC++ version in the CI to ensure this test doesn't fail. |
I realize this is not your fault, but the whole test setup used here is terribly outdated. The idiomatic way of writing this test would be something like TEST_CASE("The implementation defines the correct SYCL_LANGUAGE_VERSION macro") {
#ifndef SYCL_LANGUAGE_VERSION
FAIL("SYCL_LANGUAGE_VERSION is not defined");
#else
STATIC_REQUIRE(std::is_same_v<decltype(SYCL_LANGUAGE_VERSION), long>);
STATIC_REQUIRE(SYCL_LANGUAGE_VERSION == 202012L);
#endif
} Edit: Actually, why does this check have to be a static assertion? Can't we just fail at runtime? |
I've just aligned |
cb45f28
to
6c7dac1
Compare
The earlier you get an error, the better. When you work on a SYCL implementation and static assert fails, you immediately know where and what failed: most likely some of interfaces don't have correct signatures (like type of a macro-defined constant here). However, when you run CTS, you probably also want to have a little check saying "yes, interfaces are correct" simply for having all checks reported at the same time and be a part of a final CTS validation report.
|
Check of SYCL version was added according to agreement, see details:
KhronosGroup/SYCL-Docs#634