Skip to content

Commit e4e5b5c

Browse files
Add check for vme support
Change-Id: Ic51e87e1e049bce4ce8ce111e35b94d3806db21b Signed-off-by: Cencelewska <[email protected]>
1 parent 5dc20f5 commit e4e5b5c

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

runtime/device/device_caps.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,10 @@ void Device::initializeCaps() {
323323

324324
deviceInfo.vmeAvcSupportsPreemption = hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption;
325325
deviceInfo.vmeAvcSupportsTextureSampler = hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler;
326-
deviceInfo.vmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL;
327-
deviceInfo.vmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL;
326+
if (hwInfo.capabilityTable.supportsVme) {
327+
deviceInfo.vmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL;
328+
deviceInfo.vmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL;
329+
}
328330
deviceInfo.platformHostTimerResolution = getPlatformHostTimerResolution();
329331

330332
deviceInfo.internalDriverVersion = CL_DEVICE_DRIVER_VERSION_INTEL_NEO1;

unit_tests/built_ins/built_in_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,9 @@ TEST_F(BuiltInTests, createProgramFromCodeInternalOptionsFor32Bit) {
11501150
}
11511151

11521152
TEST_F(BuiltInTests, whenQueriedProperVmeVersionIsReturned) {
1153+
if (!pDevice->getHardwareInfo().capabilityTable.supportsVme) {
1154+
GTEST_SKIP();
1155+
}
11531156
cl_uint param;
11541157
auto ret = pDevice->getDeviceInfo(CL_DEVICE_ME_VERSION_INTEL, sizeof(param), &param, nullptr);
11551158
EXPECT_EQ(CL_SUCCESS, ret);

unit_tests/device/device_caps_tests.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,37 @@ TEST(Device_GetCaps, givenDeviceWithNullSourceLevelDebuggerWhenCapsAreInitialize
851851
EXPECT_FALSE(caps.sourceLevelDebuggerActive);
852852
}
853853

854+
TEST(Device_UseCaps, givenCapabilityTableWhenDeviceInitializeCapsThenVmeVersionsAreSetProperly) {
855+
HardwareInfo hwInfo = *platformDevices[0];
856+
857+
cl_uint expectedVmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL;
858+
cl_uint expectedVmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL;
859+
860+
hwInfo.capabilityTable.supportsVme = 0;
861+
hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler = 0;
862+
hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption = 0;
863+
864+
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
865+
device->initializeCaps();
866+
867+
EXPECT_EQ(0u, device->getDeviceInfo().vmeVersion);
868+
EXPECT_EQ(0u, device->getDeviceInfo().vmeAvcVersion);
869+
EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption, device->getDeviceInfo().vmeAvcSupportsPreemption);
870+
EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler, device->getDeviceInfo().vmeAvcSupportsTextureSampler);
871+
872+
hwInfo.capabilityTable.supportsVme = 1;
873+
hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler = 1;
874+
hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption = 1;
875+
876+
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
877+
device->initializeCaps();
878+
879+
EXPECT_EQ(expectedVmeVersion, device->getDeviceInfo().vmeVersion);
880+
EXPECT_EQ(expectedVmeAvcVersion, device->getDeviceInfo().vmeAvcVersion);
881+
EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption, device->getDeviceInfo().vmeAvcSupportsPreemption);
882+
EXPECT_EQ(hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler, device->getDeviceInfo().vmeAvcSupportsTextureSampler);
883+
}
884+
854885
typedef HwHelperTest DeviceCapsWithModifiedHwInfoTest;
855886

856887
TEST_F(DeviceCapsWithModifiedHwInfoTest, givenPlatformWithSourceLevelDebuggerNotSupportedWhenDeviceIsCreatedThenSourceLevelDebuggerActiveIsSetToFalse) {

0 commit comments

Comments
 (0)