23.11
|
Go to the documentation of this file.
24 #ifndef ARM_COMPUTE_CLCOMPILECONTEXT_H
25 #define ARM_COMPUTE_CLCOMPILECONTEXT_H
40 using StringSet = std::set<std::string>;
78 const StringSet &
options()
const;
83 StringSet _build_opts;
127 const std::vector<unsigned char> &
binary()
const
135 explicit operator cl::Program()
const;
153 cl::Context _context;
158 std::vector<unsigned char> _binary;
180 Kernel(std::string
name,
const cl::Program &program);
193 explicit operator cl::Kernel()
const
206 using StringSet = std::set<std::string>;
254 const std::string &program_name,
255 const std::string &program_source,
256 const std::string &kernel_path,
257 const StringSet &build_options_set,
258 bool is_binary)
const;
272 void add_built_program(
const std::string &built_program_name,
const cl::Program &program)
const;
331 load_program(
const std::string &program_name,
const std::string &program_source,
bool is_binary)
const;
340 std::string generate_build_options(
const StringSet &
build_options,
const std::string &kernel_path)
const;
349 std::string stringify_set(
const StringSet &s,
const std::string &kernel_path)
const;
351 cl::Context _context;
353 mutable std::map<std::string, const Program> _programs_map;
354 mutable std::map<std::string, cl::Program> _built_programs_map;
355 bool _is_wbsm_supported;
void add_options_if(bool cond, const StringSet &options)
Appends given build options to the current's objects options if a given condition is true.
void add_option_if_else(bool cond, std::string option_true, std::string option_false)
Adds first option if condition is true else the second one.
const StringSet & options() const
Gets the current options list set.
bool fp16_supported() const
Returns true if FP16 is supported by the CL device.
cl::NDRange default_ndrange() const
Return the default NDRange for the device.
cl::Context & context()
Accessor for the associated CL context.
const std::vector< unsigned char > & binary() const
Returns program binary data.
CLBuildOptions()
Default constructor.
size_t max_local_workgroup_size(const cl::Kernel &kernel) const
Find the maximum number of local work items in a workgroup can be supported for the kernel.
bool is_wbsm_supported() const
bool int64_base_atomics_supported() const
Returns true if int64_base_atomics extension is supported by the CL device.
cl_uint get_num_compute_units() const
Return the maximum number of compute units in the device.
int32_t get_ddk_version() const
Return the DDK version.
GPUTarget get_gpu_target() const
Return the Gpu target of the associated device.
void set_context(cl::Context context)
Sets the CL context used to create programs.
void add_options(const StringSet &options)
Appends given build options to the current's objects options.
std::string name() const
Returns program name.
const cl::Device & get_device() const
Gets the CL device for which the programs are created.
void add_option(std::string option)
Adds option to the existing build option list.
void clear_programs_cache()
Clear the library's cache of binary programs.
void set_device(cl::Device device)
Sets the CL device for which the programs are created.
std::string get_device_version() const
Return the device version.
void add_option_if(bool cond, std::string option)
Adds option if a given condition is true;.
Wrapper to configure the Khronos OpenCL C++ header.
Kernel create_kernel(const std::string &kernel_name, const std::string &program_name, const std::string &program_source, const std::string &kernel_path, const StringSet &build_options_set, bool is_binary) const
Creates an OpenCL kernel.
Program()
Default constructor.
Program & operator=(const Program &)=default
Default copy assignment operator.
GPUTarget
Available GPU Targets.
static bool build(const cl::Program &program, const std::string &build_options="")
Build the given CL program.
OpenCL device type class.
Copyright (c) 2017-2023 Arm Limited.
const std::map< std::string, cl::Program > & get_built_programs() const
Access the cache of built OpenCL programs.
Kernel()
Default Constructor.
Kernel & operator=(const Kernel &)=default
Default copy assignment operator.
std::string name() const
Returns kernel name.
void add_built_program(const std::string &built_program_name, const cl::Program &program) const
Add a new built program to the cache.
bool operator==(const CLBuildOptions &other) const
CLCompileContext()
Constructor.
std::set< std::string > build_options