mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Add a getRootDeviceIndex method
Change-Id: I7f46a42b5ce25a53365b9faaeba62f2c3232f104 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
9ed6194420
commit
77d7d9f740
@@ -91,6 +91,7 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||
const HardwareCapabilities &getHardwareCapabilities() const { return hardwareCapabilities; }
|
||||
uint32_t getDeviceIndex() const { return deviceIndex; }
|
||||
virtual uint32_t getRootDeviceIndex() const = 0;
|
||||
bool isFullRangeSvm() const {
|
||||
return executionEnvironment->isFullRangeSvm();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ uint32_t RootDevice::getNumSubDevices() const {
|
||||
return static_cast<uint32_t>(subdevices.size());
|
||||
}
|
||||
|
||||
uint32_t RootDevice::getRootDeviceIndex() const {
|
||||
return this->deviceIndex;
|
||||
}
|
||||
|
||||
uint32_t RootDevice::getNumAvailableDevices() const {
|
||||
if (subdevices.empty()) {
|
||||
return 1u;
|
||||
|
||||
@@ -19,6 +19,7 @@ class RootDevice : public Device {
|
||||
bool createDeviceImpl() override;
|
||||
uint32_t getNumAvailableDevices() const override;
|
||||
uint32_t getNumSubDevices() const;
|
||||
uint32_t getRootDeviceIndex() const override;
|
||||
Device *getDeviceById(uint32_t deviceId) const override;
|
||||
|
||||
/* We hide the retain and release function of BaseObject. */
|
||||
|
||||
@@ -35,6 +35,9 @@ DeviceBitfield SubDevice::getDeviceBitfieldForOsContext() const {
|
||||
uint32_t SubDevice::getNumAvailableDevices() const {
|
||||
return 1u;
|
||||
}
|
||||
uint32_t SubDevice::getRootDeviceIndex() const {
|
||||
return this->rootDevice.getRootDeviceIndex();
|
||||
}
|
||||
Device *SubDevice::getDeviceById(uint32_t deviceId) const {
|
||||
UNRECOVERABLE_IF(deviceId >= getNumAvailableDevices());
|
||||
return const_cast<SubDevice *>(this);
|
||||
|
||||
@@ -18,6 +18,7 @@ class SubDevice : public Device {
|
||||
void retainInternal();
|
||||
void releaseInternal();
|
||||
uint32_t getNumAvailableDevices() const override;
|
||||
uint32_t getRootDeviceIndex() const override;
|
||||
Device *getDeviceById(uint32_t deviceId) const override;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user