37 CLKernelLibrary::CLKernelLibrary() : _compile_context()
44 return _kernel_library;
47 const std::set<std::string> &build_options_set)
const
51 auto program = klib.
program(program_name);
52 const std::string &kernel_path = CLKernelLibrary::get().get_kernel_path();
53 return _compile_context.create_kernel(
kernel_name, program_name, program.program, kernel_path, build_options_set,
56 std::string CLKernelLibrary::get_program_name(
const std::string &
kernel_name)
const
58 return opencl::ClKernelLibrary::get().program_name(
kernel_name);
60 void CLKernelLibrary::init(std::string kernel_path, cl::Context
context, cl::Device device)
63 opencl::ClKernelLibrary::get().set_kernel_path(kernel_path);
65 void CLKernelLibrary::set_kernel_path(
const std::string &kernel_path)
67 opencl::ClKernelLibrary::get().set_kernel_path(kernel_path);
71 return _compile_context.context();
73 const cl::Device &CLKernelLibrary::get_device()
75 return _compile_context.get_device();
77 void CLKernelLibrary::set_device(cl::Device device)
79 _compile_context.set_device(device);
81 void CLKernelLibrary::set_context(cl::Context
context)
83 _compile_context.set_context(
context);
85 std::string CLKernelLibrary::get_kernel_path()
87 return opencl::ClKernelLibrary::get().kernel_path();
89 void CLKernelLibrary::clear_programs_cache()
91 _compile_context.clear_programs_cache();
93 const std::map<std::string, cl::Program> &CLKernelLibrary::get_built_programs()
const
95 return _compile_context.get_built_programs();
97 void CLKernelLibrary::add_built_program(
const std::string &built_program_name,
const cl::Program &program)
99 _compile_context.add_built_program(built_program_name, program);
103 return _compile_context.fp16_supported();
105 bool CLKernelLibrary::int64_base_atomics_supported()
const
107 return _compile_context.int64_base_atomics_supported();
109 bool CLKernelLibrary::is_wbsm_supported()
111 return _compile_context.is_wbsm_supported();
113 std::pair<std::string, bool> CLKernelLibrary::get_program(
const std::string &program_name)
const
115 auto program_info = opencl::ClKernelLibrary::get().program(program_name);
116 return std::make_pair(std::move(program_info.program), program_info.is_binary);
118 size_t CLKernelLibrary::max_local_workgroup_size(
const cl::Kernel &kernel)
const
120 return _compile_context.max_local_workgroup_size(kernel);
122 cl::NDRange CLKernelLibrary::default_ndrange()
const
124 return _compile_context.default_ndrange();
126 std::string CLKernelLibrary::get_device_version()
128 return _compile_context.get_device_version();
130 cl_uint CLKernelLibrary::get_num_compute_units()
132 return _compile_context.get_num_compute_units();
136 return _compile_context;