From 3dbe37c423802ecd6c0efb24e0b58b895617f62d Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 10 May 2021 11:53:11 +0000 Subject: [PATCH] Correct media_block_io extension reporting Signed-off-by: Kamil Kopryk --- opencl/source/cl_device/cl_device_caps.cpp | 2 +- .../unit_test/device/device_caps_tests.cpp | 44 ++++++++++++------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 09ddcb7c70..284f8f4fac 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -146,7 +146,7 @@ void ClDevice::initializeCaps() { if (supportsVme) { deviceExtensions += "cl_intel_spirv_device_side_avc_motion_estimation "; } - if (hwInfo.capabilityTable.supportsImages) { + if (hwHelper.isMediaBlockIOSupported(hwInfo)) { deviceExtensions += "cl_intel_spirv_media_block_io "; } deviceExtensions += "cl_intel_spirv_subgroups "; diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 1cd33576b3..48d8f81c00 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -569,21 +569,27 @@ TEST_F(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReport auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); const auto &caps = device->getDeviceInfo(); const HardwareInfo *hwInfo = defaultHwInfo.get(); + auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily); + { + if (hwInfo->capabilityTable.supportsVme) { + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_device_side_avc_motion_estimation"))); + } else { + EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_device_side_avc_motion_estimation")))); + } + if (hwInfo->capabilityTable.supportsImages) { + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_3d_image_writes"))); + } else { + EXPECT_THAT(caps.deviceExtensions, testing::Not(std::string("cl_khr_3d_image_writes"))); + } + if (hwHelper.isMediaBlockIOSupported(*hwInfo)) { + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))); + } else { + EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")))); + } - if (hwInfo->capabilityTable.supportsVme) { - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_device_side_avc_motion_estimation"))); - } else { - EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_device_side_avc_motion_estimation")))); + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_subgroups"))); + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_spirv_no_integer_wrap_decoration"))); } - if (hwInfo->capabilityTable.supportsImages) { - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))); - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_3d_image_writes"))); - } else { - EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")))); - EXPECT_THAT(caps.deviceExtensions, testing::Not(std::string("cl_khr_3d_image_writes"))); - } - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_subgroups"))); - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_spirv_no_integer_wrap_decoration"))); } TEST_F(DeviceGetCapsTest, givenSupportImagesWhenCapsAreCreatedThenDeviceReportsClIntelSpirvMediaBlockIoExtensions) { @@ -593,7 +599,11 @@ TEST_F(DeviceGetCapsTest, givenSupportImagesWhenCapsAreCreatedThenDeviceReportsC hwInfo.capabilityTable.supportsImages = true; auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); const auto &caps = device->getDeviceInfo(); - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))); + + auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + if (hwHelper.isMediaBlockIOSupported(hwInfo)) { + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))); + } } TEST_F(DeviceGetCapsTest, givenNotSupportImagesWhenCapsAreCreatedThenDeviceNotReportsClIntelSpirvMediaBlockIoExtensions) { @@ -985,9 +995,11 @@ TEST_F(DeviceGetCapsTest, givenSupportImagesWhenCreateExtentionsListThenDeviceRe EXPECT_THAT(extensions, testing::HasSubstr(std::string("cl_khr_image2d_from_buffer"))); EXPECT_THAT(extensions, testing::HasSubstr(std::string("cl_khr_depth_images"))); - auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - if (hwHelper.isMediaBlockIOSupported(*defaultHwInfo)) { + auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + if (hwHelper.isMediaBlockIOSupported(hwInfo)) { EXPECT_THAT(extensions, testing::HasSubstr(std::string("cl_intel_media_block_io"))); + } else { + EXPECT_THAT(extensions, testing::Not(testing::HasSubstr(std::string("cl_intel_media_block_io")))); } }