nngn
Loading...
Searching...
No Matches
anonymous_namespace{opencl.cpp}::OpenCLBackend Class Referencefinal
Inheritance diagram for anonymous_namespace{opencl.cpp}::OpenCLBackend:
Collaboration diagram for anonymous_namespace{opencl.cpp}::OpenCLBackend:

Classes

struct  limits
 

Public Member Functions

 OpenCLBackend (OpenCLParameters p)
 
 ~OpenCLBackend (void) final
 
bool init () final
 Must be called before the back end can be used.
 
std::size_t n_platforms () const final
 
std::size_t n_devices () const final
 
void get_limits (u64 *p) const final
 
std::string platform_name () const final
 
std::string device_name () const final
 
Buffer create_buffer (MemFlag flags, std::size_t n, const std::byte *p) final
 Create a buffer of the specified size.
 
bool read_buffer (Buffer b, std::size_t off, std::size_t n, std::byte *p, Events events) const final
 
bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::byte v, Events events) const final
 Fills the buffer with n copies of v.
 
bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::size_t pattern_size, const std::byte *p, Events events) const final
 Fills the buffer with n / pattern_size copies of pattern p.
 
bool write_buffer (Buffer b, std::size_t off, std::size_t n, const std::byte *p, Events events) const final
 
bool write_buffer_rect (Buffer b, std::array< std::size_t, 3 > buffer_origin, std::array< std::size_t, 3 > host_origin, std::array< std::size_t, 3 > region, std::size_t buffer_row_pitch, std::size_t buffer_slice_pitch, std::size_t host_row_pitch, std::size_t host_slice_pitch, const std::byte *p, Events events) const final
 Writes a rectangular region of a buffer.
 
void * map_buffer (Buffer b, MemFlag flags, std::size_t off, std::size_t n, Events events) const final
 
bool unmap_buffer (Buffer b, void *p, Events events) const final
 
bool release_buffer (Buffer b) final
 
Image create_image (Type type, std::size_t w, std::size_t h, MemFlag flags, const std::byte *p) final
 Create an image of the specified size.
 
bool read_image (Image i, std::size_t w, std::size_t h, std::byte *p, Events events) const final
 
bool fill_image (Image i, std::size_t w, std::size_t h, const void *v, Events events) const override
 Fills the image with copies of v.
 
bool release_image (Image i) final
 
Sampler create_sampler () final
 
bool release_sampler (Sampler s) final
 
Program create_program (std::string_view src, const char *opts) final
 Compiles source into a program using compilation options opts.
 
bool release_program (Program p) final
 
Kernel create_kernel (Program program, const char *func, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events) final
 
bool release_kernel (Kernel k) final
 
std::size_t n_events (std::size_t n, const Type *types) const final
 Number of events generated by execute for arguments types.
 
bool prof_info (ProfInfo info, std::size_t n, const Event *const *events, u64 *out) const final
 
bool wait (std::size_t n, const Event *const *e) const final
 Block until the given events have completed.
 
bool release_events (std::size_t n, const Event *const *v) const final
 
bool execute (Kernel kernel, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, Events events) const final
 
bool execute (Program program, const std::string &func, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events) const final
 
 OpenCLBackend (OpenCLParameters p)
 
 ~OpenCLBackend (void) final
 
bool init () final
 Must be called before the back end can be used.
 
std::size_t n_platforms () const final
 
std::size_t n_devices () const final
 
void get_limits (u64 *p) const final
 
std::string platform_name () const final
 
std::string device_name () const final
 
Buffer create_buffer (MemFlag flags, std::size_t n, const std::byte *p) final
 Create a buffer of the specified size.
 
bool read_buffer (Buffer b, std::size_t off, std::size_t n, std::byte *p, Events events) const final
 
bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::byte v, Events events) const final
 Fills the buffer with n copies of v.
 
bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::size_t pattern_size, const std::byte *p, Events events) const final
 Fills the buffer with n / pattern_size copies of pattern p.
 
bool write_buffer (Buffer b, std::size_t off, std::size_t n, const std::byte *p, Events events) const final
 
bool write_buffer_rect (Buffer b, std::array< std::size_t, 3 > buffer_origin, std::array< std::size_t, 3 > host_origin, std::array< std::size_t, 3 > region, std::size_t buffer_row_pitch, std::size_t buffer_slice_pitch, std::size_t host_row_pitch, std::size_t host_slice_pitch, const std::byte *p, Events events) const final
 Writes a rectangular region of a buffer.
 
void * map_buffer (Buffer b, MemFlag flags, std::size_t off, std::size_t n, Events events) const final
 
bool unmap_buffer (Buffer b, void *p, Events events) const final
 
bool release_buffer (Buffer b) final
 
Image create_image (Type type, std::size_t w, std::size_t h, MemFlag flags, const std::byte *p) final
 Create an image of the specified size.
 
bool read_image (Image i, std::size_t w, std::size_t h, std::byte *p, Events events) const final
 
bool fill_image (Image i, std::size_t w, std::size_t h, const void *v, Events events) const override
 Fills the image with copies of v.
 
bool release_image (Image i) final
 
Sampler create_sampler () final
 
bool release_sampler (Sampler s) final
 
Program create_program (std::string_view src, const char *opts) final
 Compiles source into a program using compilation options opts.
 
bool release_program (Program p) final
 
Kernel create_kernel (Program program, const char *func, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events) final
 
bool release_kernel (Kernel k) final
 
std::size_t n_events (std::size_t n, const Type *types) const final
 Number of events generated by execute for arguments types.
 
bool prof_info (ProfInfo info, std::size_t n, const Event *const *events, u64 *out) const final
 
bool wait (std::size_t n, const Event *const *e) const final
 Block until the given events have completed.
 
bool release_events (std::size_t n, const Event *const *v) const final
 
bool execute (Kernel kernel, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, Events events) const final
 
bool execute (Program program, const std::string &func, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events) const final
 
- Public Member Functions inherited from nngn::Compute
virtual bool init ()=0
 Must be called before the back end can be used.
 
virtual size_t n_platforms () const =0
 
virtual size_t n_devices () const =0
 
virtual void get_limits (u64 *p) const =0
 Writes the information described in Limit into p.
 
std::vector< u64get_limits () const
 Convenience overload that allocates the required memory.
 
virtual std::string platform_name () const =0
 
virtual std::string device_name () const =0
 
virtual Buffer create_buffer (MemFlag flags, std::size_t n, const std::byte *p)=0
 Create a buffer of the specified size.
 
virtual bool read_buffer (Buffer b, std::size_t off, std::size_t n, std::byte *p, Events events) const =0
 
virtual bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::byte v, Events events) const =0
 Fills the buffer with n copies of v.
 
virtual bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::size_t pattern_size, const std::byte *p, Events events) const =0
 Fills the buffer with n / pattern_size copies of pattern p.
 
virtual bool write_buffer (Buffer b, std::size_t off, std::size_t n, const std::byte *p, Events events) const =0
 
virtual bool write_buffer_rect (Buffer b, std::array< std::size_t, 3 > buffer_origin, std::array< std::size_t, 3 > host_origin, std::array< std::size_t, 3 > region, std::size_t buffer_row_pitch, std::size_t buffer_slice_pitch, std::size_t host_row_pitch, std::size_t host_slice_pitch, const std::byte *p, Events events) const =0
 Writes a rectangular region of a buffer.
 
virtual void * map_buffer (Buffer b, MemFlag flags, std::size_t off, std::size_t n, Events events) const =0
 
virtual bool unmap_buffer (Buffer b, void *p, Events events) const =0
 
template<typename ... Ts>
bool write_struct (Buffer b, Events events, Ts &&...ts) const
 Writes the variadic arguments sequentially to the buffer.
 
virtual bool release_buffer (Buffer b)=0
 
virtual Image create_image (Type type, std::size_t w, std::size_t h, MemFlag flags, const std::byte *p)=0
 Create an image of the specified size.
 
virtual bool read_image (Image i, std::size_t w, std::size_t h, std::byte *p, Events events) const =0
 
virtual bool fill_image (Image i, std::size_t w, std::size_t h, const void *v, Events events) const =0
 Fills the image with copies of v.
 
virtual bool release_image (Image i)=0
 
virtual Sampler create_sampler ()=0
 
virtual bool release_sampler (Sampler s)=0
 
virtual Program create_program (std::string_view src, const char *opts)=0
 Compiles source into a program using compilation options opts.
 
virtual bool release_program (Program p)=0
 
virtual Kernel create_kernel (Program program, const char *func, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events)=0
 
virtual bool release_kernel (Kernel k)=0
 
virtual std::size_t n_events (std::size_t n, const Type *types) const =0
 Number of events generated by execute for arguments types.
 
virtual bool prof_info (ProfInfo info, std::size_t n, const Event *const *events, u64 *out) const =0
 Collect profiling information from n events.
 
virtual bool wait (std::size_t n, const Event *const *v) const =0
 Block until the given events have completed.
 
virtual bool release_events (std::size_t n, const Event *const *v) const =0
 
virtual bool execute (Kernel kernel, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, Events events) const =0
 
virtual bool execute (Program program, const std::string &func, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events) const =0
 Execute a program with the given arguments.
 
template<typename ... Ts>
Kernel create_kernel (Program program, const char *func, Events events, Ts &&...ts)
 Variadic interface for create_kernel.
 
template<typename ... Ts>
bool execute (Program program, const std::string &func, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, Events events, Ts &&...ts)
 Variadic interface for execute.
 
virtual bool init ()=0
 Must be called before the back end can be used.
 
virtual size_t n_platforms () const =0
 
virtual size_t n_devices () const =0
 
virtual void get_limits (u64 *p) const =0
 Writes the information described in Limit into p.
 
std::vector< u64get_limits () const
 Convenience overload that allocates the required memory.
 
virtual std::string platform_name () const =0
 
virtual std::string device_name () const =0
 
virtual Buffer create_buffer (MemFlag flags, std::size_t n, const std::byte *p)=0
 Create a buffer of the specified size.
 
virtual bool read_buffer (Buffer b, std::size_t off, std::size_t n, std::byte *p, Events events) const =0
 
virtual bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::byte v, Events events) const =0
 Fills the buffer with n copies of v.
 
virtual bool fill_buffer (Buffer b, std::size_t off, std::size_t n, std::size_t pattern_size, const std::byte *p, Events events) const =0
 Fills the buffer with n / pattern_size copies of pattern p.
 
virtual bool write_buffer (Buffer b, std::size_t off, std::size_t n, const std::byte *p, Events events) const =0
 
virtual bool write_buffer_rect (Buffer b, std::array< std::size_t, 3 > buffer_origin, std::array< std::size_t, 3 > host_origin, std::array< std::size_t, 3 > region, std::size_t buffer_row_pitch, std::size_t buffer_slice_pitch, std::size_t host_row_pitch, std::size_t host_slice_pitch, const std::byte *p, Events events) const =0
 Writes a rectangular region of a buffer.
 
virtual void * map_buffer (Buffer b, MemFlag flags, std::size_t off, std::size_t n, Events events) const =0
 
virtual bool unmap_buffer (Buffer b, void *p, Events events) const =0
 
template<typename ... Ts>
bool write_struct (Buffer b, Events events, Ts &&...ts) const
 Writes the variadic arguments sequentially to the buffer.
 
virtual bool release_buffer (Buffer b)=0
 
virtual Image create_image (Type type, std::size_t w, std::size_t h, MemFlag flags, const std::byte *p)=0
 Create an image of the specified size.
 
virtual bool read_image (Image i, std::size_t w, std::size_t h, std::byte *p, Events events) const =0
 
virtual bool fill_image (Image i, std::size_t w, std::size_t h, const void *v, Events events) const =0
 Fills the image with copies of v.
 
virtual bool release_image (Image i)=0
 
virtual Sampler create_sampler ()=0
 
virtual bool release_sampler (Sampler s)=0
 
virtual Program create_program (std::string_view src, const char *opts)=0
 Compiles source into a program using compilation options opts.
 
virtual bool release_program (Program p)=0
 
virtual Kernel create_kernel (Program program, const char *func, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events)=0
 
virtual bool release_kernel (Kernel k)=0
 
virtual std::size_t n_events (std::size_t n, const Type *types) const =0
 Number of events generated by execute for arguments types.
 
virtual bool prof_info (ProfInfo info, std::size_t n, const Event *const *events, u64 *out) const =0
 Collect profiling information from n events.
 
virtual bool wait (std::size_t n, const Event *const *v) const =0
 Block until the given events have completed.
 
virtual bool release_events (std::size_t n, const Event *const *v) const =0
 
virtual bool execute (Kernel kernel, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, Events events) const =0
 
virtual bool execute (Program program, const std::string &func, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, Events events) const =0
 Execute a program with the given arguments.
 
template<typename ... Ts>
Kernel create_kernel (Program program, const char *func, Events events, Ts &&...ts)
 Variadic interface for create_kernel.
 
template<typename ... Ts>
bool execute (Program program, const std::string &func, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, Events events, Ts &&...ts)
 Variadic interface for execute.
 
template<Compute::Type t>
constexpr auto to_vector_type () -> Type
 
template<typename ... Ts>
auto create_kernel (Program program, const char *func, Events events, Ts &&...ts) -> Kernel
 

Private Types

enum  Flag { DEBUG = 1u << 0 , DEBUG = 1u << 0 }
 
enum  Flag { DEBUG = 1u << 0 , DEBUG = 1u << 0 }
 

Private Member Functions

bool set_kernel_args (cl_kernel k, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, cl_event *events, std::vector< cl_mem > *tmp_buffers=nullptr) const
 
bool execute_ (cl_kernel kernel, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, std::size_t n_events, Events events) const
 
bool set_kernel_args (cl_kernel k, std::size_t len, const Type *types, const std::size_t *sizes, const std::byte *const *data, cl_event *events, std::vector< cl_mem > *tmp_buffers=nullptr) const
 
bool execute_ (cl_kernel kernel, ExecFlag flags, u32 n_dim, const std::size_t *global_size, const std::size_t *local_size, std::size_t n_events, Events events) const
 

Private Attributes

Version version = {}
 
nngn::Flags< Flagflags = {}
 
DeviceType preferred_device = {}
 
std::vector< Platformplatforms = {}
 
cl_platform_id platform = {}
 
cl_device_id device = {}
 
cl_context context = {}
 
std::vector< cl_mem > buffers = {}
 
std::vector< cl_mem > images = {}
 
std::vector< cl_sampler > samplers = {}
 
std::vector< cl_program > programs = {}
 
std::vector< cl_kernel > kernels = {}
 
cl_command_queue queue = {}
 
struct anonymous_namespace{opencl.cpp}::OpenCLBackend::limits limits = {}
 

Additional Inherited Members

- Public Types inherited from nngn::Compute
enum class  Backend : u8 { PSEUDOCOMP , OPENCL_BACKEND , PSEUDOCOMP , OPENCL_BACKEND }
 Indicates which type of back end to create. More...
 
enum class  DeviceType : u8 { CPU = 1u << 0 , GPU = 1u << 1 , CPU = 1u << 0 , GPU = 1u << 1 }
 
enum class  Type : u8 {
  NONE , LOCAL , SCALAR_BEGIN , BYTE = SCALAR_BEGIN ,
  INT , UINT , FLOAT , VECTOR_BEGIN ,
  BYTEV = VECTOR_BEGIN , INTV , UINTV , FLOATV ,
  VECTOR_END = FLOATV , DATA , HANDLE_BEGIN , BUFFER = HANDLE_BEGIN ,
  IMAGE , SAMPLER , HANDLE_END = SAMPLER , N ,
  NONE , LOCAL , SCALAR_BEGIN , BYTE = SCALAR_BEGIN ,
  INT , UINT , FLOAT , VECTOR_BEGIN ,
  BYTEV = VECTOR_BEGIN , INTV , UINTV , FLOATV ,
  VECTOR_END = FLOATV , DATA , HANDLE_BEGIN , BUFFER = HANDLE_BEGIN ,
  IMAGE , SAMPLER , HANDLE_END = SAMPLER , N
}
 Supported parameter types for kernel execution. More...
 
enum  MemFlag : u8 {
  READ_WRITE = 1u << 0 , WRITE_ONLY = 1u << 1 , READ_ONLY = 1u << 2 , READ_WRITE = 1u << 0 ,
  WRITE_ONLY = 1u << 1 , READ_ONLY = 1u << 2
}
 Properties of memory blocks. More...
 
enum  ExecFlag : u8 { BLOCKING = 1u << 0 , BLOCKING = 1u << 0 }
 Kernel execution flags. More...
 
enum  Limit : u8 {
  COMPUTE_UNITS , WORK_GROUP_SIZE , LOCAL_MEMORY , N ,
  COMPUTE_UNITS , WORK_GROUP_SIZE , LOCAL_MEMORY , N
}
 Indices for the values accessible via get_limits. More...
 
enum  ProfInfo : u8 {
  QUEUED = 1u << 0 , SUBMIT = 1u << 1 , START = 1u << 2 , END = 1u << 3 ,
  PROF_INFO_MAX = END , PROF_INFO_ALL = QUEUED | SUBMIT | START | END , QUEUED = 1u << 0 , SUBMIT = 1u << 1 ,
  START = 1u << 2 , END = 1u << 3 , PROF_INFO_MAX = END , PROF_INFO_ALL = QUEUED | SUBMIT | START | END
}
 Bit mask indicating which profiling data to collect/return. More...
 
enum class  Backend : u8 { PSEUDOCOMP , OPENCL_BACKEND , PSEUDOCOMP , OPENCL_BACKEND }
 Indicates which type of back end to create. More...
 
enum class  DeviceType : u8 { CPU = 1u << 0 , GPU = 1u << 1 , CPU = 1u << 0 , GPU = 1u << 1 }
 
enum class  Type : u8 {
  NONE , LOCAL , SCALAR_BEGIN , BYTE = SCALAR_BEGIN ,
  INT , UINT , FLOAT , VECTOR_BEGIN ,
  BYTEV = VECTOR_BEGIN , INTV , UINTV , FLOATV ,
  VECTOR_END = FLOATV , DATA , HANDLE_BEGIN , BUFFER = HANDLE_BEGIN ,
  IMAGE , SAMPLER , HANDLE_END = SAMPLER , N ,
  NONE , LOCAL , SCALAR_BEGIN , BYTE = SCALAR_BEGIN ,
  INT , UINT , FLOAT , VECTOR_BEGIN ,
  BYTEV = VECTOR_BEGIN , INTV , UINTV , FLOATV ,
  VECTOR_END = FLOATV , DATA , HANDLE_BEGIN , BUFFER = HANDLE_BEGIN ,
  IMAGE , SAMPLER , HANDLE_END = SAMPLER , N
}
 Supported parameter types for kernel execution. More...
 
enum  MemFlag : u8 {
  READ_WRITE = 1u << 0 , WRITE_ONLY = 1u << 1 , READ_ONLY = 1u << 2 , READ_WRITE = 1u << 0 ,
  WRITE_ONLY = 1u << 1 , READ_ONLY = 1u << 2
}
 Properties of memory blocks. More...
 
enum  ExecFlag : u8 { BLOCKING = 1u << 0 , BLOCKING = 1u << 0 }
 Kernel execution flags. More...
 
enum  Limit : u8 {
  COMPUTE_UNITS , WORK_GROUP_SIZE , LOCAL_MEMORY , N ,
  COMPUTE_UNITS , WORK_GROUP_SIZE , LOCAL_MEMORY , N
}
 Indices for the values accessible via get_limits. More...
 
enum  ProfInfo : u8 {
  QUEUED = 1u << 0 , SUBMIT = 1u << 1 , START = 1u << 2 , END = 1u << 3 ,
  PROF_INFO_MAX = END , PROF_INFO_ALL = QUEUED | SUBMIT | START | END , QUEUED = 1u << 0 , SUBMIT = 1u << 1 ,
  START = 1u << 2 , END = 1u << 3 , PROF_INFO_MAX = END , PROF_INFO_ALL = QUEUED | SUBMIT | START | END
}
 Bit mask indicating which profiling data to collect/return. More...
 
- Static Public Member Functions inherited from nngn::Compute
static constexpr bool is_vector_type (Type t)
 Determines is t is one of the *V vector values in Type.
 
static constexpr bool is_handle_type (Type t)
 
template<Type t>
static constexpr Type to_vector_type ()
 Transforms a scalar type into the equivalent vector type.
 
static std::unique_ptr< Computecreate (Backend b, const void *params=nullptr)
 Creates a back end of the specified type.
 
static constexpr bool is_vector_type (Type t)
 Determines is t is one of the *V vector values in Type.
 
static constexpr bool is_handle_type (Type t)
 
template<Type t>
static constexpr Type to_vector_type ()
 Transforms a scalar type into the equivalent vector type.
 
static std::unique_ptr< Computecreate (Backend b, const void *params=nullptr)
 Creates a back end of the specified type.
 
template<>
constexpr auto arg_type = T::type
 Maps supported types to the equivalent Type value.
 
template<>
constexpr auto arg_type
 
template<>
constexpr auto arg_type
 
template<>
constexpr auto arg_type
 
template<>
constexpr auto arg_type
 
template<>
constexpr auto arg_type
 
template<>
constexpr auto arg_type
 
template<>
constexpr auto arg_type
 
- Static Public Attributes inherited from nngn::Compute
template<typename T >
static constexpr Type arg_type = Type::NONE
 Maps supported types to the equivalent Type value.
 

Member Enumeration Documentation

◆ Flag [1/2]

enum anonymous_namespace{opencl.cpp}::OpenCLBackend::Flag
private
Enumerator
DEBUG 
DEBUG 

◆ Flag [2/2]

enum anonymous_namespace{opencl.cpp}::OpenCLBackend::Flag
private
Enumerator
DEBUG 
DEBUG 

Constructor & Destructor Documentation

◆ OpenCLBackend() [1/2]

anonymous_namespace{opencl.cpp}::OpenCLBackend::OpenCLBackend ( OpenCLParameters  p)
explicit

◆ ~OpenCLBackend() [1/2]

anonymous_namespace{opencl.cpp}::OpenCLBackend::~OpenCLBackend ( void  )
final
Here is the call graph for this function:

◆ OpenCLBackend() [2/2]

anonymous_namespace{opencl.cpp}::OpenCLBackend::OpenCLBackend ( OpenCLParameters  p)
explicit

◆ ~OpenCLBackend() [2/2]

anonymous_namespace{opencl.cpp}::OpenCLBackend::~OpenCLBackend ( void  )
final

Member Function Documentation

◆ create_buffer() [1/2]

auto anonymous_namespace{opencl.cpp}::OpenCLBackend::create_buffer ( MemFlag  flags,
std::size_t  n,
const std::byte *  p 
)
finalvirtual

Create a buffer of the specified size.

Optionally fill it with n bytes starting from p, if not null.

Implements nngn::Compute.

Here is the call graph for this function:

◆ create_buffer() [2/2]

Buffer anonymous_namespace{opencl.cpp}::OpenCLBackend::create_buffer ( MemFlag  flags,
std::size_t  n,
const std::byte *  p 
)
finalvirtual

Create a buffer of the specified size.

Optionally fill it with n bytes starting from p, if not null.

Implements nngn::Compute.

◆ create_image() [1/2]

auto anonymous_namespace{opencl.cpp}::OpenCLBackend::create_image ( Type  type,
std::size_t  w,
std::size_t  h,
MemFlag  flags,
const std::byte *  p 
)
finalvirtual

Create an image of the specified size.

Optionally fill it with w * h bytes starting from p, if not null.

Implements nngn::Compute.

Here is the call graph for this function:

◆ create_image() [2/2]

Image anonymous_namespace{opencl.cpp}::OpenCLBackend::create_image ( Type  type,
std::size_t  w,
std::size_t  h,
MemFlag  flags,
const std::byte *  p 
)
finalvirtual

Create an image of the specified size.

Optionally fill it with w * h bytes starting from p, if not null.

Implements nngn::Compute.

◆ create_kernel() [1/2]

auto anonymous_namespace{opencl.cpp}::OpenCLBackend::create_kernel ( Program  program,
const char *  func,
std::size_t  len,
const Type types,
const std::size_t *  sizes,
const std::byte *const *  data,
Events  events 
)
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ create_kernel() [2/2]

Kernel anonymous_namespace{opencl.cpp}::OpenCLBackend::create_kernel ( Program  program,
const char *  func,
std::size_t  len,
const Type types,
const std::size_t *  sizes,
const std::byte *const *  data,
Events  events 
)
finalvirtual

Implements nngn::Compute.

◆ create_program() [1/2]

auto anonymous_namespace{opencl.cpp}::OpenCLBackend::create_program ( std::string_view  src,
const char *  opts 
)
finalvirtual

Compiles source into a program using compilation options opts.

Implements nngn::Compute.

Here is the call graph for this function:

◆ create_program() [2/2]

Program anonymous_namespace{opencl.cpp}::OpenCLBackend::create_program ( std::string_view  src,
const char *  opts 
)
finalvirtual

Compiles source into a program using compilation options opts.

Implements nngn::Compute.

◆ create_sampler() [1/2]

auto anonymous_namespace{opencl.cpp}::OpenCLBackend::create_sampler ( )
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ create_sampler() [2/2]

Sampler anonymous_namespace{opencl.cpp}::OpenCLBackend::create_sampler ( )
finalvirtual

Implements nngn::Compute.

◆ device_name() [1/2]

std::string anonymous_namespace{opencl.cpp}::OpenCLBackend::device_name ( ) const
finalvirtual

Implements nngn::Compute.

◆ device_name() [2/2]

std::string anonymous_namespace{opencl.cpp}::OpenCLBackend::device_name ( ) const
finalvirtual

Implements nngn::Compute.

◆ execute() [1/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::execute ( Kernel  kernel,
ExecFlag  flags,
u32  n_dim,
const std::size_t *  global_size,
const std::size_t *  local_size,
Events  events 
) const
final
Here is the call graph for this function:

◆ execute() [2/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::execute ( Kernel  kernel,
ExecFlag  flags,
u32  n_dim,
const std::size_t *  global_size,
const std::size_t *  local_size,
Events  events 
) const
final

◆ execute() [3/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::execute ( Program  program,
const std::string &  func,
ExecFlag  flags,
u32  n_dim,
const std::size_t *  global_size,
const std::size_t *  local_size,
std::size_t  len,
const Type types,
const std::size_t *  sizes,
const std::byte *const *  data,
Events  events 
) const
final
Here is the call graph for this function:

◆ execute() [4/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::execute ( Program  program,
const std::string &  func,
ExecFlag  flags,
u32  n_dim,
const std::size_t *  global_size,
const std::size_t *  local_size,
std::size_t  len,
const Type types,
const std::size_t *  sizes,
const std::byte *const *  data,
Events  events 
) const
final

◆ execute_() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::execute_ ( cl_kernel  kernel,
ExecFlag  flags,
u32  n_dim,
const std::size_t *  global_size,
const std::size_t *  local_size,
std::size_t  n_events,
Events  events 
) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute_() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::execute_ ( cl_kernel  kernel,
ExecFlag  flags,
u32  n_dim,
const std::size_t *  global_size,
const std::size_t *  local_size,
std::size_t  n_events,
Events  events 
) const
private

◆ fill_buffer() [1/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::fill_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
std::byte  v,
Events  events 
) const
finalvirtual

Fills the buffer with n copies of v.

Implements nngn::Compute.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_buffer() [2/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::fill_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
std::byte  v,
Events  events 
) const
finalvirtual

Fills the buffer with n copies of v.

Implements nngn::Compute.

◆ fill_buffer() [3/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::fill_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
std::size_t  pattern_size,
const std::byte *  p,
Events  events 
) const
finalvirtual

Fills the buffer with n / pattern_size copies of pattern p.

n must be a multiple of pattern_size.

Implements nngn::Compute.

Here is the call graph for this function:

◆ fill_buffer() [4/4]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::fill_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
std::size_t  pattern_size,
const std::byte *  p,
Events  events 
) const
finalvirtual

Fills the buffer with n / pattern_size copies of pattern p.

n must be a multiple of pattern_size.

Implements nngn::Compute.

◆ fill_image() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::fill_image ( Image  i,
std::size_t  w,
std::size_t  h,
const void *  v,
Events  events 
) const
overridevirtual

Fills the image with copies of v.

Implements nngn::Compute.

Here is the call graph for this function:

◆ fill_image() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::fill_image ( Image  i,
std::size_t  w,
std::size_t  h,
const void *  v,
Events  events 
) const
overridevirtual

Fills the image with copies of v.

Implements nngn::Compute.

◆ get_limits() [1/2]

void anonymous_namespace{opencl.cpp}::OpenCLBackend::get_limits ( u64 *  p) const
inlinefinal

◆ get_limits() [2/2]

void anonymous_namespace{opencl.cpp}::OpenCLBackend::get_limits ( u64 *  p) const
inlinefinal

◆ init() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::init ( )
finalvirtual

Must be called before the back end can be used.

Implements nngn::Compute.

Here is the call graph for this function:

◆ init() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::init ( )
finalvirtual

Must be called before the back end can be used.

Implements nngn::Compute.

◆ map_buffer() [1/2]

void * anonymous_namespace{opencl.cpp}::OpenCLBackend::map_buffer ( Buffer  b,
MemFlag  flags,
std::size_t  off,
std::size_t  n,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ map_buffer() [2/2]

void * anonymous_namespace{opencl.cpp}::OpenCLBackend::map_buffer ( Buffer  b,
MemFlag  flags,
std::size_t  off,
std::size_t  n,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

◆ n_devices() [1/2]

std::size_t anonymous_namespace{opencl.cpp}::OpenCLBackend::n_devices ( ) const
finalvirtual

Implements nngn::Compute.

◆ n_devices() [2/2]

std::size_t anonymous_namespace{opencl.cpp}::OpenCLBackend::n_devices ( ) const
finalvirtual

Implements nngn::Compute.

◆ n_events() [1/2]

std::size_t anonymous_namespace{opencl.cpp}::OpenCLBackend::n_events ( std::size_t  n,
const Type types 
) const
finalvirtual

Number of events generated by execute for arguments types.

Does not include the event generated by the execution itself.

Implements nngn::Compute.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ n_events() [2/2]

std::size_t anonymous_namespace{opencl.cpp}::OpenCLBackend::n_events ( std::size_t  n,
const Type types 
) const
finalvirtual

Number of events generated by execute for arguments types.

Does not include the event generated by the execution itself.

Implements nngn::Compute.

◆ n_platforms() [1/2]

std::size_t anonymous_namespace{opencl.cpp}::OpenCLBackend::n_platforms ( ) const
finalvirtual

Implements nngn::Compute.

◆ n_platforms() [2/2]

std::size_t anonymous_namespace{opencl.cpp}::OpenCLBackend::n_platforms ( ) const
finalvirtual

Implements nngn::Compute.

◆ platform_name() [1/2]

std::string anonymous_namespace{opencl.cpp}::OpenCLBackend::platform_name ( ) const
finalvirtual

Implements nngn::Compute.

◆ platform_name() [2/2]

std::string anonymous_namespace{opencl.cpp}::OpenCLBackend::platform_name ( ) const
finalvirtual

Implements nngn::Compute.

◆ prof_info() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::prof_info ( ProfInfo  info,
std::size_t  n,
const Event *const *  events,
u64 *  out 
) const
final
Here is the call graph for this function:

◆ prof_info() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::prof_info ( ProfInfo  info,
std::size_t  n,
const Event *const *  events,
u64 *  out 
) const
final

◆ read_buffer() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::read_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
std::byte *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ read_buffer() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::read_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
std::byte *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

◆ read_image() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::read_image ( Image  i,
std::size_t  w,
std::size_t  h,
std::byte *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ read_image() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::read_image ( Image  i,
std::size_t  w,
std::size_t  h,
std::byte *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

◆ release_buffer() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_buffer ( Buffer  b)
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ release_buffer() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_buffer ( Buffer  b)
finalvirtual

Implements nngn::Compute.

◆ release_events() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_events ( std::size_t  n,
const Event *const *  v 
) const
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ release_events() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_events ( std::size_t  n,
const Event *const *  v 
) const
finalvirtual

Implements nngn::Compute.

◆ release_image() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_image ( Image  i)
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ release_image() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_image ( Image  i)
finalvirtual

Implements nngn::Compute.

◆ release_kernel() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_kernel ( Kernel  k)
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ release_kernel() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_kernel ( Kernel  k)
finalvirtual

Implements nngn::Compute.

◆ release_program() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_program ( Program  p)
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ release_program() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_program ( Program  p)
finalvirtual

Implements nngn::Compute.

◆ release_sampler() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_sampler ( Sampler  s)
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ release_sampler() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::release_sampler ( Sampler  s)
finalvirtual

Implements nngn::Compute.

◆ set_kernel_args() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::set_kernel_args ( cl_kernel  k,
std::size_t  len,
const Type types,
const std::size_t *  sizes,
const std::byte *const *  data,
cl_event *  events,
std::vector< cl_mem > *  tmp_buffers = nullptr 
) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_kernel_args() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::set_kernel_args ( cl_kernel  k,
std::size_t  len,
const Type types,
const std::size_t *  sizes,
const std::byte *const *  data,
cl_event *  events,
std::vector< cl_mem > *  tmp_buffers = nullptr 
) const
private

◆ unmap_buffer() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::unmap_buffer ( Buffer  b,
void *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ unmap_buffer() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::unmap_buffer ( Buffer  b,
void *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

◆ wait() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::wait ( std::size_t  n,
const Event *const *  v 
) const
finalvirtual

Block until the given events have completed.

Implements nngn::Compute.

Here is the call graph for this function:

◆ wait() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::wait ( std::size_t  n,
const Event *const *  v 
) const
finalvirtual

Block until the given events have completed.

Implements nngn::Compute.

◆ write_buffer() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::write_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
const std::byte *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

Here is the call graph for this function:

◆ write_buffer() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::write_buffer ( Buffer  b,
std::size_t  off,
std::size_t  n,
const std::byte *  p,
Events  events 
) const
finalvirtual

Implements nngn::Compute.

◆ write_buffer_rect() [1/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::write_buffer_rect ( Buffer  b,
std::array< std::size_t, 3 >  buffer_origin,
std::array< std::size_t, 3 >  host_origin,
std::array< std::size_t, 3 >  region,
std::size_t  buffer_row_pitch,
std::size_t  buffer_slice_pitch,
std::size_t  host_row_pitch,
std::size_t  host_slice_pitch,
const std::byte *  p,
Events  events 
) const
finalvirtual

Writes a rectangular region of a buffer.

Arguments are the same as the OpenCL function clEnqueueCopyBufferRect.

Implements nngn::Compute.

Here is the call graph for this function:

◆ write_buffer_rect() [2/2]

bool anonymous_namespace{opencl.cpp}::OpenCLBackend::write_buffer_rect ( Buffer  b,
std::array< std::size_t, 3 >  buffer_origin,
std::array< std::size_t, 3 >  host_origin,
std::array< std::size_t, 3 >  region,
std::size_t  buffer_row_pitch,
std::size_t  buffer_slice_pitch,
std::size_t  host_row_pitch,
std::size_t  host_slice_pitch,
const std::byte *  p,
Events  events 
) const
finalvirtual

Writes a rectangular region of a buffer.

Arguments are the same as the OpenCL function clEnqueueCopyBufferRect.

Implements nngn::Compute.

Member Data Documentation

◆ buffers

std::vector< cl_mem > anonymous_namespace{opencl.cpp}::OpenCLBackend::buffers = {}
private

◆ context

cl_context anonymous_namespace{opencl.cpp}::OpenCLBackend::context = {}
private

◆ device

cl_device_id anonymous_namespace{opencl.cpp}::OpenCLBackend::device = {}
private

◆ flags

nngn::Flags< Flag > anonymous_namespace{opencl.cpp}::OpenCLBackend::flags = {}
private

◆ images

std::vector< cl_mem > anonymous_namespace{opencl.cpp}::OpenCLBackend::images = {}
private

◆ kernels

std::vector< cl_kernel > anonymous_namespace{opencl.cpp}::OpenCLBackend::kernels = {}
private

◆ limits

struct anonymous_namespace{opencl.cpp}::OpenCLBackend::limits anonymous_namespace{opencl.cpp}::OpenCLBackend::limits = {}
private

◆ platform

cl_platform_id anonymous_namespace{opencl.cpp}::OpenCLBackend::platform = {}
private

◆ platforms

std::vector< Platform > anonymous_namespace{opencl.cpp}::OpenCLBackend::platforms = {}
private

◆ preferred_device

DeviceType anonymous_namespace{opencl.cpp}::OpenCLBackend::preferred_device = {}
private

◆ programs

std::vector< cl_program > anonymous_namespace{opencl.cpp}::OpenCLBackend::programs = {}
private

◆ queue

cl_command_queue anonymous_namespace{opencl.cpp}::OpenCLBackend::queue = {}
private

◆ samplers

std::vector< cl_sampler > anonymous_namespace{opencl.cpp}::OpenCLBackend::samplers = {}
private

◆ version

Version anonymous_namespace{opencl.cpp}::OpenCLBackend::version = {}
private

The documentation for this class was generated from the following files: