nngn
Loading...
Searching...
No Matches
opencl.cpp File Reference
#include "os/platform.h"
#include "utils/flags.h"
#include "utils/log.h"
#include "compute.h"
#include <algorithm>
#include "utils/scoped.h"
#include "opencl.h"
Include dependency graph for opencl.cpp:

Classes

class  anonymous_namespace{opencl.cpp}::Device
 
class  anonymous_namespace{opencl.cpp}::Platform
 
class  anonymous_namespace{opencl.cpp}::OpenCLBackend
 
struct  anonymous_namespace{opencl.cpp}::OpenCLBackend::limits
 

Namespaces

namespace  anonymous_namespace{opencl.cpp}
 
namespace  nngn
 

Macros

#define C(V)   case V: return #V;
 
#define LOG_RESULT(f, ...)   (check_result(#f, f(__VA_ARGS__)) == CL_SUCCESS)
 
#define CHECK_RESULT(f, ...)   if(!LOG_RESULT(f, __VA_ARGS__)) return false;
 
#define EVENT_PARAMS(e)
 
#define ENUMERATE(f, ...)   enumerate(#f, f, __VA_ARGS__)
 

Typedefs

using anonymous_namespace{opencl.cpp}::TemporaryBuffers = nngn::scoped< std::vector< cl_mem >, >
 
using anonymous_namespace{opencl.cpp}::TemporaryKernel = nngn::scoped< cl_kernel, >
 
using anonymous_namespace{opencl.cpp}::TemporaryEvents = nngn::scoped< std::vector< cl_event >, >
 

Functions

auto anonymous_namespace{opencl.cpp}::cl_strerror (cl_int e)
 
cl_int anonymous_namespace{opencl.cpp}::check_result (const char *func_name, cl_int result)
 
cl_event * anonymous_namespace{opencl.cpp}::to_cl_events (nngn::Compute::Event *const *e)
 
cl_event * anonymous_namespace{opencl.cpp}::to_cl_events (const nngn::Compute::Event *const *e)
 
nngn::Compute::Event *const * anonymous_namespace{opencl.cpp}::from_cl_event (cl_event *e)
 
std::optional< nngn::Compute::Versionanonymous_namespace{opencl.cpp}::parse_version (std::string_view s)
 
bool anonymous_namespace{opencl.cpp}::version_ge (nngn::Compute::Version lhs, nngn::Compute::Version rhs)
 
template<typename T >
T::const_pointer anonymous_namespace{opencl.cpp}::get_obj (const T &v, const nngn::Compute::Handle &h)
 
template<typename T >
T::pointer anonymous_namespace{opencl.cpp}::get_obj (T &v, const nngn::Compute::Handle &h)
 
template<typename T , typename F , typename... P>
auto anonymous_namespace{opencl.cpp}::enumerate (const char *fn, F f, T *v, const P &...args)
 
template<typename T >
u32 anonymous_namespace{opencl.cpp}::insert_at_first_free (std::vector< T > *v, T t)
 
void anonymous_namespace{opencl.cpp}::release (cl_program x)
 
void anonymous_namespace{opencl.cpp}::release (cl_kernel x)
 
void anonymous_namespace{opencl.cpp}::release (cl_sampler x)
 
void anonymous_namespace{opencl.cpp}::release (cl_mem x)
 
void anonymous_namespace{opencl.cpp}::release (cl_command_queue x)
 
void anonymous_namespace{opencl.cpp}::release (cl_context x)
 
template<>
std::unique_ptr< Compute > nngn::compute_create_backend< backend > (const void *params)
 

Variables

static constexpr auto backend = nngn::Compute::Backend::OPENCL_BACKEND
 

Macro Definition Documentation

◆ C

#define C (   V)    case V: return #V;

◆ CHECK_RESULT

#define CHECK_RESULT (   f,
  ... 
)    if(!LOG_RESULT(f, __VA_ARGS__)) return false;

◆ ENUMERATE

#define ENUMERATE (   f,
  ... 
)    enumerate(#f, f, __VA_ARGS__)

◆ EVENT_PARAMS

#define EVENT_PARAMS (   e)
Value:
static_cast<cl_uint>(e.n_wait), \
to_cl_events(e.wait_list), to_cl_events(e.events)
e
Definition: math.lua:4
cl_event * to_cl_events(nngn::Compute::Event *const *e)
Definition: opencl.cpp:271

◆ LOG_RESULT

#define LOG_RESULT (   f,
  ... 
)    (check_result(#f, f(__VA_ARGS__)) == CL_SUCCESS)

Variable Documentation

◆ backend

constexpr auto backend = nngn::Compute::Backend::OPENCL_BACKEND
staticconstexpr