mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
Add method to device that returns device id.
Change-Id: I0fc5d1e37eb6f49a513c202a89db07ef539646f3
This commit is contained in:
committed by
sys_ocldev
parent
ac2a2de3be
commit
05b93ef221
@@ -267,4 +267,9 @@ GFXCORE_FAMILY Device::getRenderCoreFamily() const {
|
|||||||
bool Device::isSourceLevelDebuggerActive() const {
|
bool Device::isSourceLevelDebuggerActive() const {
|
||||||
return deviceInfo.sourceLevelDebuggerActive;
|
return deviceInfo.sourceLevelDebuggerActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Device::getDeviceIndex() {
|
||||||
|
return osContext->getContextId();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ class Device : public BaseObject<_cl_device_id> {
|
|||||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||||
const HardwareCapabilities &getHardwareCapabilities() { return hardwareCapabilities; }
|
const HardwareCapabilities &getHardwareCapabilities() { return hardwareCapabilities; }
|
||||||
OsContext *getOsContext() const { return osContext; }
|
OsContext *getOsContext() const { return osContext; }
|
||||||
|
uint32_t getDeviceIndex();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Device() = delete;
|
Device() = delete;
|
||||||
|
|||||||
@@ -193,6 +193,16 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachOsContextHasUniqu
|
|||||||
EXPECT_EQ(2u, device->getMemoryManager()->getOsContextCount());
|
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) {
|
TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsArePresentThenIsSimulationReturnsTrue) {
|
||||||
FeatureTable skuTable = *platformDevices[0]->pSkuTable;
|
FeatureTable skuTable = *platformDevices[0]->pSkuTable;
|
||||||
skuTable.ftrSimulationMode = true;
|
skuTable.ftrSimulationMode = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user