mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Format subgroups tests according to clang-format (#745)
* Format subgroups tests to clang-format * Format issue - fix do/while issue
This commit is contained in:
committed by
GitHub
parent
a6c3d921ae
commit
ec32bd9b5e
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -23,13 +23,13 @@
|
||||
MTdata gMTdata;
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST( sub_group_info ),
|
||||
ADD_TEST( work_item_functions ),
|
||||
ADD_TEST( work_group_functions ),
|
||||
ADD_TEST( barrier_functions ),
|
||||
ADD_TEST(sub_group_info),
|
||||
ADD_TEST(work_item_functions),
|
||||
ADD_TEST(work_group_functions),
|
||||
ADD_TEST(barrier_functions),
|
||||
};
|
||||
|
||||
const int test_num = ARRAY_SIZE( test_list );
|
||||
const int test_num = ARRAY_SIZE(test_list);
|
||||
|
||||
static test_status checkSubGroupsExtension(cl_device_id device)
|
||||
{
|
||||
@@ -38,19 +38,24 @@ static test_status checkSubGroupsExtension(cl_device_id device)
|
||||
auto version = get_device_cl_version(device);
|
||||
auto expected_min_version = Version(2, 0);
|
||||
|
||||
if (version < expected_min_version) {
|
||||
version_expected_info("Test", expected_min_version.to_string().c_str(), version.to_string().c_str());
|
||||
if (version < expected_min_version)
|
||||
{
|
||||
version_expected_info("Test", expected_min_version.to_string().c_str(),
|
||||
version.to_string().c_str());
|
||||
return TEST_SKIP;
|
||||
}
|
||||
|
||||
bool hasExtension = is_extension_available(device, "cl_khr_subgroups");
|
||||
|
||||
if ((version == expected_min_version) && !hasExtension) {
|
||||
log_info("Device does not support 'cl_khr_subgroups'. Skipping the test.\n");
|
||||
if ((version == expected_min_version) && !hasExtension)
|
||||
{
|
||||
log_info(
|
||||
"Device does not support 'cl_khr_subgroups'. Skipping the test.\n");
|
||||
return TEST_SKIP;
|
||||
}
|
||||
|
||||
if ((version > expected_min_version) && !hasExtension) {
|
||||
if ((version > expected_min_version) && !hasExtension)
|
||||
{
|
||||
log_error("'cl_khr_subgroups' is a required extension, failing.\n");
|
||||
return TEST_FAIL;
|
||||
}
|
||||
@@ -58,7 +63,8 @@ static test_status checkSubGroupsExtension(cl_device_id device)
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
static test_status InitCL(cl_device_id device) {
|
||||
static test_status InitCL(cl_device_id device)
|
||||
{
|
||||
|
||||
auto version = get_device_cl_version(device);
|
||||
test_status ret = TEST_PASS;
|
||||
@@ -68,13 +74,15 @@ static test_status InitCL(cl_device_id device) {
|
||||
int error;
|
||||
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_MAX_NUM_SUB_GROUPS,
|
||||
sizeof(max_sub_groups), &max_sub_groups, NULL);
|
||||
if (error != CL_SUCCESS) {
|
||||
sizeof(max_sub_groups), &max_sub_groups, NULL);
|
||||
if (error != CL_SUCCESS)
|
||||
{
|
||||
print_error(error, "Unable to get max number of subgroups");
|
||||
return TEST_FAIL;
|
||||
}
|
||||
|
||||
if (max_sub_groups == 0) {
|
||||
if (max_sub_groups == 0)
|
||||
{
|
||||
ret = TEST_SKIP;
|
||||
}
|
||||
}
|
||||
@@ -83,12 +91,11 @@ static test_status InitCL(cl_device_id device) {
|
||||
ret = checkSubGroupsExtension(device);
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
gMTdata = init_genrand(0);
|
||||
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0, InitCL);
|
||||
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0,
|
||||
InitCL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user