Driver: Back to global programs caching

This commit is contained in:
Philippe Tillet
2015-07-31 00:43:17 -07:00
parent 81b9f01336
commit afc4ecee98
5 changed files with 36 additions and 47 deletions

View File

@@ -7,7 +7,6 @@
#include "isaac/driver/common.h"
#include "isaac/driver/device.h"
#include "isaac/driver/handle.h"
#include "isaac/driver/program.h"
namespace isaac
{
@@ -15,24 +14,12 @@ namespace isaac
namespace driver
{
class Program;
class ISAACAPI Context
{
friend class Program;
friend class CommandQueue;
friend class Buffer;
class ISAACAPI ProgramsHandler
{
public:
ProgramsHandler(Context const & context);
Program const & add(std::string const & name, std::string const & src);
Program const * find(std::string const & name);
private:
Context const & context_;
std::map<std::string, Program> programs_;
};
public:
explicit Context(cl_context const & context, bool take_ownership = true);
@@ -45,15 +32,12 @@ public:
bool operator<(Context const &) const;
HANDLE_TYPE(cl_context, CUcontext) const & handle() const { return h_; }
ProgramsHandler & programs() { return programs_; }
private:
backend_type backend_;
Device device_;
std::string cache_path_;
HANDLE_TYPE(cl_context, CUcontext) h_;
ProgramsHandler programs_;
};
}

View File

@@ -29,6 +29,14 @@ private:
HANDLE_TYPE(cl_program, CUmodule) h_;
};
class ISAACAPI ProgramsHandler
{
public:
static Program const & add(Context const & scontext, std::string const & name, std::string const & src);
static Program const * find(Context const & context, std::string const & name);
private:
static std::map<driver::Context const *, std::map<std::string, Program> > programs_;
};
}