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

Function BuildKernels

test_conformance/math_brute_force/common.cpp:573–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571
572 return kernel.str();
573}
574
575cl_int BuildKernels(BuildKernelInfo &info, cl_uint job_id,
576 SourceGenerator generator)
577{
578 // Generate the kernel code.
579 cl_uint vector_size_index = gMinVectorSizeIndex + job_id;
580 auto kernel_name = GetKernelName(vector_size_index);
581 auto source = generator(kernel_name, info.nameInCode, vector_size_index);
582 std::array<const char *, 1> sources{ source.c_str() };
583
584 // Create the program.
585 clProgramWrapper &program = info.programs[vector_size_index];
586 auto options = GetBuildOptions(info);
587 int error =
588 create_single_kernel_helper(gContext, &program, nullptr, sources.size(),
589 sources.data(), nullptr, options.c_str());
590 if (error != CL_SUCCESS)
591 {
592 vlog_error("\t\tFAILED -- Failed to create program. (%d)\n", error);
593 return error;
594 }
595
596 // Create a kernel for each thread. cl_kernels aren't thread safe, so make
597 // one for every thread
598 auto &kernels = info.kernels[vector_size_index];
599 assert(kernels.empty() && "Dirty BuildKernelInfo");
600 kernels.resize(info.threadCount);
601 for (auto &kernel : kernels)
602 {
603 kernel = clCreateKernel(program, kernel_name.c_str(), &error);
604 if (!kernel || error != CL_SUCCESS)
605 {
606 vlog_error("\t\tFAILED -- clCreateKernel() failed: (%d)\n", error);
607 return error;
608 }
609 }
610
611 return CL_SUCCESS;
612}
613

Callers 15

BuildKernelFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernel_HalfFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernel_HalfFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernelFnFunction · 0.85
BuildKernel_HalfFnFunction · 0.85
BuildKernelFnFunction · 0.85

Calls 5

GetKernelNameFunction · 0.85
GetBuildOptionsFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected