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:
Grzegorz Wawiorko
2020-05-19 11:16:06 +02:00
committed by GitHub
parent a6c3d921ae
commit ec32bd9b5e
7 changed files with 1260 additions and 821 deletions

View File

@@ -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);
}