aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuomas Lauttia <tuomas.lauttia@tuni.fi>2023-05-16 18:46:28 +0300
committerGitHub <noreply@github.com>2023-05-16 08:46:28 -0700
commit85c95297ac3f83ad69e85f581b576187fed3ca17 (patch)
tree5039111de49f41ca172adf6267501ccc8ebab07c
parent32688a47b30bf2168f613cb2ce7ee0a40c52fe0b (diff)
downloadOpenCL-CTS-85c95297ac3f83ad69e85f581b576187fed3ca17.tar.gz
Removed hardcoded -cl-std=CL2.0 build option from progvar tests (#1710)
* Removed hardcoded -cl-std=CL2.0 build option from progvar tests Fixes issue #1380 https://github.com/KhronosGroup/OpenCL-CTS/issues/1380 These changes will query the device for the latest supported CL C version instead of using a hardcoded value. The create_single_kernel_helper function queries for the latest CL C version internally, so calls to create_single_kernel_helper_with_build_options were replaced with calls to create_single_kernel_helper instead. * Fixed formatting
-rw-r--r--test_conformance/basic/test_progvar.cpp54
1 files changed, 31 insertions, 23 deletions
diff --git a/test_conformance/basic/test_progvar.cpp b/test_conformance/basic/test_progvar.cpp
index bbaa87c3..a46713e9 100644
--- a/test_conformance/basic/test_progvar.cpp
+++ b/test_conformance/basic/test_progvar.cpp
@@ -25,7 +25,6 @@
#define ALIGNMENT 128
-#define OPTIONS "-cl-std=CL2.0"
// NUM_ROUNDS must be at least 1.
// It determines how many sets of random data we push through the global
@@ -439,6 +438,7 @@ static int l_capacity(cl_device_id device, cl_context context,
static int l_user_type(cl_device_id device, cl_context context,
cl_command_queue queue, bool separate_compile);
+static std::string get_build_options(cl_device_id device);
////////////////////
// File scope function definitions
@@ -1116,9 +1116,8 @@ static int l_write_read_for_type(cl_device_id device, cl_context context,
clProgramWrapper program;
clKernelWrapper writer;
- status = create_single_kernel_helper_with_build_options(
- context, &program, &writer, ksrc.num_str(), ksrc.strs(), "writer",
- OPTIONS);
+ status = create_single_kernel_helper(context, &program, &writer,
+ ksrc.num_str(), ksrc.strs(), "writer");
test_error_ret(status, "Failed to create program for read-after-write test",
status);
@@ -1326,9 +1325,8 @@ static int l_init_write_read_for_type(cl_device_id device, cl_context context,
clProgramWrapper program;
clKernelWrapper writer;
- status = create_single_kernel_helper_with_build_options(
- context, &program, &writer, ksrc.num_str(), ksrc.strs(), "writer",
- OPTIONS);
+ status = create_single_kernel_helper(context, &program, &writer,
+ ksrc.num_str(), ksrc.strs(), "writer");
test_error_ret(status,
"Failed to create program for init-read-after-write test",
status);
@@ -1581,9 +1579,9 @@ static int l_capacity(cl_device_id device, cl_context context,
clProgramWrapper program;
clKernelWrapper get_max_size;
- status = create_single_kernel_helper_with_build_options(
- context, &program, &get_max_size, ksrc.num_str(), ksrc.strs(),
- "get_max_size", OPTIONS);
+ status = create_single_kernel_helper(context, &program, &get_max_size,
+ ksrc.num_str(), ksrc.strs(),
+ "get_max_size");
test_error_ret(status, "Failed to create program for capacity test",
status);
@@ -1737,6 +1735,8 @@ static int l_user_type(cl_device_id device, cl_context context,
clProgramWrapper program;
+ const std::string options = get_build_options(device);
+
if (separate_compile)
{
// Separate compilation flow.
@@ -1757,15 +1757,15 @@ static int l_user_type(cl_device_id device, cl_context context,
"Failed to create writer program for user type test",
status);
- status = clCompileProgram(writer_program, 1, &device, OPTIONS, 0, 0, 0,
- 0, 0);
+ status = clCompileProgram(writer_program, 1, &device, options.c_str(),
+ 0, 0, 0, 0, 0);
if (check_error(
status,
"Failed to compile writer program for user type test (%s)",
IGetErrorString(status)))
{
print_build_log(writer_program, 1, &device, wksrc.num_str(),
- wksrc.strs(), wksrc.lengths(), OPTIONS);
+ wksrc.strs(), wksrc.lengths(), options.c_str());
return status;
}
@@ -1775,15 +1775,15 @@ static int l_user_type(cl_device_id device, cl_context context,
"Failed to create reader program for user type test",
status);
- status = clCompileProgram(reader_program, 1, &device, OPTIONS, 0, 0, 0,
- 0, 0);
+ status = clCompileProgram(reader_program, 1, &device, options.c_str(),
+ 0, 0, 0, 0, 0);
if (check_error(
status,
"Failed to compile reader program for user type test (%s)",
IGetErrorString(status)))
{
print_build_log(reader_program, 1, &device, rksrc.num_str(),
- rksrc.strs(), rksrc.lengths(), OPTIONS);
+ rksrc.strs(), rksrc.lengths(), options.c_str());
return status;
}
@@ -1813,23 +1813,23 @@ static int l_user_type(cl_device_id device, cl_context context,
int status = CL_SUCCESS;
status = create_single_kernel_helper_create_program(
- context, &program, ksrc.num_str(), ksrc.strs(), OPTIONS);
+ context, &program, ksrc.num_str(), ksrc.strs(), options.c_str());
if (check_error(status,
"Failed to build program for user type test (%s)",
IGetErrorString(status)))
{
print_build_log(program, 1, &device, ksrc.num_str(), ksrc.strs(),
- ksrc.lengths(), OPTIONS);
+ ksrc.lengths(), options.c_str());
return status;
}
- status = clBuildProgram(program, 1, &device, OPTIONS, 0, 0);
+ status = clBuildProgram(program, 1, &device, options.c_str(), 0, 0);
if (check_error(status,
"Failed to compile program for user type test (%s)",
IGetErrorString(status)))
{
print_build_log(program, 1, &device, ksrc.num_str(), ksrc.strs(),
- ksrc.lengths(), OPTIONS);
+ ksrc.lengths(), options.c_str());
return status;
}
}
@@ -1935,6 +1935,14 @@ static int l_user_type(cl_device_id device, cl_context context,
return err;
}
+static std::string get_build_options(cl_device_id device)
+{
+ std::string options = "-cl-std=CL";
+ Version latest_cl_c_version = get_device_latest_cl_c_version(device);
+ options += latest_cl_c_version.to_string();
+ return options;
+}
+
// Determines whether its valid to skip this test based on the driver version
// and the features it optionally supports.
// Whether the test should be skipped is writen into the out paramter skip.
@@ -2102,9 +2110,9 @@ int test_progvar_func_scope(cl_device_id device, cl_context context,
clProgramWrapper program;
clKernelWrapper test_bump;
- status = create_single_kernel_helper_with_build_options(
- context, &program, &test_bump, ksrc.num_str(), ksrc.strs(), "test_bump",
- OPTIONS);
+ status =
+ create_single_kernel_helper(context, &program, &test_bump,
+ ksrc.num_str(), ksrc.strs(), "test_bump");
test_error_ret(status,
"Failed to create program for function static variable test",
status);