mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
Pass device index to create method..
Change-Id: Iab493edf1b96a6cecf6e3dba6813824529f0c08b
This commit is contained in:
committed by
sys_ocldev
parent
d24a0accd9
commit
377b99be90
@@ -79,8 +79,8 @@ bool familyEnabled[IGFX_MAX_CORE] = {
|
||||
false,
|
||||
};
|
||||
|
||||
Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment)
|
||||
: hwInfo(hwInfo), executionEnvironment(executionEnvironment) {
|
||||
Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex)
|
||||
: hwInfo(hwInfo), executionEnvironment(executionEnvironment), deviceIndex(deviceIndex) {
|
||||
memset(&deviceInfo, 0, sizeof(deviceInfo));
|
||||
deviceExtensions.reserve(1000);
|
||||
name.reserve(100);
|
||||
@@ -267,9 +267,4 @@ GFXCORE_FAMILY Device::getRenderCoreFamily() const {
|
||||
bool Device::isSourceLevelDebuggerActive() const {
|
||||
return deviceInfo.sourceLevelDebuggerActive;
|
||||
}
|
||||
|
||||
uint32_t Device::getDeviceIndex() {
|
||||
return osContext->getContextId();
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -52,9 +52,9 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
static const cl_ulong objectMagic = 0x8055832341AC8D08LL;
|
||||
|
||||
template <typename T>
|
||||
static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv) {
|
||||
static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv, uint32_t deviceIndex) {
|
||||
pHwInfo = getDeviceInitHwInfo(pHwInfo);
|
||||
T *device = new T(*pHwInfo, execEnv);
|
||||
T *device = new T(*pHwInfo, execEnv, deviceIndex);
|
||||
return createDeviceInternals(pHwInfo, device);
|
||||
}
|
||||
|
||||
@@ -133,14 +133,14 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||
const HardwareCapabilities &getHardwareCapabilities() { return hardwareCapabilities; }
|
||||
OsContext *getOsContext() const { return osContext; }
|
||||
uint32_t getDeviceIndex();
|
||||
uint32_t getDeviceIndex() { return deviceIndex; }
|
||||
bool isFullRangeSvm() {
|
||||
return getHardwareInfo().capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress;
|
||||
}
|
||||
|
||||
protected:
|
||||
Device() = delete;
|
||||
Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment);
|
||||
Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex);
|
||||
|
||||
template <typename T>
|
||||
static T *createDeviceInternals(const HardwareInfo *pHwInfo, T *device) {
|
||||
@@ -178,6 +178,7 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
PreemptionMode preemptionMode;
|
||||
EngineType engineType;
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
uint32_t deviceIndex = 0u;
|
||||
CommandStreamReceiver *commandStreamReceiver = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -154,8 +154,8 @@ bool Platform::initialize() {
|
||||
this->platformInfo.reset(new PlatformInfo);
|
||||
|
||||
this->devices.resize(numDevicesReturned);
|
||||
for (size_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
|
||||
auto pDevice = Device::create<OCLRT::Device>(&hwInfo[deviceOrdinal], executionEnvironment);
|
||||
for (uint32_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
|
||||
auto pDevice = Device::create<OCLRT::Device>(&hwInfo[deviceOrdinal], executionEnvironment, deviceOrdinal);
|
||||
DEBUG_BREAK_IF(!pDevice);
|
||||
if (pDevice) {
|
||||
this->devices[deviceOrdinal] = pDevice;
|
||||
|
||||
Reference in New Issue
Block a user