mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Fix code format errors
This commit is contained in:
committed by
Alastair Murray
parent
c85527cec7
commit
44a240367e
@@ -665,30 +665,40 @@ static int create_single_kernel_helper_create_program_offline(cl_context context
|
||||
|
||||
size_t length = modifiedKernelBuf.size();
|
||||
log_info("offlineCompiler: clCreateProgramWithSource replaced with clCreateProgramWithIL\n");
|
||||
if (gCoreILProgram) {
|
||||
*outProgram = clCreateProgramWithIL(context, &modifiedKernelBuf[0], length, &error);
|
||||
if (gCoreILProgram)
|
||||
{
|
||||
*outProgram = clCreateProgramWithIL(context, &modifiedKernelBuf[0],
|
||||
length, &error);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
cl_platform_id platform;
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL);
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
|
||||
sizeof(cl_platform_id), &platform, NULL);
|
||||
print_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
|
||||
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;
|
||||
}
|
||||
*outProgram = clCreateProgramWithILKHR(context, &modifiedKernelBuf[0], length, &error);
|
||||
*outProgram = clCreateProgramWithILKHR(
|
||||
context, &modifiedKernelBuf[0], length, &error);
|
||||
}
|
||||
|
||||
if (*outProgram == NULL || error != CL_SUCCESS)
|
||||
{
|
||||
if (gCoreILProgram) {
|
||||
if (gCoreILProgram)
|
||||
{
|
||||
print_error(error, "clCreateProgramWithIL failed");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
print_error(error, "clCreateProgramWithILKHR failed");
|
||||
}
|
||||
return error;
|
||||
|
||||
@@ -57,7 +57,7 @@ int gIsEmbedded = 0;
|
||||
int gIsOpenCL_C_1_0_Device = 0;
|
||||
int gIsOpenCL_1_0_Device = 0;
|
||||
int gHasLong = 1;
|
||||
bool gCoreILProgram = true;
|
||||
bool gCoreILProgram = true;
|
||||
|
||||
#define DEFAULT_NUM_ELEMENTS 0x4000
|
||||
|
||||
@@ -79,9 +79,13 @@ int fail_init_info(int count) {
|
||||
log_info("FAILED %d of %d tests.\n", count, count);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
void version_expected_info(const char * test_name, const char * api_name, const char * expected_version, const char * device_version) {
|
||||
log_info("%s skipped (requires at least %s version %s, but the device reports %s version %s)\n",
|
||||
test_name, api_name, expected_version, api_name, device_version);
|
||||
void version_expected_info(const char *test_name, const char *api_name,
|
||||
const char *expected_version,
|
||||
const char *device_version)
|
||||
{
|
||||
log_info("%s skipped (requires at least %s version %s, but the device "
|
||||
"reports %s version %s)\n",
|
||||
test_name, api_name, expected_version, api_name, device_version);
|
||||
}
|
||||
int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_definition testList[],
|
||||
int forceNoContextCreation, cl_command_queue_properties queueProps,
|
||||
@@ -433,17 +437,16 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
log_error("Invalid device address bit size returned by device.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (gCompilationMode == kSpir_v) {
|
||||
if (gCompilationMode == kSpir_v)
|
||||
{
|
||||
test_status spirv_readiness = check_spirv_compilation_readiness(device);
|
||||
if (spirv_readiness != TEST_PASS) {
|
||||
if (spirv_readiness != TEST_PASS)
|
||||
{
|
||||
switch (spirv_readiness)
|
||||
{
|
||||
case TEST_PASS:
|
||||
break;
|
||||
case TEST_FAIL:
|
||||
return fail_init_info(testNum);
|
||||
case TEST_SKIP:
|
||||
return skip_init_info(testNum);
|
||||
case TEST_PASS: break;
|
||||
case TEST_FAIL: return fail_init_info(testNum);
|
||||
case TEST_SKIP: return skip_init_info(testNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -699,7 +702,9 @@ test_status callSingleTestFunction( test_definition test, cl_device_id deviceToU
|
||||
const Version device_version = get_device_cl_version(deviceToUse);
|
||||
if (test.min_version > device_version)
|
||||
{
|
||||
version_expected_info(test.name, "OpenCL", test.min_version.to_string().c_str(), device_version.to_string().c_str());
|
||||
version_expected_info(test.name, "OpenCL",
|
||||
test.min_version.to_string().c_str(),
|
||||
device_version.to_string().c_str());
|
||||
return TEST_SKIP;
|
||||
}
|
||||
|
||||
@@ -905,48 +910,66 @@ Version get_device_cl_version(cl_device_id device)
|
||||
throw std::runtime_error(std::string("Unknown OpenCL version: ") + str.data());
|
||||
}
|
||||
|
||||
bool check_device_spirv_version_reported(cl_device_id device) {
|
||||
bool check_device_spirv_version_reported(cl_device_id device)
|
||||
{
|
||||
size_t str_size;
|
||||
cl_int err;
|
||||
std::vector<char> str;
|
||||
if (gCoreILProgram) {
|
||||
if (gCoreILProgram)
|
||||
{
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, 0, NULL, &str_size);
|
||||
if (err != CL_SUCCESS) {
|
||||
log_error("clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION size;");
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION size;");
|
||||
return false;
|
||||
}
|
||||
|
||||
str.resize(str_size);
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, str_size, str.data(), NULL);
|
||||
if (err != CL_SUCCESS) {
|
||||
log_error("clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION value;");
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, str_size,
|
||||
str.data(), NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION value;");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cl_int err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, 0, NULL, &str_size);
|
||||
if (err != CL_SUCCESS) {
|
||||
log_error("clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION_KHR size;");
|
||||
else
|
||||
{
|
||||
cl_int err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, 0, NULL,
|
||||
&str_size);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION_KHR size;");
|
||||
return false;
|
||||
}
|
||||
|
||||
str.resize(str_size);
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, str_size, str.data(), NULL);
|
||||
if (err != CL_SUCCESS) {
|
||||
log_error("clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION_KHR value;");
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, str_size,
|
||||
str.data(), NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"clGetDeviceInfo: cannot read CL_DEVICE_IL_VERSION_KHR value;");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr(str.data(), "SPIR-V") == NULL) {
|
||||
if (strstr(str.data(), "SPIR-V") == NULL)
|
||||
{
|
||||
log_info("This device does not support SPIR-V offline compilation.\n");
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Version spirv_version = get_device_spirv_il_version(device);
|
||||
log_info("This device supports SPIR-V offline compilation. SPIR-V version is %s\n", spirv_version.to_string().c_str());
|
||||
log_info("This device supports SPIR-V offline compilation. SPIR-V "
|
||||
"version is %s\n",
|
||||
spirv_version.to_string().c_str());
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Version get_device_spirv_il_version(cl_device_id device)
|
||||
@@ -954,20 +977,25 @@ Version get_device_spirv_il_version(cl_device_id device)
|
||||
size_t str_size;
|
||||
cl_int err;
|
||||
std::vector<char> str;
|
||||
if (gCoreILProgram) {
|
||||
if (gCoreILProgram)
|
||||
{
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, 0, NULL, &str_size);
|
||||
ASSERT_SUCCESS(err, "clGetDeviceInfo");
|
||||
|
||||
str.resize(str_size);
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, str_size, str.data(), NULL);
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, str_size,
|
||||
str.data(), NULL);
|
||||
ASSERT_SUCCESS(err, "clGetDeviceInfo");
|
||||
}
|
||||
else {
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, 0, NULL, &str_size);
|
||||
else
|
||||
{
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, 0, NULL,
|
||||
&str_size);
|
||||
ASSERT_SUCCESS(err, "clGetDeviceInfo");
|
||||
|
||||
str.resize(str_size);
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, str_size, str.data(), NULL);
|
||||
err = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION_KHR, str_size,
|
||||
str.data(), NULL);
|
||||
ASSERT_SUCCESS(err, "clGetDeviceInfo");
|
||||
}
|
||||
|
||||
@@ -984,7 +1012,8 @@ Version get_device_spirv_il_version(cl_device_id device)
|
||||
else if (strstr(str.data(), "SPIR-V_1.5") != NULL)
|
||||
return Version(1, 5);
|
||||
|
||||
throw std::runtime_error(std::string("Unknown SPIR-V version: ") + str.data());
|
||||
throw std::runtime_error(std::string("Unknown SPIR-V version: ")
|
||||
+ str.data());
|
||||
}
|
||||
|
||||
test_status check_spirv_compilation_readiness(cl_device_id device)
|
||||
@@ -992,35 +1021,52 @@ test_status check_spirv_compilation_readiness(cl_device_id device)
|
||||
auto ocl_version = get_device_cl_version(device);
|
||||
auto ocl_expected_min_version = Version(2, 1);
|
||||
|
||||
if (ocl_version < ocl_expected_min_version) {
|
||||
if (is_extension_available(device, "cl_khr_il_program")) {
|
||||
if (ocl_version < ocl_expected_min_version)
|
||||
{
|
||||
if (is_extension_available(device, "cl_khr_il_program"))
|
||||
{
|
||||
gCoreILProgram = false;
|
||||
bool spirv_supported = check_device_spirv_version_reported(device);
|
||||
if (spirv_supported == false) {
|
||||
log_error("SPIR-V intermediate language not supported !!! OpenCL %s requires support.\n", ocl_version.to_string().c_str());
|
||||
if (spirv_supported == false)
|
||||
{
|
||||
log_error("SPIR-V intermediate language not supported !!! "
|
||||
"OpenCL %s requires support.\n",
|
||||
ocl_version.to_string().c_str());
|
||||
return TEST_FAIL;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return TEST_PASS;
|
||||
}
|
||||
}
|
||||
else {
|
||||
version_expected_info("Test", "OpenCL", ocl_expected_min_version.to_string().c_str(), ocl_version.to_string().c_str());
|
||||
else
|
||||
{
|
||||
version_expected_info("Test", "OpenCL",
|
||||
ocl_expected_min_version.to_string().c_str(),
|
||||
ocl_version.to_string().c_str());
|
||||
return TEST_SKIP;
|
||||
}
|
||||
}
|
||||
|
||||
bool spirv_supported = check_device_spirv_version_reported(device);
|
||||
if (ocl_version >= ocl_expected_min_version && ocl_version <= Version(2, 2)) {
|
||||
if (spirv_supported == false) {
|
||||
log_error("SPIR-V intermediate language not supported !!! OpenCL %s requires support.\n", ocl_version.to_string().c_str());
|
||||
if (ocl_version >= ocl_expected_min_version && ocl_version <= Version(2, 2))
|
||||
{
|
||||
if (spirv_supported == false)
|
||||
{
|
||||
log_error("SPIR-V intermediate language not supported !!! OpenCL "
|
||||
"%s requires support.\n",
|
||||
ocl_version.to_string().c_str());
|
||||
return TEST_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ocl_version > Version(2, 2)) {
|
||||
if (spirv_supported == false) {
|
||||
log_info("SPIR-V intermediate language not supported in OpenCL %s. Test skipped.\n", ocl_version.to_string().c_str());
|
||||
if (ocl_version > Version(2, 2))
|
||||
{
|
||||
if (spirv_supported == false)
|
||||
{
|
||||
log_info("SPIR-V intermediate language not supported in OpenCL %s. "
|
||||
"Test skipped.\n",
|
||||
ocl_version.to_string().c_str());
|
||||
return TEST_SKIP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,9 @@ extern cl_device_id GetOpposingDevice( cl_device_id device );
|
||||
|
||||
Version get_device_spirv_il_version(cl_device_id device);
|
||||
bool check_device_spirv_il_support(cl_device_id device);
|
||||
void version_expected_info(const char * test_name, const char * api_name, const char * expected_version, const char * device_version);
|
||||
void version_expected_info(const char *test_name, const char *api_name,
|
||||
const char *expected_version,
|
||||
const char *device_version);
|
||||
test_status check_spirv_compilation_readiness(cl_device_id device);
|
||||
|
||||
|
||||
@@ -146,7 +148,7 @@ extern int gInfNanSupport; // This is set to 1 if the device suppor
|
||||
extern int gIsEmbedded; // This is set to 1 if the device is an embedded device
|
||||
extern int gHasLong; // This is set to 1 if the device suppots long and ulong types in OpenCL C.
|
||||
extern int gIsOpenCL_C_1_0_Device; // This is set to 1 if the device supports only OpenCL C 1.0.
|
||||
extern bool gCoreILProgram;
|
||||
extern bool gCoreILProgram;
|
||||
|
||||
#if ! defined( __APPLE__ )
|
||||
void memset_pattern4(void *, const void *, size_t);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user