Fix code format errors

This commit is contained in:
Grzegorz Wawiorko
2020-07-06 13:05:22 +02:00
committed by Alastair Murray
parent c85527cec7
commit 44a240367e
16 changed files with 218 additions and 112 deletions

View File

@@ -281,7 +281,9 @@ test_status InitCL(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", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

View File

@@ -110,7 +110,9 @@ test_status InitCL(cl_device_id device) {
auto expected_min_version = Version(2, 0);
if (version < expected_min_version)
{
version_expected_info("Test", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}
return TEST_PASS;

View File

@@ -319,10 +319,10 @@ int main (int argc, const char **argv )
int ret = runTestHarnessWithCheck( 1, arg, test_num, test_list, true, 0, InitCL );
free_mtdata( gMTdata );
if (gQueue) {
if (gQueue)
{
error = clFinish(gQueue);
if (error)
vlog_error("clFinish failed: %d\n", error);
if (error) vlog_error("clFinish failed: %d\n", error);
}
clReleaseMemObject(gInBuffer);

View File

@@ -32,7 +32,9 @@ test_status InitCL(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", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

View File

@@ -39,7 +39,9 @@ test_status InitCL(cl_device_id device) {
if (version < expected_min_version)
{
version_expected_info("Test", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

View File

@@ -75,7 +75,9 @@ test_status InitCL(cl_device_id device) {
if (version < expected_min_version)
{
version_expected_info("Test", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

View File

@@ -43,7 +43,9 @@ test_status InitCL(cl_device_id device) {
auto expected_min_version = Version(2, 0);
if (version < expected_min_version)
{
version_expected_info("Test", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}
return TEST_PASS;

View File

@@ -24,7 +24,9 @@ test_status InitCL(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", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

View File

@@ -1023,7 +1023,9 @@ test_status InitCL( cl_device_id device )
auto expected_min_version = Version(1, 2);
if (version < expected_min_version)
{
version_expected_info("Test", "OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}

View File

@@ -154,24 +154,33 @@ int get_program_with_il(clProgramWrapper &prog,
}
unsigned char *buffer = &buffer_vec[0];
if (gCoreILProgram) {
if (gCoreILProgram)
{
prog = clCreateProgramWithIL(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL");
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithIL");
}
else {
else
{
cl_platform_id platform;
err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL);
SPIRV_CHECK_ERROR(err, "Failed to get platform info with clGetDeviceInfo");
err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM,
sizeof(cl_platform_id), &platform, NULL);
SPIRV_CHECK_ERROR(err,
"Failed to get platform info with clGetDeviceInfo");
clCreateProgramWithILKHR_fn clCreateProgramWithILKHR = NULL;
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)clGetExtensionFunctionAddressForPlatform(platform, "clCreateProgramWithILKHR");
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)
clGetExtensionFunctionAddressForPlatform(
platform, "clCreateProgramWithILKHR");
if (clCreateProgramWithILKHR == NULL)
{
log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
log_error(
"ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
return -1;
}
prog = clCreateProgramWithILKHR(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithILKHR");
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithILKHR");
}
err = clBuildProgram(prog, 1, &deviceID, NULL, NULL, NULL);
@@ -185,15 +194,18 @@ test_status InitCL(cl_device_id id)
test_status spirv_status;
bool force = true;
spirv_status = check_spirv_compilation_readiness(id);
if (spirv_status != TEST_PASS) {
if (spirv_status != TEST_PASS)
{
return spirv_status;
}
cl_uint address_bits;
cl_uint err = clGetDeviceInfo(id, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), &address_bits, NULL);
if(err != CL_SUCCESS){
log_error("clGetDeviceInfo failed to get address bits!");
return TEST_FAIL;
cl_uint err = clGetDeviceInfo(id, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint),
&address_bits, NULL);
if (err != CL_SUCCESS)
{
log_error("clGetDeviceInfo failed to get address bits!");
return TEST_FAIL;
}
gAddrWidth = address_bits == 32 ? "32" : "64";
@@ -234,8 +246,8 @@ int main(int argc, const char *argv[])
printUsage();
}
return runTestHarnessWithCheck(argc, argv,
spirvTestsRegistry::getInstance().getNumTests(),
spirvTestsRegistry::getInstance().getTestDefinitions(),
false, 0, InitCL);
return runTestHarnessWithCheck(
argc, argv, spirvTestsRegistry::getInstance().getNumTests(),
spirvTestsRegistry::getInstance().getTestDefinitions(), false, 0,
InitCL);
}

View File

@@ -33,34 +33,43 @@ static int test_linkage_compile(cl_device_id deviceID,
}
unsigned char *buffer = &buffer_vec[0];
if (gCoreILProgram) {
if (gCoreILProgram)
{
prog = clCreateProgramWithIL(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL");
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithIL");
}
else {
else
{
cl_platform_id platform;
err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL);
SPIRV_CHECK_ERROR(err, "Failed to get platform info with clGetDeviceInfo");
err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM,
sizeof(cl_platform_id), &platform, NULL);
SPIRV_CHECK_ERROR(err,
"Failed to get platform info with clGetDeviceInfo");
clCreateProgramWithILKHR_fn clCreateProgramWithILKHR = NULL;
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)clGetExtensionFunctionAddressForPlatform(platform, "clCreateProgramWithILKHR");
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)
clGetExtensionFunctionAddressForPlatform(
platform, "clCreateProgramWithILKHR");
if (clCreateProgramWithILKHR == NULL)
{
log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
log_error(
"ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
return -1;
}
prog = clCreateProgramWithILKHR(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithILKHR");
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithILKHR");
}
err = clCompileProgram(prog, 1, &deviceID,
NULL, // options
0, // num headers
0, // num headers
NULL, // input headers
NULL, // header include names
NULL, // callback
NULL // User data
);
NULL // User data
);
SPIRV_CHECK_ERROR(err, "Failed to compile spv program");
return 0;
}

View File

@@ -30,34 +30,43 @@ TEST_SPIRV_FUNC(op_type_opaque_simple)
clProgramWrapper prog;
if (gCoreILProgram) {
if (gCoreILProgram)
{
prog = clCreateProgramWithIL(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithIL");
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithIL");
}
else {
else
{
cl_platform_id platform;
err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL);
SPIRV_CHECK_ERROR(err, "Failed to get platform info with clGetDeviceInfo");
err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM,
sizeof(cl_platform_id), &platform, NULL);
SPIRV_CHECK_ERROR(err,
"Failed to get platform info with clGetDeviceInfo");
clCreateProgramWithILKHR_fn clCreateProgramWithILKHR = NULL;
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)clGetExtensionFunctionAddressForPlatform(platform, "clCreateProgramWithILKHR");
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)
clGetExtensionFunctionAddressForPlatform(
platform, "clCreateProgramWithILKHR");
if (clCreateProgramWithILKHR == NULL)
{
log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
log_error(
"ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
return -1;
}
prog = clCreateProgramWithILKHR(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(err, "Failed to create program with clCreateProgramWithILKHR");
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithILKHR");
}
err = clCompileProgram(prog, 1, &deviceID,
NULL, // options
0, // num headers
0, // num headers
NULL, // input headers
NULL, // header include names
NULL, // callback
NULL // User data
);
NULL // User data
);
SPIRV_CHECK_ERROR(err, "Failed to compile spv program");
return 0;
}

View File

@@ -47,7 +47,9 @@ test_status InitCL(cl_device_id device) {
auto expected_min_version = Version(2, 0);
if (version < expected_min_version)
{
version_expected_info("Test","OpenCL", expected_min_version.to_string().c_str(), version.to_string().c_str());
version_expected_info("Test", "OpenCL",
expected_min_version.to_string().c_str(),
version.to_string().c_str());
return TEST_SKIP;
}