Skip to content

Commit 03540d5

Browse files
Refactor per platform extra settings in ocloc
Signed-off-by: Kamil Kopryk <[email protected]> Related-To: NEO-6382
1 parent 515130d commit 03540d5

35 files changed

+359
-138
lines changed

level_zero/core/test/unit_tests/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ TestEnvironment *environment = nullptr;
5656
using namespace L0::ult;
5757

5858
PRODUCT_FAMILY productFamily = NEO::DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily;
59-
GFXCORE_FAMILY renderCoreFamily = NEO::DEFAULT_TEST_PLATFORM::hwInfo.platform.eRenderCoreFamily;
59+
extern GFXCORE_FAMILY renderCoreFamily;
6060
int32_t revId = -1;
6161
uint32_t euPerSubSlice = 0;
6262
uint32_t sliceCount = 0;

opencl/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp

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

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

@@ -37,3 +38,8 @@ RKLTEST_F(RklHwInfoConfig, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequi
3738
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
3839
EXPECT_TRUE(hwInfoConfig.is3DPipelineSelectWARequired());
3940
}
41+
42+
using CompilerHwInfoConfigHelperTestsRkl = ::testing::Test;
43+
RKLTEST_F(CompilerHwInfoConfigHelperTestsRkl, givenRklWhenIsForceEmuInt32DivRemSPRequiredIsCalledThenReturnsTrue) {
44+
EXPECT_TRUE(CompilerHwInfoConfig::get(productFamily)->isForceEmuInt32DivRemSPRequired());
45+
}

opencl/test/unit_test/gen8/bdw/test_hw_info_config_bdw.cpp

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

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

1011
#include "test.h"
@@ -77,3 +78,8 @@ BDWTEST_F(BdwHwInfo, givenHwInfoConfigStringThenAfterSetupResultingVmeIsDisabled
7778
EXPECT_FALSE(hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption);
7879
EXPECT_FALSE(hwInfo.capabilityTable.supportsVme);
7980
}
81+
82+
using CompilerHwInfoConfigHelperTestsBdw = ::testing::Test;
83+
BDWTEST_F(CompilerHwInfoConfigHelperTestsBdw, givenBdwWhenIsStatelessToStatefulBufferOffsetSupportedIsCalledThenReturnsTrue) {
84+
EXPECT_FALSE(CompilerHwInfoConfig::get(productFamily)->isStatelessToStatefulBufferOffsetSupported());
85+
}

opencl/test/unit_test/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool disabled = false;
6464
using namespace NEO;
6565

6666
PRODUCT_FAMILY productFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily;
67-
GFXCORE_FAMILY renderCoreFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eRenderCoreFamily;
67+
extern GFXCORE_FAMILY renderCoreFamily;
6868

6969
extern std::string lastTest;
7070
bool generateRandomInput = false;

opencl/test/unit_test/offline_compiler/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ set(IGDRCL_SRCS_offline_compiler_tests
6666
${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_compilers.h
6767
${NEO_SHARED_TEST_DIRECTORY}/unit_test/device_binary_format/zebin_tests.h
6868
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp
69+
${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/test_excludes.cpp
6970
${IGDRCL_SRCS_cloc}
7071
${IGDRCL_SRCS_offline_compiler_mock}
7172
${NEO_CORE_tests_compiler_mocks}
@@ -90,9 +91,11 @@ link_directories(${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
9091
add_executable(ocloc_tests ${IGDRCL_SRCS_offline_compiler_tests})
9192

9293
target_include_directories(ocloc_tests PRIVATE
94+
${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/header${BRANCH_DIR_SUFFIX}
95+
${NEO_SHARED_TEST_DIRECTORY}/common/test_configuration/unit_tests
9396
$<TARGET_PROPERTY:ocloc_lib,INCLUDE_DIRECTORIES>
9497
)
95-
target_compile_definitions(ocloc_tests PUBLIC MOCKABLE_VIRTUAL=virtual $<TARGET_PROPERTY:ocloc_lib,INTERFACE_COMPILE_DEFINITIONS>)
98+
target_compile_definitions(ocloc_tests PUBLIC MOCKABLE_VIRTUAL=virtual $<TARGET_PROPERTY:ocloc_lib,INTERFACE_COMPILE_DEFINITIONS> ${TESTED_GEN_FLAGS_DEFINITONS})
9699

97100
target_link_libraries(ocloc_tests gmock-gtest)
98101

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
if(TESTS_GEN12LP)
8+
set(IGDRCL_SRCS_offline_compiler_tests_gen12lp
9+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10+
)
11+
target_sources(ocloc_tests PRIVATE ${IGDRCL_SRCS_offline_compiler_tests_gen12lp})
12+
add_subdirectories()
13+
endif()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
if(TESTS_RKL)
8+
set(IGDRCL_SRCS_offline_compiler_tests_rkl
9+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10+
${CMAKE_CURRENT_SOURCE_DIR}/offline_compiler_tests_rkl.cpp
11+
)
12+
target_sources(ocloc_tests PRIVATE ${IGDRCL_SRCS_offline_compiler_tests_rkl})
13+
endif()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/compiler_interface/compiler_options/compiler_options.h"
9+
10+
#include "opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h"
11+
#include "opencl/test/unit_test/offline_compiler/offline_compiler_tests.h"
12+
#include "test.h"
13+
14+
using namespace NEO;
15+
16+
using MockOfflineCompilerRklTests = ::testing::Test;
17+
RKLTEST_F(MockOfflineCompilerRklTests, givenRklWhenAppendExtraInternalOptionsThenForceEmuInt32DivRemSPIsApplied) {
18+
19+
MockOfflineCompiler mockOfflineCompiler;
20+
mockOfflineCompiler.deviceName = " rkl";
21+
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
22+
std::string internalOptions = mockOfflineCompiler.internalOptions;
23+
mockOfflineCompiler.appendExtraInternalOptions(mockOfflineCompiler.hwInfo, internalOptions);
24+
size_t found = internalOptions.find(NEO::CompilerOptions::forceEmuInt32DivRemSP.data());
25+
EXPECT_NE(std::string::npos, found);
26+
}

opencl/test/unit_test/offline_compiler/gen8/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
if(TESTS_GEN8)
88
set(IGDRCL_SRCS_offline_compiler_tests_gen8
99
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10-
${CMAKE_CURRENT_SOURCE_DIR}/offline_compiler_tests_gen8.cpp
1110
)
1211
target_sources(ocloc_tests PRIVATE ${IGDRCL_SRCS_offline_compiler_tests_gen8})
12+
1313
add_subdirectories()
14+
1415
endif()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
if(TESTS_BDW)
8+
set(IGDRCL_SRCS_offline_compiler_tests_bdw
9+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10+
${CMAKE_CURRENT_SOURCE_DIR}/offline_compiler_tests_bdw.cpp
11+
)
12+
target_sources(ocloc_tests PRIVATE ${IGDRCL_SRCS_offline_compiler_tests_bdw})
13+
14+
endif()

0 commit comments

Comments
 (0)