From 332e02ef27ecbcc58a534f124a0cb791361d067d Mon Sep 17 00:00:00 2001 From: "Jobczyk, Lukasz" Date: Mon, 14 Oct 2019 15:27:05 +0200 Subject: [PATCH] Disable cl_khr_subgroups extension Related-To: NEO-3807 Change-Id: I03d6a72f897b883c10cff4f31c152d7c9f100b43 Signed-off-by: Jobczyk, Lukasz --- runtime/device/device_caps.cpp | 10 ++++++---- runtime/gen12lp/hw_helper_gen12lp.cpp | 5 +++++ runtime/helpers/hw_helper.h | 3 +++ runtime/helpers/hw_helper_base.inl | 6 ++++++ unit_tests/device/device_caps_tests.cpp | 12 ++++++++++-- unit_tests/platform/platform_tests.cpp | 5 ++++- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index a2ca98cbf7..fc643aadfb 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -123,16 +123,18 @@ void Device::initializeCaps() { auto supportsVme = hwInfo.capabilityTable.supportsVme; auto supportsAdvancedVme = hwInfo.capabilityTable.supportsVme; + deviceInfo.independentForwardProgress = false; + if (enabledClVersion >= 21) { - deviceInfo.independentForwardProgress = true; - deviceExtensions += "cl_khr_subgroups "; + if (hwHelper.allowsIndependentForwardProgress()) { + deviceInfo.independentForwardProgress = true; + deviceExtensions += "cl_khr_subgroups "; + } deviceExtensions += "cl_khr_il_program "; deviceExtensions += "cl_intel_spirv_device_side_avc_motion_estimation "; deviceExtensions += "cl_intel_spirv_media_block_io "; deviceExtensions += "cl_intel_spirv_subgroups "; deviceExtensions += "cl_khr_spirv_no_integer_wrap_decoration "; - } else { - deviceInfo.independentForwardProgress = false; } if (enabledClVersion >= 20) { diff --git a/runtime/gen12lp/hw_helper_gen12lp.cpp b/runtime/gen12lp/hw_helper_gen12lp.cpp index 263fc88ea0..f223d284a1 100644 --- a/runtime/gen12lp/hw_helper_gen12lp.cpp +++ b/runtime/gen12lp/hw_helper_gen12lp.cpp @@ -50,6 +50,11 @@ bool HwHelperHw::obtainRenderBufferCompressionPreference(const HardwareI return Gen12LPHelpers::obtainRenderBufferCompressionPreference(hwInfo, size); } +template <> +bool HwHelperHw::allowsIndependentForwardProgress() { + return false; +} + template <> void HwHelperHw::checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) { if (buffer->getGraphicsAllocation()->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) { diff --git a/runtime/helpers/hw_helper.h b/runtime/helpers/hw_helper.h index cd8449dbf7..122206fb01 100644 --- a/runtime/helpers/hw_helper.h +++ b/runtime/helpers/hw_helper.h @@ -69,6 +69,7 @@ class HwHelper { virtual uint32_t getMocsIndex(GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const = 0; virtual bool requiresAuxResolves() const = 0; virtual bool tilingAllowed(bool isSharedContext, const cl_image_desc &imgDesc, bool forceLinearStorage) = 0; + virtual bool allowsIndependentForwardProgress() = 0; static constexpr uint32_t lowPriorityGpgpuEngineIndex = 1; @@ -170,6 +171,8 @@ class HwHelperHw : public HwHelper { bool tilingAllowed(bool isSharedContext, const cl_image_desc &imgDesc, bool forceLinearStorage) override; + bool allowsIndependentForwardProgress() override; + protected: HwHelperHw() = default; }; diff --git a/runtime/helpers/hw_helper_base.inl b/runtime/helpers/hw_helper_base.inl index dda52d742c..5b0173fedb 100644 --- a/runtime/helpers/hw_helper_base.inl +++ b/runtime/helpers/hw_helper_base.inl @@ -233,4 +233,10 @@ bool HwHelperHw::tilingAllowed(bool isSharedContext, const cl_image_d return !(imageType == CL_MEM_OBJECT_IMAGE1D || imageType == CL_MEM_OBJECT_IMAGE1D_ARRAY || imageType == CL_MEM_OBJECT_IMAGE1D_BUFFER || buffer); } + +template +bool HwHelperHw::allowsIndependentForwardProgress() { + return true; +} + } // namespace NEO diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index 8280dfc829..f98e4bc849 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -118,7 +118,9 @@ TEST(DeviceGetCapsTest, validate) { EXPECT_EQ(16u, caps.maxSubGroups[1]); EXPECT_EQ(32u, caps.maxSubGroups[2]); - if (device->getEnabledClVersion() >= 21) { + auto &hwHelper = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily); + auto subGroupsSupported = hwHelper.allowsIndependentForwardProgress(); + if (device->getEnabledClVersion() >= 21 && subGroupsSupported) { EXPECT_TRUE(caps.independentForwardProgress != 0); } else { EXPECT_FALSE(caps.independentForwardProgress != 0); @@ -355,7 +357,13 @@ TEST(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsC auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); const auto &caps = device->getDeviceInfo(); - EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups"))); + auto &hwHelper = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily); + auto subGroupsSupported = hwHelper.allowsIndependentForwardProgress(); + if (subGroupsSupported) { + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups"))); + } else { + EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_subgroups")))); + } } TEST(DeviceGetCapsTest, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntReportClKhrSubgroupsExtension) { diff --git a/unit_tests/platform/platform_tests.cpp b/unit_tests/platform/platform_tests.cpp index ffb37bdac8..e3643c728e 100644 --- a/unit_tests/platform/platform_tests.cpp +++ b/unit_tests/platform/platform_tests.cpp @@ -77,7 +77,10 @@ TEST_F(PlatformTest, PlatformgetAsCompilerEnabledExtensionsString) { compilerExtensions = pPlatform->peekCompilerExtensions(); EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string(" -cl-ext=-all,+cl"))); - if (std::string(pPlatform->getDevice(0)->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) { + + auto &hwHelper = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily); + auto subGroupsSupported = hwHelper.allowsIndependentForwardProgress(); + if (std::string(pPlatform->getDevice(0)->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos && subGroupsSupported) { EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string("cl_khr_subgroups"))); } }