Add method to device that returns device id.
Change-Id: I0fc5d1e37eb6f49a513c202a89db07ef539646f3
This commit is contained in:
parent
ac2a2de3be
commit
05b93ef221
|
@ -267,4 +267,9 @@ GFXCORE_FAMILY Device::getRenderCoreFamily() const {
|
|||
bool Device::isSourceLevelDebuggerActive() const {
|
||||
return deviceInfo.sourceLevelDebuggerActive;
|
||||
}
|
||||
|
||||
uint32_t Device::getDeviceIndex() {
|
||||
return osContext->getContextId();
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -133,6 +133,7 @@ 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();
|
||||
|
||||
protected:
|
||||
Device() = delete;
|
||||
|
|
|
@ -193,6 +193,16 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachOsContextHasUniqu
|
|||
EXPECT_EQ(2u, device->getMemoryManager()->getOsContextCount());
|
||||
}
|
||||
|
||||
TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperateDeviceIndex) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.incRefInternal();
|
||||
auto device = std::unique_ptr<Device>(Device::create<Device>(nullptr, &executionEnvironment));
|
||||
auto device2 = std::unique_ptr<Device>(Device::create<Device>(nullptr, &executionEnvironment));
|
||||
|
||||
EXPECT_EQ(0u, device->getDeviceIndex());
|
||||
EXPECT_EQ(1u, device2->getDeviceIndex());
|
||||
}
|
||||
|
||||
TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsArePresentThenIsSimulationReturnsTrue) {
|
||||
FeatureTable skuTable = *platformDevices[0]->pSkuTable;
|
||||
skuTable.ftrSimulationMode = true;
|
||||
|
|
Loading…
Reference in New Issue