diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index 8fa9c0a4..637bf640 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -141,7 +141,6 @@ std::string get_kernel_name(const std::string &source) { kernelsList = kernelsList.substr(0, MAX_LEN_FOR_KERNEL_LIST + 1); kernelsList[kernelsList.size() - 1] = '.'; - kernelsList[kernelsList.size() - 1] = '.'; } oss << kernelsList; } @@ -678,17 +677,18 @@ static int create_single_kernel_helper_create_program_offline( return CL_SUCCESS; } -static int create_single_kernel_helper_create_program( - cl_context context, cl_device_id device, cl_program *outProgram, - unsigned int numKernelLines, const char **kernelProgram, - const char *buildOptions, CompilationMode compilationMode) +int create_single_kernel_helper_create_program(cl_context context, + cl_program *outProgram, + unsigned int numKernelLines, + const char **kernelProgram, + const char *buildOptions) { std::lock_guard compiler_lock(gCompilerMutex); std::string filePrefix = get_unique_filename_prefix(numKernelLines, kernelProgram, buildOptions); bool shouldSaveToDisk = should_save_kernel_source_to_disk( - compilationMode, gCompilationCacheMode, gCompilationCachePath, + gCompilationMode, gCompilationCacheMode, gCompilationCachePath, filePrefix); if (shouldSaveToDisk) @@ -701,7 +701,7 @@ static int create_single_kernel_helper_create_program( return -1; } } - if (compilationMode == kOnline) + if (gCompilationMode == kOnline) { int error = CL_SUCCESS; @@ -718,42 +718,11 @@ static int create_single_kernel_helper_create_program( else { return create_single_kernel_helper_create_program_offline( - context, device, outProgram, numKernelLines, kernelProgram, - buildOptions, compilationMode); + context, nullptr, outProgram, numKernelLines, kernelProgram, + buildOptions, gCompilationMode); } } -int create_single_kernel_helper_create_program(cl_context context, - cl_program *outProgram, - unsigned int numKernelLines, - const char **kernelProgram, - const char *buildOptions) -{ - return create_single_kernel_helper_create_program( - context, NULL, outProgram, numKernelLines, kernelProgram, buildOptions, - gCompilationMode); -} - -int create_single_kernel_helper_create_program_for_device( - cl_context context, cl_device_id device, cl_program *outProgram, - unsigned int numKernelLines, const char **kernelProgram, - const char *buildOptions) -{ - return create_single_kernel_helper_create_program( - context, device, outProgram, numKernelLines, kernelProgram, - buildOptions, gCompilationMode); -} - -int create_single_kernel_helper_with_build_options( - cl_context context, cl_program *outProgram, cl_kernel *outKernel, - unsigned int numKernelLines, const char **kernelProgram, - const char *kernelName, const char *buildOptions) -{ - return create_single_kernel_helper(context, outProgram, outKernel, - numKernelLines, kernelProgram, - kernelName, buildOptions); -} - // Creates and builds OpenCL C/C++ program, and creates a kernel int create_single_kernel_helper(cl_context context, cl_program *outProgram, cl_kernel *outKernel, @@ -1239,8 +1208,8 @@ int is_image_format_supported(cl_context context, cl_mem_flags flags, { cl_image_format *list; cl_uint count = 0; - cl_int err = clGetSupportedImageFormats(context, flags, image_type, 128, - NULL, &count); + cl_int err = + clGetSupportedImageFormats(context, flags, image_type, 0, NULL, &count); if (count == 0) return 0; list = (cl_image_format *)malloc(count * sizeof(cl_image_format)); @@ -1276,7 +1245,6 @@ int is_image_format_supported(cl_context context, cl_mem_flags flags, return (i < count) ? 1 : 0; } -size_t get_pixel_bytes(const cl_image_format *fmt); size_t get_pixel_bytes(const cl_image_format *fmt) { size_t chanCount; diff --git a/test_conformance/api/test_kernel_arg_info.cpp b/test_conformance/api/test_kernel_arg_info.cpp index 90b302b2..47b151b0 100644 --- a/test_conformance/api/test_kernel_arg_info.cpp +++ b/test_conformance/api/test_kernel_arg_info.cpp @@ -487,10 +487,10 @@ compare_kernel_with_expected(cl_context context, cl_device_id device, int failed_tests = 0; clKernelWrapper kernel; clProgramWrapper program; - cl_int err = create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info", - get_build_options(device).c_str()); - test_error(err, "create_single_kernel_helper_with_build_options"); + cl_int err = create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_src, "get_kernel_arg_info", + get_build_options(device).c_str()); + test_error(err, "create_single_kernel_helper"); for (size_t i = 0; i < expected_args.size(); ++i) { KernelArgInfo actual; @@ -874,11 +874,10 @@ static int test_null_param(cl_context context, cl_device_id device, { clProgramWrapper program; clKernelWrapper kernel; - cl_int err = create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info", - get_build_options(device).c_str()); - test_error_ret(err, "create_single_kernel_helper_with_build_options", - TEST_FAIL); + cl_int err = create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_src, "get_kernel_arg_info", + get_build_options(device).c_str()); + test_error_ret(err, "create_single_kernel_helper", TEST_FAIL); err = clGetKernelArgInfo(kernel, SINGLE_KERNEL_ARG_NUMBER, CL_KERNEL_ARG_ADDRESS_QUALIFIER, 0, nullptr, @@ -916,12 +915,11 @@ static int test_arg_name_size(cl_context context, cl_device_id device, char arg_return[sizeof(KERNEL_ARGUMENT_NAME) + 1]; clProgramWrapper program; clKernelWrapper kernel; - cl_int err = create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info", - get_build_options(device).c_str()); + cl_int err = create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_src, "get_kernel_arg_info", + get_build_options(device).c_str()); - test_error_ret(err, "create_single_kernel_helper_with_build_options", - TEST_FAIL); + test_error_ret(err, "create_single_kernel_helper", TEST_FAIL); err = clGetKernelArgInfo(kernel, SINGLE_KERNEL_ARG_NUMBER, CL_KERNEL_ARG_NAME, diff --git a/test_conformance/api/test_queue_hint.cpp b/test_conformance/api/test_queue_hint.cpp index 89769d7e..21df4341 100644 --- a/test_conformance/api/test_queue_hint.cpp +++ b/test_conformance/api/test_queue_hint.cpp @@ -86,7 +86,8 @@ REGISTER_TEST(queue_hint) clProgramWrapper program; clKernelWrapper kernel; - err = create_single_kernel_helper_with_build_options(context, &program, &kernel, 1, queue_hint_test_kernel, "vec_cpy", NULL); + err = create_single_kernel_helper(context, &program, &kernel, 1, + queue_hint_test_kernel, "vec_cpy"); if (err != 0) { return err; diff --git a/test_conformance/basic/test_enqueued_local_size.cpp b/test_conformance/basic/test_enqueued_local_size.cpp index 47123120..685982d1 100644 --- a/test_conformance/basic/test_enqueued_local_size.cpp +++ b/test_conformance/basic/test_enqueued_local_size.cpp @@ -103,11 +103,11 @@ REGISTER_TEST_VERSION(enqueued_local_size, Version(2, 0)) std::string cl_std = "-cl-std=CL"; cl_std += (get_device_cl_version(device) == Version(3, 0)) ? "3.0" : "2.0"; - err = create_single_kernel_helper_with_build_options( + err = create_single_kernel_helper( context, &program[0], &kernel[0], 1, &enqueued_local_size_1d_code, "test_enqueued_local_size_1d", cl_std.c_str()); test_error(err, "create_single_kernel_helper failed"); - err = create_single_kernel_helper_with_build_options( + err = create_single_kernel_helper( context, &program[1], &kernel[1], 1, &enqueued_local_size_2d_code, "test_enqueued_local_size_2d", cl_std.c_str()); test_error(err, "create_single_kernel_helper failed"); diff --git a/test_conformance/basic/test_sizeof.cpp b/test_conformance/basic/test_sizeof.cpp index ac0a84f9..ecd2d9bf 100644 --- a/test_conformance/basic/test_sizeof.cpp +++ b/test_conformance/basic/test_sizeof.cpp @@ -50,8 +50,8 @@ cl_int get_type_size( cl_context context, cl_command_queue queue, const char *ty { sizeof_kernel_code[0] = "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"; } - cl_int err = create_single_kernel_helper_with_build_options( - context, &p, &k, 4, sizeof_kernel_code, "test_sizeof", nullptr); + cl_int err = create_single_kernel_helper(context, &p, &k, 4, + sizeof_kernel_code, "test_sizeof"); test_error(err, "Failed to build kernel/program."); m = clCreateBuffer( context, CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR, sizeof( cl_ulong ), size, &err ); diff --git a/test_conformance/c11_atomics/common.h b/test_conformance/c11_atomics/common.h index 6a8a0082..5f33441b 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.h @@ -1245,9 +1245,8 @@ int CBasicTest::ExecuteSingleTest( programSource = PragmaHeader(deviceID) + ProgramHeader(numDestItems) + FunctionCode() + KernelCode(numDestItems); programLine = programSource.c_str(); - if (create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, &programLine, - "test_atomic_kernel", gOldAPI ? "" : nullptr)) + if (create_single_kernel_helper(context, &program, &kernel, 1, + &programLine, "test_atomic_kernel")) { return -1; } diff --git a/test_conformance/extensions/cl_ext_cxx_for_opencl/cxx_for_opencl_ext.cpp b/test_conformance/extensions/cl_ext_cxx_for_opencl/cxx_for_opencl_ext.cpp index aee287fd..56be5c65 100644 --- a/test_conformance/extensions/cl_ext_cxx_for_opencl/cxx_for_opencl_ext.cpp +++ b/test_conformance/extensions/cl_ext_cxx_for_opencl/cxx_for_opencl_ext.cpp @@ -42,8 +42,8 @@ int test_cxx_for_opencl(cl_device_id device, cl_context context, execute(*p, x); })"; - error = create_single_kernel_helper_with_build_options( - context, &program, &kernel1, 1, &kernel_sstr, "k1", "-cl-std=CLC++"); + error = create_single_kernel_helper(context, &program, &kernel1, 1, + &kernel_sstr, "k1", "-cl-std=CLC++"); test_error(error, "Failed to create k1 kernel"); kernel2 = clCreateKernel(program, "k2", &error); diff --git a/test_conformance/gl/test_images_write_common.cpp b/test_conformance/gl/test_images_write_common.cpp index 6f1f51e7..77c6c2eb 100644 --- a/test_conformance/gl/test_images_write_common.cpp +++ b/test_conformance/gl/test_images_write_common.cpp @@ -336,9 +336,8 @@ int test_cl_image_write(cl_context context, cl_command_queue queue, get_explicit_type_name(*outType), suffix, convert); programPtr = kernelSource; - if (create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, (const char **)&programPtr, - "sample_test", "")) + if (create_single_kernel_helper(context, &program, &kernel, 1, + (const char **)&programPtr, "sample_test")) { return -1; } diff --git a/test_conformance/non_uniform_work_group/TestNonUniformWorkGroup.cpp b/test_conformance/non_uniform_work_group/TestNonUniformWorkGroup.cpp index 6106e0ab..78118697 100644 --- a/test_conformance/non_uniform_work_group/TestNonUniformWorkGroup.cpp +++ b/test_conformance/non_uniform_work_group/TestNonUniformWorkGroup.cpp @@ -557,8 +557,9 @@ int TestNonUniformWorkGroup::prepareDevice () { if (_testRange & Range::BARRIERS) buildOptions += " -D TESTBARRIERS"; - err = create_single_kernel_helper_with_build_options (_context, &_program, &_testKernel, 1, - &KERNEL_FUNCTION, "testKernel", buildOptions.c_str()); + err = create_single_kernel_helper(_context, &_program, &_testKernel, 1, + &KERNEL_FUNCTION, "testKernel", + buildOptions.c_str()); if (err) { log_error("Error %d in line: %d of file %s\n", err, __LINE__, __FILE__); @@ -842,8 +843,9 @@ int SubTestExecutor::calculateWorkGroupSize(size_t &maxWgSize, int testRange) { if (testRange & Range::BARRIERS) buildOptions += " -D TESTBARRIERS"; - err = create_single_kernel_helper_with_build_options (_context, &program, &testKernel, 1, - &KERNEL_FUNCTION, "testKernel", buildOptions.c_str()); + err = create_single_kernel_helper(_context, &program, &testKernel, 1, + &KERNEL_FUNCTION, "testKernel", + buildOptions.c_str()); if (err) { log_error("Error %d in line: %d of file %s\n", err, __LINE__, __FILE__); diff --git a/test_conformance/pipes/test_pipe_info.cpp b/test_conformance/pipes/test_pipe_info.cpp index 5525a554..4e1c83d9 100644 --- a/test_conformance/pipes/test_pipe_info.cpp +++ b/test_conformance/pipes/test_pipe_info.cpp @@ -63,9 +63,9 @@ REGISTER_TEST(pipe_info) log_info( " CL_PIPE_MAX_PACKETS passed.\n" ); } - err = create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, &pipe_kernel_code, "pipe_kernel", - "-cl-std=CL2.0 -cl-kernel-arg-info"); + err = create_single_kernel_helper(context, &program, &kernel, 1, + &pipe_kernel_code, "pipe_kernel", + "-cl-std=CL2.0 -cl-kernel-arg-info"); test_error_fail(err, "Error creating program"); cl_kernel_arg_type_qualifier arg_type_qualifier = 0;