Skip to content

Commit 12e98fa

Browse files
Add HwInfoConfig methods preventing ICLLP platform enum usage in gen11 file
Signed-off-by: Rafal Maziejuk <[email protected]> Related-To: NEO-4541
1 parent 5d0a13e commit 12e98fa

File tree

11 files changed

+121
-11
lines changed

11 files changed

+121
-11
lines changed

opencl/test/unit_test/gen11/icllp/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
#
66

77
if(TESTS_ICLLP)
8+
set(IGDRCL_SRCS_tests_gen11_icllp_excludes
9+
${CMAKE_CURRENT_SOURCE_DIR}/excludes_icllp.cpp
10+
)
11+
set_property(GLOBAL APPEND PROPERTY IGDRCL_SRCS_tests_excludes ${IGDRCL_SRCS_tests_gen11_icllp_excludes})
12+
813
set(IGDRCL_SRCS_tests_gen11_icllp
14+
${IGDRCL_SRCS_tests_gen11_icllp_excludes}
915
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
1016
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_icllp.cpp
1117
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_icllp.cpp
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "test.h"
9+
10+
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfAdditionalMediaSamplerProgrammingIsRequiredThenFalseIsReturned, IGFX_ICELAKE_LP)
11+
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfInitialFlagsProgrammingIsRequiredThenFalseIsReturned, IGFX_ICELAKE_LP)
12+
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfReturnedCmdSizeForMediaSamplerAdjustmentIsRequiredThenFalseIsReturned, IGFX_ICELAKE_LP)

opencl/test/unit_test/gen11/icllp/test_hw_info_config_icllp.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
*
66
*/
77

8+
#include "shared/source/os_interface/hw_info_config.h"
89
#include "shared/test/common/helpers/default_hw_info.h"
910

1011
#include "test.h"
12+
1113
using namespace NEO;
1214

13-
TEST(IcllpHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
14-
if (IGFX_ICELAKE_LP != productFamily) {
15-
return;
16-
}
15+
using IcllpHwInfoConfig = ::testing::Test;
16+
17+
ICLLPTEST_F(IcllpHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
1718
HardwareInfo hwInfo = *defaultHwInfo;
1819
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
19-
gtSystemInfo = {0};
2020

2121
uint64_t config = 0xdeadbeef;
2222
gtSystemInfo = {0};
@@ -27,6 +27,21 @@ TEST(IcllpHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectT
2727
EXPECT_EQ(0u, gtSystemInfo.EUCount);
2828
}
2929

30+
ICLLPTEST_F(IcllpHwInfoConfig, givenHwInfoConfigWhenAskedIfAdditionalMediaSamplerProgrammingIsRequiredThenTrueIsReturned) {
31+
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
32+
EXPECT_TRUE(hwInfoConfig.isAdditionalMediaSamplerProgrammingRequired());
33+
}
34+
35+
ICLLPTEST_F(IcllpHwInfoConfig, givenHwInfoConfigWhenAskedIfInitialFlagsProgrammingIsRequiredThenTrueIsReturned) {
36+
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
37+
EXPECT_TRUE(hwInfoConfig.isInitialFlagsProgrammingRequired());
38+
}
39+
40+
ICLLPTEST_F(IcllpHwInfoConfig, givenHwInfoConfigWhenAskedIfReturnedCmdSizeForMediaSamplerAdjustmentIsRequiredThenTrueIsReturned) {
41+
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
42+
EXPECT_TRUE(hwInfoConfig.isReturnedCmdSizeForMediaSamplerAdjustmentRequired());
43+
}
44+
3045
using IcllpHwInfo = ::testing::Test;
3146

3247
ICLLPTEST_F(IcllpHwInfo, givenBoolWhenCallIcllpHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {

opencl/test/unit_test/os_interface/hw_info_config_tests.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,18 @@ HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenSettingCapabilityCoherencyFlagT
291291
hwInfoConfig.setCapabilityCoherencyFlag(pInHwInfo, coherency);
292292
EXPECT_TRUE(coherency);
293293
}
294+
295+
HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfAdditionalMediaSamplerProgrammingIsRequiredThenFalseIsReturned) {
296+
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
297+
EXPECT_FALSE(hwInfoConfig.isAdditionalMediaSamplerProgrammingRequired());
298+
}
299+
300+
HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfInitialFlagsProgrammingIsRequiredThenFalseIsReturned) {
301+
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
302+
EXPECT_FALSE(hwInfoConfig.isInitialFlagsProgrammingRequired());
303+
}
304+
305+
HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfReturnedCmdSizeForMediaSamplerAdjustmentIsRequiredThenFalseIsReturned) {
306+
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
307+
EXPECT_FALSE(hwInfoConfig.isReturnedCmdSizeForMediaSamplerAdjustmentRequired());
308+
}

shared/source/gen11/command_stream_receiver_hw_gen11.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ template <>
3939
void CommandStreamReceiverHw<Family>::programMediaSampler(LinearStream &stream, DispatchFlags &dispatchFlags) {
4040
using PWR_CLK_STATE_REGISTER = Family::PWR_CLK_STATE_REGISTER;
4141

42-
if (peekHwInfo().platform.eProductFamily == IGFX_ICELAKE_LP) {
42+
if (HwInfoConfig::get(peekHwInfo().platform.eProductFamily)->isAdditionalMediaSamplerProgrammingRequired()) {
4343
if (dispatchFlags.pipelineSelectArgs.mediaSamplerRequired) {
4444
if (!lastVmeSubslicesConfig) {
4545
PipeControlArgs args;
@@ -120,7 +120,7 @@ void CommandStreamReceiverHw<Family>::programMediaSampler(LinearStream &stream,
120120
template <>
121121
bool CommandStreamReceiverHw<Family>::detectInitProgrammingFlagsRequired(const DispatchFlags &dispatchFlags) const {
122122
bool flag = DebugManager.flags.ForceCsrReprogramming.get();
123-
if (peekHwInfo().platform.eProductFamily == IGFX_ICELAKE_LP) {
123+
if (HwInfoConfig::get(peekHwInfo().platform.eProductFamily)->isInitialFlagsProgrammingRequired()) {
124124
if (!dispatchFlags.pipelineSelectArgs.mediaSamplerRequired) {
125125
if (lastVmeSubslicesConfig) {
126126
flag = true;
@@ -135,7 +135,7 @@ size_t CommandStreamReceiverHw<Family>::getCmdSizeForMediaSampler(bool mediaSamp
135135
typedef typename Family::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
136136
typedef typename Family::PIPE_CONTROL PIPE_CONTROL;
137137

138-
if (peekHwInfo().platform.eProductFamily == IGFX_ICELAKE_LP) {
138+
if (HwInfoConfig::get(peekHwInfo().platform.eProductFamily)->isReturnedCmdSizeForMediaSamplerAdjustmentRequired()) {
139139
if (mediaSamplerRequired) {
140140
if (!lastVmeSubslicesConfig) {
141141
return sizeof(MI_LOAD_REGISTER_IMM) + 2 * sizeof(PIPE_CONTROL);

shared/source/gen11/linux/hw_info_config_icllp.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
1212

1313
namespace NEO {
14+
constexpr static auto gfxProduct = IGFX_ICELAKE_LP;
15+
16+
#include "shared/source/gen11/os_agnostic_hw_info_config_icllp.inl"
1417

1518
template <>
16-
int HwInfoConfigHw<IGFX_ICELAKE_LP>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
19+
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
1720
if (nullptr == osIface) {
1821
return 0;
1922
}
@@ -25,5 +28,5 @@ int HwInfoConfigHw<IGFX_ICELAKE_LP>::configureHardwareCustom(HardwareInfo *hwInf
2528
return 0;
2629
}
2730

28-
template class HwInfoConfigHw<IGFX_ICELAKE_LP>;
31+
template class HwInfoConfigHw<gfxProduct>;
2932
} // namespace NEO
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
template <>
9+
bool HwInfoConfigHw<gfxProduct>::isAdditionalMediaSamplerProgrammingRequired() const {
10+
return true;
11+
}
12+
13+
template <>
14+
bool HwInfoConfigHw<gfxProduct>::isInitialFlagsProgrammingRequired() const {
15+
return true;
16+
}
17+
18+
template <>
19+
bool HwInfoConfigHw<gfxProduct>::isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const {
20+
return true;
21+
}

shared/source/gen11/windows/hw_info_config_icllp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
1111

1212
namespace NEO {
13+
constexpr static auto gfxProduct = IGFX_ICELAKE_LP;
1314

14-
template class HwInfoConfigHw<IGFX_ICELAKE_LP>;
15+
#include "shared/source/gen11/os_agnostic_hw_info_config_icllp.inl"
1516

17+
template class HwInfoConfigHw<gfxProduct>;
1618
} // namespace NEO

shared/source/os_interface/hw_info_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class HwInfoConfig {
6565
virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const = 0;
6666
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;
6767
virtual void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) = 0;
68+
virtual bool isAdditionalMediaSamplerProgrammingRequired() const = 0;
69+
virtual bool isInitialFlagsProgrammingRequired() const = 0;
70+
virtual bool isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const = 0;
6871

6972
protected:
7073
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
@@ -115,6 +118,9 @@ class HwInfoConfigHw : public HwInfoConfig {
115118
bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const override;
116119
bool heapInLocalMem(const HardwareInfo &hwInfo) const override;
117120
void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) override;
121+
bool isAdditionalMediaSamplerProgrammingRequired() const override;
122+
bool isInitialFlagsProgrammingRequired() const override;
123+
bool isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const override;
118124

119125
protected:
120126
HwInfoConfigHw() = default;

shared/source/os_interface/hw_info_config.inl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,19 @@ bool HwInfoConfigHw<gfxProduct>::isPipeControlPriorToNonPipelinedStateCommandsWA
206206
return false;
207207
}
208208

209+
template <PRODUCT_FAMILY gfxProduct>
210+
bool HwInfoConfigHw<gfxProduct>::isAdditionalMediaSamplerProgrammingRequired() const {
211+
return false;
212+
}
213+
214+
template <PRODUCT_FAMILY gfxProduct>
215+
bool HwInfoConfigHw<gfxProduct>::isInitialFlagsProgrammingRequired() const {
216+
return false;
217+
}
218+
219+
template <PRODUCT_FAMILY gfxProduct>
220+
bool HwInfoConfigHw<gfxProduct>::isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const {
221+
return false;
222+
}
223+
209224
} // namespace NEO

0 commit comments

Comments
 (0)