Files
compute-runtime/runtime/device/sub_device.cpp
Mateusz Jablonski ea64a3fbc3 Add method for getting number of available devices
Related-To: NEO-3691

Change-Id: Ida2454adbfc9b177acbbb320f3f9577849a6fd74
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2019-09-24 06:29:25 +02:00

40 lines
1.0 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/device/sub_device.h"
#include "runtime/device/root_device.h"
namespace NEO {
SubDevice::SubDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex, uint32_t subDeviceIndex, RootDevice &rootDevice) : Device(executionEnvironment, deviceIndex), subDeviceIndex(subDeviceIndex), rootDevice(rootDevice) {}
void SubDevice::retain() {
rootDevice.incRefInternal();
Device::retain();
};
unique_ptr_if_unused<Device> SubDevice::release() {
rootDevice.decRefInternal();
return Device::release();
};
void SubDevice::retainInternal() {
rootDevice.incRefInternal();
}
void SubDevice::releaseInternal() {
rootDevice.decRefInternal();
}
DeviceBitfield SubDevice::getDeviceBitfieldForOsContext() const {
DeviceBitfield deviceBitfield;
deviceBitfield.set(subDeviceIndex);
return deviceBitfield;
}
uint32_t SubDevice::getNumAvailableDevices() const {
return 1u;
}
} // namespace NEO