mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Ensure that every device has execution environment.
Change-Id: I77a203fb5ffd2c6a9309091f5e048f71c58c4c04
This commit is contained in:

committed by
sys_ocldev

parent
92266e4ad1
commit
4fb02f2e99
@ -78,10 +78,10 @@ bool familyEnabled[IGFX_MAX_CORE] = {
|
||||
false,
|
||||
};
|
||||
|
||||
Device::Device(const HardwareInfo &hwInfo)
|
||||
Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment)
|
||||
: memoryManager(nullptr), enabledClVersion(false), hwInfo(hwInfo), commandStreamReceiver(nullptr),
|
||||
tagAddress(nullptr), tagAllocation(nullptr), preemptionAllocation(nullptr),
|
||||
osTime(nullptr), slmWindowStartAddress(nullptr) {
|
||||
osTime(nullptr), slmWindowStartAddress(nullptr), executionEnvironment(executionEnvironment) {
|
||||
memset(&deviceInfo, 0, sizeof(deviceInfo));
|
||||
deviceExtensions.reserve(1000);
|
||||
name.reserve(100);
|
||||
@ -96,6 +96,7 @@ Device::Device(const HardwareInfo &hwInfo)
|
||||
bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == SipKernel::getSipKernelType(hwInfo.pPlatform->eRenderCoreFamily, true));
|
||||
sourceLevelDebugger->initialize(localMemorySipAvailable);
|
||||
}
|
||||
this->executionEnvironment->incRefInternal();
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
@ -128,9 +129,7 @@ Device::~Device() {
|
||||
tagAllocation = nullptr;
|
||||
delete memoryManager;
|
||||
memoryManager = nullptr;
|
||||
if (executionEnvironment) {
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
||||
@ -285,8 +284,4 @@ GFXCORE_FAMILY Device::getRenderCoreFamily() const {
|
||||
bool Device::isSourceLevelDebuggerActive() const {
|
||||
return deviceInfo.sourceLevelDebuggerActive;
|
||||
}
|
||||
void Device::connectToExecutionEnvironment(ExecutionEnvironment *executionEnvironment) {
|
||||
executionEnvironment->incRefInternal();
|
||||
this->executionEnvironment = executionEnvironment;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
@ -55,8 +55,7 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
template <typename T>
|
||||
static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv) {
|
||||
pHwInfo = getDeviceInitHwInfo(pHwInfo);
|
||||
T *device = new T(*pHwInfo);
|
||||
device->connectToExecutionEnvironment(execEnv);
|
||||
T *device = new T(*pHwInfo, execEnv);
|
||||
if (false == createDeviceImpl(pHwInfo, *device)) {
|
||||
delete device;
|
||||
return nullptr;
|
||||
@ -138,11 +137,10 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
bool getEnabled64kbPages();
|
||||
bool isSourceLevelDebuggerActive() const;
|
||||
SourceLevelDebugger *getSourceLevelDebugger() { return sourceLevelDebugger.get(); }
|
||||
void connectToExecutionEnvironment(ExecutionEnvironment *executionEnvironment);
|
||||
|
||||
protected:
|
||||
Device() = delete;
|
||||
Device(const HardwareInfo &hwInfo);
|
||||
Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment);
|
||||
|
||||
static bool createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice);
|
||||
static const HardwareInfo *getDeviceInitHwInfo(const HardwareInfo *pHwInfoIn);
|
||||
|
Reference in New Issue
Block a user