From e4e5b5ccdf1e6ee64304e2799a1aae164f66adfb Mon Sep 17 00:00:00 2001 From: Cencelewska Date: Fri, 12 Jul 2019 11:40:15 +0200 Subject: [PATCH] Add check for vme support Change-Id: Ic51e87e1e049bce4ce8ce111e35b94d3806db21b Signed-off-by: Cencelewska --- runtime/device/device_caps.cpp | 6 +++-- unit_tests/built_ins/built_in_tests.cpp | 3 +++ unit_tests/device/device_caps_tests.cpp | 31 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 79613886fa..c53f678b89 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -323,8 +323,10 @@ void Device::initializeCaps() { deviceInfo.vmeAvcSupportsPreemption = hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption; deviceInfo.vmeAvcSupportsTextureSampler = hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler; - deviceInfo.vmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL; - deviceInfo.vmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL; + if (hwInfo.capabilityTable.supportsVme) { + deviceInfo.vmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL; + deviceInfo.vmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL; + } deviceInfo.platformHostTimerResolution = getPlatformHostTimerResolution(); deviceInfo.internalDriverVersion = CL_DEVICE_DRIVER_VERSION_INTEL_NEO1; diff --git a/unit_tests/built_ins/built_in_tests.cpp b/unit_tests/built_ins/built_in_tests.cpp index 0ed4195445..f69a1d2a94 100644 --- a/unit_tests/built_ins/built_in_tests.cpp +++ b/unit_tests/built_ins/built_in_tests.cpp @@ -1150,6 +1150,9 @@ TEST_F(BuiltInTests, createProgramFromCodeInternalOptionsFor32Bit) { } TEST_F(BuiltInTests, whenQueriedProperVmeVersionIsReturned) { + if (!pDevice->getHardwareInfo().capabilityTable.supportsVme) { + GTEST_SKIP(); + } cl_uint param; auto ret = pDevice->getDeviceInfo(CL_DEVICE_ME_VERSION_INTEL, sizeof(param), ¶m, nullptr); EXPECT_EQ(CL_SUCCESS, ret); diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index fcf5b3b5e3..be9e2e76ee 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -851,6 +851,37 @@ TEST(Device_GetCaps, givenDeviceWithNullSourceLevelDebuggerWhenCapsAreInitialize EXPECT_FALSE(caps.sourceLevelDebuggerActive); } +TEST(Device_UseCaps, givenCapabilityTableWhenDeviceInitializeCapsThenVmeVersionsAreSetProperly) { + HardwareInfo hwInfo = *platformDevices[0]; + + cl_uint expectedVmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL; + cl_uint expectedVmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL; + + hwInfo.capabilityTable.supportsVme = 0; + hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler = 0; + hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption = 0; + + std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + device->initializeCaps(); + + EXPECT_EQ(0u, device->getDeviceInfo().vmeVersion); + EXPECT_EQ(0u, device->getDeviceInfo().vmeAvcVersion); + EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption, device->getDeviceInfo().vmeAvcSupportsPreemption); + EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler, device->getDeviceInfo().vmeAvcSupportsTextureSampler); + + hwInfo.capabilityTable.supportsVme = 1; + hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler = 1; + hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption = 1; + + device.reset(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); + device->initializeCaps(); + + EXPECT_EQ(expectedVmeVersion, device->getDeviceInfo().vmeVersion); + EXPECT_EQ(expectedVmeAvcVersion, device->getDeviceInfo().vmeAvcVersion); + EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption, device->getDeviceInfo().vmeAvcSupportsPreemption); + EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler, device->getDeviceInfo().vmeAvcSupportsTextureSampler); +} + typedef HwHelperTest DeviceCapsWithModifiedHwInfoTest; TEST_F(DeviceCapsWithModifiedHwInfoTest, givenPlatformWithSourceLevelDebuggerNotSupportedWhenDeviceIsCreatedThenSourceLevelDebuggerActiveIsSetToFalse) {