Models: cleaning of the global caching mechanism

This commit is contained in:
Philippe Tillet
2015-08-04 10:06:52 -07:00
parent d88ff6b39b
commit df2d5e7d00
6 changed files with 53 additions and 34 deletions

View File

@@ -37,13 +37,21 @@ namespace isaac
driver::CommandQueue queue_;
};
typedef std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<model> > model_map_t;
model_map_t init_models(driver::CommandQueue const & queue);
model_map_t& models(driver::CommandQueue & queue);
class models
{
public:
typedef std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<model> > map_type;
private:
static void import(std::string const & fname, driver::CommandQueue const & queue);
static map_type & init(driver::CommandQueue const & queue);
public:
static map_type & get(driver::CommandQueue const & queue);
static void set(driver::CommandQueue const & queue, expression_type operation, numeric_type dtype, std::shared_ptr<model> const & model);
private:
static std::map<driver::CommandQueue, map_type> data_;
};
extern std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::base> > fallbacks;
extern std::map<driver::Device, model_map_t> models_;
}

View File

@@ -8,7 +8,7 @@ namespace isaac
{
/** @brief Executes a array_expression on the given queue for the given models map*/
void execute(controller<array_expression> const & , model_map_t &);
void execute(controller<array_expression> const & , models::map_type &);
}