Skip to content

Commit eb97469

Browse files
Move API agnotic gen8 tests to shared
Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 38ace23 commit eb97469

21 files changed

+192
-209
lines changed

opencl/test/unit_test/fixtures/media_kernel_fixture.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
*/
77

88
#pragma once
9+
#include "shared/test/common/helpers/default_hw_info.h"
10+
911
#include "opencl/test/unit_test/command_queue/enqueue_fixture.h"
1012
#include "opencl/test/unit_test/fixtures/hello_world_fixture.h"
1113
#include "opencl/test/unit_test/helpers/cl_hw_parse.h"
12-
#include "opencl/test/unit_test/mocks/mock_platform.h"
1314

1415
namespace NEO {
1516

@@ -57,7 +58,7 @@ struct MediaKernelFixture : public HelloWorldFixture<FactoryType>,
5758
}
5859

5960
void SetUp() override {
60-
skipVmeTest = !platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.supportsVme;
61+
skipVmeTest = !defaultHwInfo->capabilityTable.supportsVme;
6162
if (skipVmeTest) {
6263
GTEST_SKIP();
6364
}

opencl/test/unit_test/gen8/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@
77
if(TESTS_GEN8)
88
set(IGDRCL_SRCS_tests_gen8
99
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10-
${CMAKE_CURRENT_SOURCE_DIR}/coherency_tests_gen8.cpp
1110
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_gen8.cpp
11+
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_tests_gen8.cpp
1212
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_media_kernel_gen8.cpp
13-
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_gen8.cpp
1413
${CMAKE_CURRENT_SOURCE_DIR}/image_tests_gen8.cpp
1514
${CMAKE_CURRENT_SOURCE_DIR}/kernel_tests_gen8.cpp
16-
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_gen8.cpp
17-
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_gen8.cpp
15+
${CMAKE_CURRENT_SOURCE_DIR}/test_cl_device_caps_gen8.cpp
1816
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_gen8.cpp
1917
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_gen8.cpp
20-
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_gen8.cpp
2118
)
2219

2320
get_property(NEO_CORE_TESTS_GEN8 GLOBAL PROPERTY NEO_CORE_TESTS_GEN8)

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
#
2-
# Copyright (C) 2018-2020 Intel Corporation
2+
# Copyright (C) 2018-2021 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
#
66

77
if(TESTS_BDW)
8-
set(IGDRCL_SRCS_tests_gen8_bdw
9-
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10-
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_bdw.cpp
11-
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_bdw.cpp
12-
)
13-
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen8_bdw})
148
add_subdirectories()
159
neo_copy_test_files_with_revision(copy_test_files_bdw_0 bdw 0)
1610
add_dependencies(copy_test_files_per_product copy_test_files_bdw_0)

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

Lines changed: 0 additions & 83 deletions
This file was deleted.

opencl/test/unit_test/gen8/bdw/windows/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

opencl/test/unit_test/gen8/bdw/windows/test_device_caps_bdw_windows.cpp

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/test/common/helpers/default_hw_info.h"
9+
#include "shared/test/common/test_macros/test.h"
10+
11+
#include "opencl/source/helpers/cl_hw_helper.h"
12+
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
13+
14+
using namespace NEO;
15+
using ClHwHelperTestGen8 = ::testing::Test;
16+
17+
GEN8TEST_F(ClHwHelperTestGen8, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
18+
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(8, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
19+
}
20+
21+
GEN8TEST_F(ClHwHelperTestGen8, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
22+
EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities());
23+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/test/common/test_macros/test.h"
9+
10+
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
11+
12+
using namespace NEO;
13+
14+
using Gen8ClDeviceCaps = Test<ClDeviceFixture>;
15+
16+
GEN8TEST_F(Gen8ClDeviceCaps, WhenCheckingExtensionStringThenFp64IsSupported) {
17+
const auto &caps = pClDevice->getDeviceInfo();
18+
std::string extensionString = caps.deviceExtensions;
19+
20+
EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
21+
EXPECT_NE(0u, caps.doubleFpConfig);
22+
}
23+
24+
GEN8TEST_F(Gen8ClDeviceCaps, WhenGettingDeviceInfoThenCorrectlyRoundedDivideSqrtIsEnabled) {
25+
const auto &caps = pClDevice->getDeviceInfo();
26+
EXPECT_NE(0u, caps.singleFpConfig & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
27+
}
28+
29+
GEN8TEST_F(Gen8ClDeviceCaps, givenGen8WhenCheckExtensionsThenDeviceProperlyReportsClKhrSubgroupsExtension) {
30+
const auto &caps = pClDevice->getDeviceInfo();
31+
if (pClDevice->areOcl21FeaturesEnabled()) {
32+
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups")));
33+
} else {
34+
EXPECT_THAT(caps.deviceExtensions, ::testing::Not(testing::HasSubstr(std::string("cl_khr_subgroups"))));
35+
}
36+
}
37+
38+
GEN8TEST_F(Gen8ClDeviceCaps, givenGen8WhenCheckingCapsThenDeviceDoesProperlyReportsIndependentForwardProgress) {
39+
const auto &caps = pClDevice->getDeviceInfo();
40+
41+
if (pClDevice->areOcl21FeaturesEnabled()) {
42+
EXPECT_TRUE(caps.independentForwardProgress != 0);
43+
} else {
44+
EXPECT_FALSE(caps.independentForwardProgress != 0);
45+
}
46+
}
47+
48+
GEN8TEST_F(Gen8ClDeviceCaps, WhenCheckingImage3dDimensionsThenCapsAreSetCorrectly) {
49+
const auto &caps = pClDevice->getDeviceInfo();
50+
EXPECT_EQ(2048u, caps.image3DMaxWidth);
51+
EXPECT_EQ(2048u, caps.image3DMaxHeight);
52+
}

opencl/test/unit_test/gen8/test_platform_caps_gen8.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@
1111

1212
using namespace NEO;
1313

14-
struct Gen8PlatformCaps : public PlatformFixture, public ::testing::Test {
15-
void SetUp() override {
16-
PlatformFixture::SetUp();
17-
}
14+
using Gen8PlatformCaps = Test<PlatformFixture>;
1815

19-
void TearDown() override {
20-
PlatformFixture::TearDown();
21-
}
22-
};
23-
24-
BDWTEST_F(Gen8PlatformCaps, WhenCheckingExtensionStringThenFp64IsSupported) {
16+
GEN8TEST_F(Gen8PlatformCaps, WhenCheckingExtensionStringThenFp64IsSupported) {
2517
const auto &caps = pPlatform->getPlatformInfo();
2618

2719
EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64")));

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

Lines changed: 0 additions & 13 deletions
This file was deleted.

shared/test/unit_test/gen8/CMakeLists.txt

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

77
if(TESTS_GEN8)
8+
target_sources(neo_shared_tests PRIVATE
9+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10+
${CMAKE_CURRENT_SOURCE_DIR}/coherency_tests_gen8.cpp
11+
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_gen8.cpp
12+
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_gen8.cpp
13+
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_gen8.cpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_gen8.cpp
15+
)
816
add_subdirectories()
917
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+
target_sources(neo_shared_tests PRIVATE
9+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
10+
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_bdw.cpp
11+
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_bdw.cpp
12+
)
13+
add_subdirectories()
14+
endif()
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (C) 2018-2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/test/common/mocks/mock_device.h"
9+
#include "shared/test/common/test_macros/test.h"
10+
11+
using namespace NEO;
12+
using BdwUsDeviceIdTest = ::testing::Test;
13+
14+
BDWTEST_F(BdwUsDeviceIdTest, WhenCheckingIsSimulationThenTrueReturnedOnlyForSimulationId) {
15+
unsigned short bdwSimulationIds[6] = {
16+
0x0BD0,
17+
0x0BD1,
18+
0x0BD2,
19+
0x0BD3,
20+
0x0BD4,
21+
0, // default, non-simulation
22+
};
23+
24+
for (auto &id : bdwSimulationIds) {
25+
auto hardwareInfo = *defaultHwInfo;
26+
hardwareInfo.platform.usDeviceID = id;
27+
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo, 0u /*rootDeviceIndex*/));
28+
ASSERT_NE(mockDevice.get(), nullptr);
29+
30+
if (id == 0)
31+
EXPECT_FALSE(mockDevice->isSimulation());
32+
else
33+
EXPECT_TRUE(mockDevice->isSimulation());
34+
}
35+
}

opencl/test/unit_test/gen8/coherency_tests_gen8.cpp renamed to shared/test/unit_test/gen8/coherency_tests_gen8.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@
99
#include "shared/source/execution_environment/execution_environment.h"
1010
#include "shared/test/common/helpers/default_hw_info.h"
1111
#include "shared/test/common/helpers/dispatch_flags_helper.h"
12+
#include "shared/test/common/mocks/mock_execution_environment.h"
1213
#include "shared/test/common/test_macros/test.h"
1314

14-
#include "opencl/source/platform/platform.h"
15-
#include "opencl/test/unit_test/mocks/mock_platform.h"
16-
1715
using namespace NEO;
1816

19-
typedef ::testing::Test Gen8CoherencyRequirements;
17+
using Gen8CoherencyRequirements = ::testing::Test;
2018

2119
GEN8TEST_F(Gen8CoherencyRequirements, WhenMemoryManagerIsInitializedThenNoCoherencyProgramming) {
22-
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
20+
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
2321
executionEnvironment->initializeMemoryManager();
2422
CommandStreamReceiverHw<BDWFamily> csr(*executionEnvironment, 0, 1);
2523
LinearStream stream;

0 commit comments

Comments
 (0)