Skip to content

Commit d234bc9

Browse files
refactor: Move getMaxNumSamplers function to ProductHelper
Signed-off-by: Filip Hazubski <[email protected]>
1 parent 5f22e9e commit d234bc9

15 files changed

+30
-27
lines changed

opencl/test/unit_test/device/device_caps_tests.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
136136
const auto &sharedCaps = device->getSharedDeviceInfo();
137137
const auto &sysInfo = defaultHwInfo->gtSystemInfo;
138138
auto &gfxCoreHelper = device->getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
139+
auto &productHelper = device->getProductHelper();
139140

140141
EXPECT_NE(nullptr, caps.builtInKernels);
141142

@@ -206,7 +207,7 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
206207
EXPECT_EQ(sharedCaps.maxWorkItemSizes[0], sharedCaps.maxWorkGroupSize);
207208
EXPECT_EQ(sharedCaps.maxWorkItemSizes[1], sharedCaps.maxWorkGroupSize);
208209
EXPECT_EQ(sharedCaps.maxWorkItemSizes[2], sharedCaps.maxWorkGroupSize);
209-
EXPECT_EQ(gfxCoreHelper.getMaxNumSamplers(), sharedCaps.maxSamplers);
210+
EXPECT_EQ(productHelper.getMaxNumSamplers(), sharedCaps.maxSamplers);
210211

211212
// Minimum requirements for OpenCL 1.x
212213
EXPECT_EQ(static_cast<cl_device_fp_config>(CL_FP_ROUND_TO_NEAREST), CL_FP_ROUND_TO_NEAREST & caps.singleFpConfig);

opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenXeHpcWhenAskedForMinimialSim
9898
EXPECT_EQ(16u, gfxCoreHelper.getMinimalSIMDSize());
9999
}
100100

101-
XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, whenQueryingMaxNumSamplersThenReturnZero) {
102-
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
103-
EXPECT_EQ(0u, gfxCoreHelper.getMaxNumSamplers());
104-
}
105-
106101
XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, GivenBarrierEncodingWhenCallingGetBarriersCountFromHasBarrierThenNumberOfBarriersIsReturned) {
107102
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
108103

shared/source/device/device_caps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void Device::initializeCaps() {
153153
deviceInfo.maxWorkItemSizes[0] = deviceInfo.maxWorkGroupSize;
154154
deviceInfo.maxWorkItemSizes[1] = deviceInfo.maxWorkGroupSize;
155155
deviceInfo.maxWorkItemSizes[2] = deviceInfo.maxWorkGroupSize;
156-
deviceInfo.maxSamplers = gfxCoreHelper.getMaxNumSamplers();
156+
deviceInfo.maxSamplers = productHelper.getMaxNumSamplers();
157157

158158
deviceInfo.computeUnitsUsedForScratch = gfxCoreHelper.getComputeUnitsUsedForScratch(this->getRootDeviceEnvironment());
159159
deviceInfo.maxFrontEndThreads = gfxCoreHelper.getMaxThreadsForVfe(hwInfo);

shared/source/helpers/gfx_core_helper.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class GfxCoreHelper {
5555
virtual size_t getPaddingForISAAllocation() const = 0;
5656
virtual uint32_t getComputeUnitsUsedForScratch(const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
5757
virtual uint32_t getPitchAlignmentForImage(const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
58-
virtual uint32_t getMaxNumSamplers() const = 0;
5958
virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo, const ProductHelper &productHelper) = 0;
6059
virtual SipKernelType getSipKernelType(bool debuggingActive) const = 0;
6160
virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const = 0;
@@ -221,8 +220,6 @@ class GfxCoreHelperHw : public GfxCoreHelper {
221220

222221
uint32_t getPitchAlignmentForImage(const RootDeviceEnvironment &rootDeviceEnvironment) const override;
223222

224-
uint32_t getMaxNumSamplers() const override;
225-
226223
void adjustDefaultEngineType(HardwareInfo *pHwInfo, const ProductHelper &productHelper) override;
227224

228225
SipKernelType getSipKernelType(bool debuggingActive) const override;

shared/source/helpers/gfx_core_helper_base.inl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ uint32_t GfxCoreHelperHw<Family>::getPitchAlignmentForImage(const RootDeviceEnvi
7272
return 4u;
7373
}
7474

75-
template <typename Family>
76-
uint32_t GfxCoreHelperHw<Family>::getMaxNumSamplers() const {
77-
return 16;
78-
}
79-
8075
template <typename Family>
8176
const AubMemDump::LrcaHelper &GfxCoreHelperHw<Family>::getCsTraits(aub_stream::EngineType engineType) const {
8277
return *AUBFamilyMapper<Family>::csTraits[engineType];

shared/source/os_interface/product_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class ProductHelper {
169169
virtual bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor) const = 0;
170170
virtual bool isLinearStoragePreferred(bool isSharedContext, bool isImage1d, bool forceLinearStorage) const = 0;
171171
virtual bool isTranslationExceptionSupported() const = 0;
172+
virtual uint32_t getMaxNumSamplers() const = 0;
172173

173174
virtual bool getFrontEndPropertyScratchSizeSupport() const = 0;
174175
virtual bool getFrontEndPropertyPrivateScratchSizeSupport() const = 0;

shared/source/os_interface/product_helper.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,4 +777,9 @@ bool ProductHelperHw<gfxProduct>::isTranslationExceptionSupported() const {
777777
return false;
778778
}
779779

780+
template <PRODUCT_FAMILY gfxProduct>
781+
uint32_t ProductHelperHw<gfxProduct>::getMaxNumSamplers() const {
782+
return 16u;
783+
}
784+
780785
} // namespace NEO

shared/source/os_interface/product_helper_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class ProductHelperHw : public ProductHelper {
123123
bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor) const override;
124124
bool isLinearStoragePreferred(bool isSharedContext, bool isImage1d, bool forceLinearStorage) const override;
125125
bool isTranslationExceptionSupported() const override;
126+
uint32_t getMaxNumSamplers() const override;
126127

127128
bool getFrontEndPropertyScratchSizeSupport() const override;
128129
bool getFrontEndPropertyPrivateScratchSizeSupport() const override;

shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ const StackVec<uint32_t, 6> GfxCoreHelperHw<Family>::getThreadsPerEUConfigs() co
145145
return {4, 8};
146146
}
147147

148-
template <>
149-
uint32_t GfxCoreHelperHw<Family>::getMaxNumSamplers() const {
150-
return 0;
151-
}
152-
153148
template <>
154149
size_t MemorySynchronizationCommands<Family>::getSizeForSingleAdditionalSynchronization(const RootDeviceEnvironment &rootDeviceEnvironment) {
155150
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();

shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ bool ProductHelperHw<gfxProduct>::isLinearStoragePreferred(bool isSharedContext,
5858
return true;
5959
}
6060

61+
template <>
62+
uint32_t ProductHelperHw<gfxProduct>::getMaxNumSamplers() const {
63+
return 0u;
64+
}
65+
6166
} // namespace NEO

shared/test/common/mocks/mock_product_helper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ bool ProductHelperHw<IGFX_UNKNOWN>::isPrefetcherDisablingInDirectSubmissionRequi
378378
return true;
379379
}
380380

381+
template <>
382+
uint32_t ProductHelperHw<IGFX_UNKNOWN>::getMaxNumSamplers() const {
383+
return 0u;
384+
}
385+
381386
template <>
382387
uint32_t L1CachePolicyHelper<IGFX_UNKNOWN>::getL1CachePolicy(bool isDebuggerActive) {
383388
return L1CachePolicyHelper<IGFX_UNKNOWN>::getDefaultL1CachePolicy(isDebuggerActive);

shared/test/unit_test/helpers/gfx_core_helper_tests.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -824,11 +824,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, GfxCoreHelperTest, givenVariousCachesRequestThenCorr
824824
}
825825
}
826826

827-
HWTEST_F(GfxCoreHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen) {
828-
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
829-
EXPECT_EQ(16u, gfxCoreHelper.getMaxNumSamplers());
830-
}
831-
832827
HWTEST_F(GfxCoreHelperTest, givenDebugVariableSetWhenAskingForAuxTranslationModeThenReturnCorrectValue) {
833828
DebugManagerStateRestore restore;
834829

shared/test/unit_test/os_interface/product_helper_tests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,3 +746,7 @@ HWTEST_F(ProductHelperTest, givenProductHelperAndKernelBinaryFormatsWhenChecking
746746
HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsTranslationExceptionSupportedThenReturnFalse) {
747747
EXPECT_FALSE(productHelper->isTranslationExceptionSupported());
748748
}
749+
750+
HWTEST_F(ProductHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen) {
751+
EXPECT_EQ(16u, productHelper->getMaxNumSamplers());
752+
}

shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ HWTEST_EXCLUDE_PRODUCT(DrmMemoryManagerTest, givenDrmAllocationWithWithAlignment
1515
HWTEST_EXCLUDE_PRODUCT(WalkerPartitionTests, givenMiAtomicWhenItIsProgrammedThenAllFieldsAreSetCorrectly, IGFX_XE_HPC_CORE);
1616
HWTEST_EXCLUDE_PRODUCT(WalkerPartitionTests, givenProgramBatchBufferStartCommandWhenItIsCalledThenCommandIsProgrammedCorrectly, IGFX_XE_HPC_CORE);
1717
HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, givenDefaultGfxCoreHelperHwWhenMinimalSIMDSizeIsQueriedThen8IsReturned, IGFX_XE_HPC_CORE);
18-
HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen, IGFX_XE_HPC_CORE);
1918
HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, givenGfxCoreHelperWhenGettingIfRevisionSpecificBinaryBuiltinIsRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE);
2019
HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero, IGFX_XE_HPC_CORE);
2120
HWTEST_EXCLUDE_PRODUCT(PipeControlHelperTests, givenGfxCoreHelperwhenAskingForDcFlushThenReturnTrue, IGFX_XE_HPC_CORE);
@@ -43,6 +42,7 @@ HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfPipeContr
4342
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfTile64With3DSurfaceOnBCSIsSupportedThenTrueIsReturned, IGFX_XE_HPC_CORE);
4443
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenIsPrefetcherDisablingInDirectSubmissionRequiredThenTrueIsReturned, IGFX_XE_HPC_CORE);
4544
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperAndKernelBinaryFormatsWhenCheckingIsDetectIndirectAccessInKernelSupportedThenCorrectValueIsReturned, IGFX_XE_HPC_CORE);
45+
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen, IGFX_XE_HPC_CORE);
4646
HWTEST_EXCLUDE_PRODUCT(DirectSubmissionTest, givenDebugFlagSetWhenDispatchingPrefetcherThenSetCorrectValue, IGFX_XE_HPC_CORE);
4747
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenRingBufferAllocationWhenGetAllocationDataIsCalledThenItHasProperFieldsSet, IGFX_XE_HPC_CORE);
4848
HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenSemaphoreBufferAllocationWhenGetAllocationDataIsCalledThenItHasProperFieldsSet, IGFX_XE_HPC_CORE);

shared/test/unit_test/xe_hpc_core/pvc/test_product_helper_pvc.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,4 +293,8 @@ PVCTEST_F(PvcProductHelper, givenPvcProductHelperAndKernelBinaryFormatsWhenCheck
293293
kernelDescriptor.kernelAttributes.simdSize = 8u;
294294
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor));
295295
}
296-
}
296+
}
297+
298+
PVCTEST_F(PvcProductHelper, whenQueryingMaxNumSamplersThenReturnZero) {
299+
EXPECT_EQ(0u, productHelper->getMaxNumSamplers());
300+
}

0 commit comments

Comments
 (0)