2018-06-22 18:54:33 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018, Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2018-06-27 17:35:37 +08:00
|
|
|
#pragma once
|
2018-07-12 17:45:02 +08:00
|
|
|
#include "runtime/os_interface/device_factory.h"
|
2018-06-22 18:54:33 +08:00
|
|
|
#include "runtime/utilities/reference_tracked_object.h"
|
|
|
|
|
2018-08-01 15:06:46 +08:00
|
|
|
#include <mutex>
|
|
|
|
|
2018-06-22 18:54:33 +08:00
|
|
|
namespace OCLRT {
|
2018-07-03 16:00:12 +08:00
|
|
|
class GmmHelper;
|
2018-07-11 20:16:35 +08:00
|
|
|
class CommandStreamReceiver;
|
2018-07-11 22:47:49 +08:00
|
|
|
class MemoryManager;
|
2018-07-12 21:47:48 +08:00
|
|
|
class SourceLevelDebugger;
|
2018-08-01 15:06:46 +08:00
|
|
|
class CompilerInterface;
|
2018-07-03 16:00:12 +08:00
|
|
|
struct HardwareInfo;
|
2018-08-10 17:07:17 +08:00
|
|
|
class OSInterface;
|
2018-06-22 18:54:33 +08:00
|
|
|
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
|
2018-07-12 17:45:02 +08:00
|
|
|
private:
|
2018-08-01 15:06:46 +08:00
|
|
|
std::mutex mtx;
|
2018-07-12 17:45:02 +08:00
|
|
|
DeviceFactoryCleaner cleaner;
|
|
|
|
|
2018-07-13 13:42:18 +08:00
|
|
|
protected:
|
|
|
|
std::unique_ptr<GmmHelper> gmmHelper;
|
|
|
|
|
2018-06-27 17:35:37 +08:00
|
|
|
public:
|
2018-07-03 16:00:12 +08:00
|
|
|
ExecutionEnvironment();
|
2018-06-27 17:35:37 +08:00
|
|
|
~ExecutionEnvironment() override;
|
2018-07-23 18:23:48 +08:00
|
|
|
|
2018-07-03 16:00:12 +08:00
|
|
|
void initGmm(const HardwareInfo *hwInfo);
|
2018-07-16 23:11:43 +08:00
|
|
|
bool initializeCommandStreamReceiver(const HardwareInfo *pHwInfo);
|
2018-07-20 15:01:58 +08:00
|
|
|
void initializeMemoryManager(bool enable64KBpages);
|
2018-07-12 21:47:48 +08:00
|
|
|
void initSourceLevelDebugger(const HardwareInfo &hwInfo);
|
2018-07-23 18:23:48 +08:00
|
|
|
|
|
|
|
GmmHelper *getGmmHelper() const;
|
2018-08-01 15:06:46 +08:00
|
|
|
MOCKABLE_VIRTUAL CompilerInterface *getCompilerInterface();
|
2018-07-23 18:23:48 +08:00
|
|
|
|
2018-08-10 17:07:17 +08:00
|
|
|
std::unique_ptr<OSInterface> osInterface;
|
2018-07-11 22:47:49 +08:00
|
|
|
std::unique_ptr<MemoryManager> memoryManager;
|
2018-07-16 19:01:10 +08:00
|
|
|
std::unique_ptr<CommandStreamReceiver> commandStreamReceiver;
|
2018-08-01 15:06:46 +08:00
|
|
|
std::unique_ptr<CompilerInterface> compilerInterface;
|
2018-07-12 21:47:48 +08:00
|
|
|
std::unique_ptr<SourceLevelDebugger> sourceLevelDebugger;
|
2018-06-22 18:54:33 +08:00
|
|
|
};
|
|
|
|
} // namespace OCLRT
|