34 CLKernelLibrary::CLKernelLibrary()
42 return _kernel_library;
48 auto program = klib.
program(program_name);
49 const std::string &kernel_path = CLKernelLibrary::get().get_kernel_path();
50 return _compile_context.create_kernel(
kernel_name, program_name, program.program, kernel_path, build_options_set, program.is_binary);
52 std::string CLKernelLibrary::get_program_name(
const std::string &
kernel_name)
const
54 return opencl::ClKernelLibrary::get().program_name(
kernel_name);
56 void CLKernelLibrary::init(std::string kernel_path, cl::Context
context, cl::Device device)
59 opencl::ClKernelLibrary::get().set_kernel_path(kernel_path);
61 void CLKernelLibrary::set_kernel_path(
const std::string &kernel_path)
63 opencl::ClKernelLibrary::get().set_kernel_path(kernel_path);
67 return _compile_context.context();
69 const cl::Device &CLKernelLibrary::get_device()
71 return _compile_context.get_device();
73 void CLKernelLibrary::set_device(cl::Device device)
75 _compile_context.set_device(device);
77 void CLKernelLibrary::set_context(cl::Context
context)
79 _compile_context.set_context(
context);
81 std::string CLKernelLibrary::get_kernel_path()
83 return opencl::ClKernelLibrary::get().kernel_path();
85 void CLKernelLibrary::clear_programs_cache()
87 _compile_context.clear_programs_cache();
89 const std::map<std::string, cl::Program> &CLKernelLibrary::get_built_programs()
const
91 return _compile_context.get_built_programs();
93 void CLKernelLibrary::add_built_program(
const std::string &built_program_name,
const cl::Program &program)
95 _compile_context.add_built_program(built_program_name, program);
99 return _compile_context.fp16_supported();
101 bool CLKernelLibrary::int64_base_atomics_supported()
const
103 return _compile_context.int64_base_atomics_supported();
105 bool CLKernelLibrary::is_wbsm_supported()
107 return _compile_context.is_wbsm_supported();
109 std::pair<std::string, bool> CLKernelLibrary::get_program(
const std::string &program_name)
const
111 auto program_info = opencl::ClKernelLibrary::get().program(program_name);
112 return std::make_pair(std::move(program_info.program), program_info.is_binary);
114 size_t CLKernelLibrary::max_local_workgroup_size(
const cl::Kernel &kernel)
const
116 return _compile_context.max_local_workgroup_size(kernel);
118 cl::NDRange CLKernelLibrary::default_ndrange()
const
120 return _compile_context.default_ndrange();
122 std::string CLKernelLibrary::get_device_version()
124 return _compile_context.get_device_version();
126 cl_uint CLKernelLibrary::get_num_compute_units()
128 return _compile_context.get_num_compute_units();
132 return _compile_context;