nngn
Loading...
Searching...
No Matches
anonymous_namespace{pseudo.cpp}::Pseudocomp Struct Reference
Inheritance diagram for anonymous_namespace{pseudo.cpp}::Pseudocomp:
Collaboration diagram for anonymous_namespace{pseudo.cpp}::Pseudocomp:

Public Member Functions

 Pseudocomp ()=default
 
bool init () override
 Must be called before the back end can be used.
 
size_t n_platforms () const override
 
size_t n_devices () const override
 
void get_limits (u64 *p) const override
 
std::string platform_name () const override
 
std::string device_name () const override
 
Buffer create_buffer (MemFlag, size_t, const std::byte *) override
 
bool read_buffer (Buffer, std::size_t, std::size_t, std::byte *, Events) const override
 
bool fill_buffer (Buffer, std::size_t, std::size_t, std::byte, Events) const override
 Fills the buffer with n copies of v.
 
bool fill_buffer (Buffer, std::size_t, std::size_t, std::size_t, const std::byte *, Events) const override
 Fills the buffer with n / pattern_size copies of pattern p.
 
bool write_buffer (Buffer, std::size_t, std::size_t, const std::byte *, Events) const override
 
bool write_buffer_rect (Buffer, std::array< std::size_t, 3 >, std::array< std::size_t, 3 >, std::array< std::size_t, 3 >, std::size_t, std::size_t, std::size_t, std::size_t, const std::byte *, Events) const override
 Writes a rectangular region of a buffer.
 
void * map_buffer (Buffer, MemFlag, std::size_t, std::size_t, Events) const override
 
bool unmap_buffer (Buffer, void *, Events) const override
 
bool release_buffer (Buffer) override
 
Image create_image (Type, std::size_t, std::size_t, MemFlag, const std::byte *) override
 Create an image of the specified size.
 
bool read_image (Image, std::size_t, std::size_t, std::byte *, Events) const override
 
bool fill_image (Image, std::size_t, std::size_t, const void *, Events) const override
 Fills the image with copies of v.
 
bool release_image (Image) override
 
Sampler create_sampler () override
 
bool release_sampler (Sampler) override
 
Program create_program (std::string_view, const char *) override
 Compiles source into a program using compilation options opts.
 
bool release_program (Program) override
 
Kernel create_kernel (Program, const char *, std::size_t, const Type *, const std::size_t *, const std::byte *const *, Events) override
 
bool release_kernel (Kernel) override
 
std::size_t n_events (std::size_t, const Type *) const override
 Number of events generated by execute for arguments types.
 
bool prof_info (ProfInfo, std::size_t, const Event *const *, u64 *) const override
 
bool wait (std::size_t, const Event *const *) const override
 Block until the given events have completed.
 
bool release_events (std::size_t, const Event *const *) const override
 
bool execute (Kernel, ExecFlag, u32, const std::size_t *, const std::size_t *, Events) const override
 
bool execute (Program, const std::string &, ExecFlag, u32, const std::size_t *, const std::size_t *, std::size_t, const Type *, const std::size_t *, const std::byte *const *, Events) const override
 
- Public Member Functions inherited from nngn::Compute
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 Buffer create_buffer (MemFlag flags, std::size_t n, const std::byte *p)=0
 Create a buffer of the specified size.
 
template<typename ... Ts>
bool write_struct (Buffer b, Events events, Ts &&...ts) const
 Writes the variadic arguments sequentially to the buffer.
 
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 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<std::derived_from< Compute::Handle > T>
constexpr auto arg_type
 
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
 

Additional Inherited Members

- Public Types inherited from nngn::Compute
enum class  Backend : u8 { PSEUDOCOMP , OPENCL_BACKEND }
 Indicates which type of back end to create. More...
 
enum class  DeviceType : u8 { 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
}
 Supported parameter types for kernel execution. More...
 
enum  MemFlag : u8 { READ_WRITE = 1u << 0 , WRITE_ONLY = 1u << 1 , READ_ONLY = 1u << 2 }
 Properties of memory blocks. More...
 
enum  ExecFlag : u8 { BLOCKING = 1u << 0 }
 Kernel execution flags. More...
 
enum  Limit : u8 { 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
}
 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.
 
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.
 

Constructor & Destructor Documentation

◆ Pseudocomp()

anonymous_namespace{pseudo.cpp}::Pseudocomp::Pseudocomp ( )
default

Member Function Documentation

◆ create_buffer()

Buffer anonymous_namespace{pseudo.cpp}::Pseudocomp::create_buffer ( MemFlag ,
size_t ,
const std::byte *  )
inlineoverride

◆ create_image()

Image anonymous_namespace{pseudo.cpp}::Pseudocomp::create_image ( Type type,
std::size_t w,
std::size_t h,
MemFlag flags,
const std::byte * p )
inlineoverridevirtual

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()

Kernel anonymous_namespace{pseudo.cpp}::Pseudocomp::create_kernel ( Program ,
const char * ,
std::size_t ,
const Type * ,
const std::size_t * ,
const std::byte *const * ,
Events  )
inlineoverridevirtual

Implements nngn::Compute.

◆ create_program()

Program anonymous_namespace{pseudo.cpp}::Pseudocomp::create_program ( std::string_view src,
const char * opts )
inlineoverridevirtual

Compiles source into a program using compilation options opts.

Implements nngn::Compute.

◆ create_sampler()

Sampler anonymous_namespace{pseudo.cpp}::Pseudocomp::create_sampler ( )
inlineoverridevirtual

Implements nngn::Compute.

◆ device_name()

std::string anonymous_namespace{pseudo.cpp}::Pseudocomp::device_name ( ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ execute() [1/2]

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::execute ( Kernel ,
ExecFlag ,
u32 ,
const std::size_t * ,
const std::size_t * ,
Events  ) const
inlineoverride

◆ execute() [2/2]

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::execute ( Program ,
const std::string & ,
ExecFlag ,
u32 ,
const std::size_t * ,
const std::size_t * ,
std::size_t ,
const Type * ,
const std::size_t * ,
const std::byte *const * ,
Events  ) const
inlineoverride

◆ fill_buffer() [1/2]

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::fill_buffer ( Buffer b,
std::size_t off,
std::size_t n,
std::byte v,
Events events ) const
inlineoverridevirtual

Fills the buffer with n copies of v.

Implements nngn::Compute.

◆ fill_buffer() [2/2]

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

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

n must be a multiple of pattern_size.

Implements nngn::Compute.

◆ fill_image()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::fill_image ( Image i,
std::size_t w,
std::size_t h,
const void * v,
Events events ) const
inlineoverridevirtual

Fills the image with copies of v.

Implements nngn::Compute.

◆ get_limits()

void anonymous_namespace{pseudo.cpp}::Pseudocomp::get_limits ( u64 * p) const
override

◆ init()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::init ( )
inlineoverridevirtual

Must be called before the back end can be used.

Implements nngn::Compute.

◆ map_buffer()

void * anonymous_namespace{pseudo.cpp}::Pseudocomp::map_buffer ( Buffer ,
MemFlag ,
std::size_t ,
std::size_t ,
Events  ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ n_devices()

size_t anonymous_namespace{pseudo.cpp}::Pseudocomp::n_devices ( ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ n_events()

std::size_t anonymous_namespace{pseudo.cpp}::Pseudocomp::n_events ( std::size_t n,
const Type * types ) const
inlineoverridevirtual

Number of events generated by execute for arguments types.

Does not include the event generated by the execution itself.

Implements nngn::Compute.

◆ n_platforms()

size_t anonymous_namespace{pseudo.cpp}::Pseudocomp::n_platforms ( ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ platform_name()

std::string anonymous_namespace{pseudo.cpp}::Pseudocomp::platform_name ( ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ prof_info()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::prof_info ( ProfInfo ,
std::size_t ,
const Event *const * ,
u64 *  ) const
inlineoverride

◆ read_buffer()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::read_buffer ( Buffer ,
std::size_t ,
std::size_t ,
std::byte * ,
Events  ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ read_image()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::read_image ( Image ,
std::size_t ,
std::size_t ,
std::byte * ,
Events  ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ release_buffer()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::release_buffer ( Buffer )
inlineoverridevirtual

Implements nngn::Compute.

◆ release_events()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::release_events ( std::size_t ,
const Event *const *  ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ release_image()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::release_image ( Image )
inlineoverridevirtual

Implements nngn::Compute.

◆ release_kernel()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::release_kernel ( Kernel )
inlineoverridevirtual

Implements nngn::Compute.

◆ release_program()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::release_program ( Program )
inlineoverridevirtual

Implements nngn::Compute.

◆ release_sampler()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::release_sampler ( Sampler )
inlineoverridevirtual

Implements nngn::Compute.

◆ unmap_buffer()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::unmap_buffer ( Buffer ,
void * ,
Events  ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ wait()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::wait ( std::size_t n,
const Event *const * v ) const
inlineoverridevirtual

Block until the given events have completed.

Implements nngn::Compute.

◆ write_buffer()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::write_buffer ( Buffer ,
std::size_t ,
std::size_t ,
const std::byte * ,
Events  ) const
inlineoverridevirtual

Implements nngn::Compute.

◆ write_buffer_rect()

bool anonymous_namespace{pseudo.cpp}::Pseudocomp::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
inlineoverridevirtual

Writes a rectangular region of a buffer.

Arguments are the same as the OpenCL function clEnqueueCopyBufferRect.

Implements nngn::Compute.


The documentation for this struct was generated from the following file: