Core: added queue-wise temporary workspace. WARNING: breaks the fused computation of multiple DOT/GEMV operations

This commit is contained in:
Philippe Tillet
2015-11-27 18:43:46 -05:00
parent dfbe52c20a
commit 386963a6cc
12 changed files with 80 additions and 93 deletions

View File

@@ -1,4 +1,5 @@
#include "isaac/driver/backend.h"
#include "isaac/driver/buffer.h"
#include "isaac/driver/context.h"
#include "isaac/driver/command_queue.h"
#include "isaac/driver/program_cache.h"
@@ -13,6 +14,26 @@ namespace isaac
namespace driver
{
/*-----------------------------------*/
//---------- Temporaries -----------*/
/*-----------------------------------*/
void backend::workspaces::release()
{
for(auto & x: cache_)
delete x.second;
cache_.clear();
}
driver::Buffer & backend::workspaces::get(CommandQueue const & key)
{
if(cache_.find(key)==cache_.end())
return *cache_.insert(std::make_pair(key, new Buffer(key.context(), SIZE))).first->second;
return *cache_.at(key);
}
std::map<CommandQueue, Buffer * > backend::workspaces::cache_;
/*-----------------------------------*/
//---------- Programs --------------*/
/*-----------------------------------*/
@@ -178,6 +199,7 @@ void backend::synchronize(Context const & context)
void backend::release()
{
backend::programs::release();
backend::workspaces::release();
backend::queues::release();
backend::contexts::release();
}