2015-01-12 13:20:53 -05:00
|
|
|
#ifndef ATIDLAS_BACKEND_BINDER_H
|
|
|
|
#define ATIDLAS_BACKEND_BINDER_H
|
|
|
|
|
|
|
|
#include <map>
|
2015-01-27 16:14:02 -05:00
|
|
|
#include <CL/cl.hpp>
|
2015-01-12 13:20:53 -05:00
|
|
|
|
|
|
|
namespace atidlas
|
|
|
|
{
|
|
|
|
|
|
|
|
enum binding_policy_t
|
|
|
|
{
|
|
|
|
BIND_ALL_UNIQUE,
|
|
|
|
BIND_TO_HANDLE
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class symbolic_binder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~symbolic_binder();
|
2015-01-18 14:52:45 -05:00
|
|
|
virtual bool bind(cl_mem ph) = 0;
|
|
|
|
virtual unsigned int get(cl_mem ph) = 0;
|
2015-01-12 13:20:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class bind_to_handle : public symbolic_binder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bind_to_handle();
|
2015-01-18 14:52:45 -05:00
|
|
|
bool bind(cl_mem ph);
|
|
|
|
unsigned int get(cl_mem ph);
|
2015-01-12 13:20:53 -05:00
|
|
|
private:
|
|
|
|
unsigned int current_arg_;
|
|
|
|
std::map<void*,unsigned int> memory;
|
|
|
|
};
|
|
|
|
|
|
|
|
class bind_all_unique : public symbolic_binder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bind_all_unique();
|
2015-01-18 14:52:45 -05:00
|
|
|
bool bind(cl_mem);
|
|
|
|
unsigned int get(cl_mem);
|
2015-01-12 13:20:53 -05:00
|
|
|
private:
|
|
|
|
unsigned int current_arg_;
|
|
|
|
std::map<void*,unsigned int> memory;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|