Initial commit

This commit is contained in:
Philippe Tillet
2014-08-30 18:02:17 -04:00
parent 5f4bab6e47
commit 609c7af6ce
25 changed files with 5515 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#ifndef ATIDLAS_LAZY_PROGRAM_COMPILER_HPP
#define ATIDLAS_LAZY_PROGRAM_COMPILER_HPP
#include <map>
#include "viennacl/ocl/context.hpp"
namespace atidlas
{
class lazy_program_compiler
{
public:
lazy_program_compiler(viennacl::ocl::context * ctx, std::string const & name, std::string const & src, bool force_recompilation) : ctx_(ctx), name_(name), src_(src), force_recompilation_(force_recompilation){ }
lazy_program_compiler(viennacl::ocl::context * ctx, std::string const & name, bool force_recompilation) : ctx_(ctx), name_(name), force_recompilation_(force_recompilation){ }
void add(std::string const & src) { src_+=src; }
std::string const & src() const { return src_; }
viennacl::ocl::program & program()
{
if (force_recompilation_ && ctx_->has_program(name_))
ctx_->delete_program(name_);
if (!ctx_->has_program(name_))
{
// std::cout << src_ << std::endl;
ctx_->add_program(src_, name_);
}
return ctx_->get_program(name_);
}
private:
viennacl::ocl::context * ctx_;
std::string name_;
std::string src_;
bool force_recompilation_;
};
}
#endif