diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 91bea9b694..112e494a99 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -109,7 +109,7 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) { EXPECT_EQ(sharedCaps.maxWorkItemSizes[0], sharedCaps.maxWorkGroupSize); EXPECT_EQ(sharedCaps.maxWorkItemSizes[1], sharedCaps.maxWorkGroupSize); EXPECT_EQ(sharedCaps.maxWorkItemSizes[2], sharedCaps.maxWorkGroupSize); - EXPECT_LT(0u, sharedCaps.maxSamplers); + EXPECT_EQ(hwHelper.getMaxNumSamplers(), sharedCaps.maxSamplers); // Minimum requirements for OpenCL 1.x EXPECT_EQ(static_cast(CL_FP_ROUND_TO_NEAREST), CL_FP_ROUND_TO_NEAREST & caps.singleFpConfig); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 5f76e815ab..07c249d803 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -688,6 +688,11 @@ TEST_F(HwHelperTest, givenVariousCachesRequestProperMOCSIndexesAreBeingReturned) } } +HWTEST_F(HwHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen) { + auto &helper = HwHelper::get(renderCoreFamily); + EXPECT_EQ(16u, helper.getMaxNumSamplers()); +} + HWTEST_F(HwHelperTest, givenMultiDispatchInfoWhenAskingForAuxTranslationThenCheckMemObjectsCountAndDebugFlag) { DebugManagerStateRestore restore; MockBuffer buffer; diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index 937f938af7..f0c81b2831 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -91,7 +91,7 @@ void Device::initializeCaps() { deviceInfo.maxWorkItemSizes[0] = deviceInfo.maxWorkGroupSize; deviceInfo.maxWorkItemSizes[1] = deviceInfo.maxWorkGroupSize; deviceInfo.maxWorkItemSizes[2] = deviceInfo.maxWorkGroupSize; - deviceInfo.maxSamplers = 16; + deviceInfo.maxSamplers = hwHelper.getMaxNumSamplers(); deviceInfo.computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(&hwInfo); deviceInfo.maxFrontEndThreads = HwHelper::getMaxThreadsForVfe(hwInfo); diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index d6d5029ac1..f8de77a636 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -37,6 +37,7 @@ class HwHelper { virtual size_t getMaxBarrierRegisterPerSlice() const = 0; virtual uint32_t getComputeUnitsUsedForScratch(const HardwareInfo *pHwInfo) const = 0; virtual uint32_t getPitchAlignmentForImage(const HardwareInfo *hwInfo) = 0; + virtual uint32_t getMaxNumSamplers() const = 0; virtual void setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) = 0; virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo) = 0; virtual void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) = 0; @@ -142,6 +143,8 @@ class HwHelperHw : public HwHelper { uint32_t getPitchAlignmentForImage(const HardwareInfo *hwInfo) override; + uint32_t getMaxNumSamplers() const override; + void setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) override; void adjustDefaultEngineType(HardwareInfo *pHwInfo) override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 61e98befb1..f4eddbbd3f 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -66,6 +66,11 @@ uint32_t HwHelperHw::getPitchAlignmentForImage(const HardwareInfo *hwInf return 4u; } +template +uint32_t HwHelperHw::getMaxNumSamplers() const { + return 16; +} + template const AubMemDump::LrcaHelper &HwHelperHw::getCsTraits(aub_stream::EngineType engineType) const { return *AUBFamilyMapper::csTraits[engineType];