Move CompilerInterface to ExecutionEnvironment

Change-Id: I14afdd8fc41ecd4ac8c8fcbeecda2539bc847288
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2018-08-01 09:06:46 +02:00
committed by sys_ocldev
parent 931b462ee1
commit d2759a0629
18 changed files with 114 additions and 190 deletions

View File

@@ -51,31 +51,21 @@ struct TranslationArgs {
class CompilerInterface {
public:
CompilerInterface();
CompilerInterface(const CompilerInterface &) = delete;
CompilerInterface &operator=(const CompilerInterface &) = delete;
virtual ~CompilerInterface();
static CompilerInterface *getInstance() {
if (pInstance == nullptr) {
std::lock_guard<std::mutex> guard(mtx);
if (pInstance == nullptr) {
auto instance = new CompilerInterface();
if (!instance->initialize()) {
delete instance;
instance = nullptr;
}
pInstance = instance;
}
static CompilerInterface *createInstance() {
auto instance = new CompilerInterface();
if (!instance->initialize()) {
delete instance;
instance = nullptr;
}
return pInstance;
return instance;
}
static void shutdown() {
std::unique_lock<std::mutex> destructionLock(CompilerInterface::mtx);
if (pInstance) {
delete pInstance;
pInstance = nullptr;
}
}
MOCKABLE_VIRTUAL cl_int build(Program &program, const TranslationArgs &pInputArgs, bool enableCaching);
@@ -91,9 +81,6 @@ class CompilerInterface {
BinaryCache *replaceBinaryCache(BinaryCache *newCache);
protected:
CompilerInterface();
virtual ~CompilerInterface();
bool initialize();
static std::mutex mtx;
@@ -103,7 +90,6 @@ class CompilerInterface {
std::unique_ptr<BinaryCache> cache = nullptr;
static bool useLlvmText;
static CompilerInterface *pInstance;
using igcDevCtxUptr = CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtxTagOCL>;
using fclDevCtxUptr = CIF::RAII::UPtr_t<IGC::FclOclDeviceCtxTagOCL>;