MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / test_kernel_attributes

Function test_kernel_attributes

test_conformance/spir/main.cpp:6410–6493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6408// Temporarily disabled, see GitHub #1284
6409#if 0
6410static bool
6411test_kernel_attributes(cl_device_id device, cl_uint width, const char *folder)
6412{
6413 try_extract(folder);
6414 std::cout << "Running tests:" << std::endl;
6415 bool success = true;
6416 clContextWrapper context;
6417 std::string bc_file_path;
6418 clCommandQueueWrapper queue;
6419 clKernelWrapper kernel;
6420 char attributes[256] = {0};
6421 size_t i, res_size = 0;
6422
6423 unsigned int tests_passed = 0;
6424 CounterEventHandler SuccE(tests_passed, 1);
6425 std::list<std::string> ErrList;
6426 std::string test_name("kernel_attributes");
6427
6428 log_info("kernel_attributes...\n");
6429 AccumulatorEventHandler FailE(ErrList, test_name);
6430
6431 try
6432 {
6433 create_context_and_queue(device, &context, &queue);
6434 get_bc_file_path(folder, "kernel_attributes", bc_file_path, width);
6435 clProgramWrapper bcprog = create_program_from_bc(context, bc_file_path);
6436
6437 // Building the program, so we could create the kernel.
6438 SpirBuildTask build_task(bcprog, device, "-x spir -spir-std=1.2 -cl-kernel-arg-info");
6439 if (!build_task.execute())
6440 {
6441 std::cerr << "Cannot run kernel_attributes suite due to the following build error: "
6442 << build_task.getErrorLog()
6443 << std::endl;
6444 throw std::exception();
6445 }
6446
6447 // Querying the kernel for its attributes.
6448 kernel = create_kernel_helper(bcprog, "test");
6449 cl_int err_code = clGetKernelInfo(kernel, CL_KERNEL_ATTRIBUTES, sizeof(attributes), attributes, &res_size);
6450 if (err_code != CL_SUCCESS)
6451 {
6452 std::cerr << "clGetKernelInfo unable retrieve kernel attributes (error code: " << err_code << " )\n";
6453 throw std::exception();
6454 }
6455
6456 // Building the expected attributes vector.
6457 std::vector<std::string> expected;
6458 expected.push_back(std::string("work_group_size_hint(64,1,1)"));
6459 expected.push_back(std::string("vec_type_hint(float4)"));
6460
6461 std::vector<std::string> actual;
6462 split(attributes, ' ', actual);
6463
6464 for(i = 0; i < expected.size(); ++i)
6465 {
6466 if(std::find(actual.begin(), actual.end(), expected[i]) == actual.end())
6467 {

Callers

nothing calls this directly

Calls 11

try_extractFunction · 0.85
create_context_and_queueFunction · 0.85
get_bc_file_pathFunction · 0.85
create_program_from_bcFunction · 0.85
create_kernel_helperFunction · 0.85
executeMethod · 0.80
getErrorLogMethod · 0.80
emptyMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected