Extend version checks in subgroup test to support all cases

To prepare for merging the cl20_trunk branch.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
Kevin Petit
2019-07-31 15:22:35 +01:00
committed by Kévin Petit
parent 75a26fdc44
commit 9dff128d42
2 changed files with 18 additions and 1 deletions

View File

@@ -39,6 +39,8 @@ public:
Version() : m_major(0), m_minor(0) {}
Version(int major, int minor) : m_major(major), m_minor(minor) {}
bool operator>(const Version& rhs) const { return to_int() > rhs.to_int(); }
bool operator<(const Version& rhs) const { return to_int() < rhs.to_int(); }
bool operator==(const Version& rhs) const { return to_int() == rhs.to_int(); }
int to_int() const { return m_major * 10 + m_minor; }
std::string to_string() const
{

View File

@@ -33,7 +33,22 @@ const int test_num = ARRAY_SIZE( test_list );
static test_status checkSubGroupsExtension(cl_device_id device)
{
if (!is_extension_available(device, "cl_khr_subgroups")) {
// The extension is optional in OpenCL 2.0 (minimum required version) and
// required in later versions.
auto version = get_device_cl_version(device);
if (version < Version(2, 0)) {
return TEST_SKIP;
}
bool hasExtension = is_extension_available(device, "cl_khr_subgroups");
if ((version == Version(2, 0)) && !hasExtension) {
log_info("Device does not support 'cl_khr_subgroups'. Skipping the test.\n");
return TEST_SKIP;
}
if ((version > Version(2, 0)) && !hasExtension) {
log_error("'cl_khr_subgroups' is a required extension, failing.\n");
return TEST_FAIL;
}