mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
CMake: don't include shared/test/unit_test when shared tests are skipped 2/n
Related-To: NEO-6524 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f82b2e2984
commit
54dc2f2000
@@ -1,13 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
# Copyright (C) 2021-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_container_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/front_window_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/front_window_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_aub_center_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preemption_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preemption_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_config_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/templated_fixture_tests.cpp
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
85
shared/test/unit_test/fixtures/command_container_fixture.h
Normal file
85
shared/test/unit_test/fixtures/command_container_fixture.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class CommandEncodeStatesFixture : public DeviceFixture {
|
||||
public:
|
||||
class MyMockCommandContainer : public CommandContainer {
|
||||
public:
|
||||
using CommandContainer::dirtyHeaps;
|
||||
};
|
||||
|
||||
void SetUp() {
|
||||
DeviceFixture::SetUp();
|
||||
cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
}
|
||||
void TearDown() {
|
||||
cmdContainer.reset();
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
std::unique_ptr<MyMockCommandContainer> cmdContainer;
|
||||
KernelDescriptor descriptor;
|
||||
|
||||
EncodeDispatchKernelArgs createDefaultDispatchKernelArgs(Device *device,
|
||||
DispatchKernelEncoderI *dispatchInterface,
|
||||
const void *threadGroupDimensions,
|
||||
bool requiresUncachedMocs) {
|
||||
EncodeDispatchKernelArgs args{
|
||||
0, // eventAddress
|
||||
device, // device
|
||||
dispatchInterface, // dispatchInterface
|
||||
threadGroupDimensions, // threadGroupDimensions
|
||||
PreemptionMode::Disabled, // preemptionMode
|
||||
1, // partitionCount
|
||||
false, // isIndirect
|
||||
false, // isPredicate
|
||||
false, // isTimestampEvent
|
||||
requiresUncachedMocs, // requiresUncachedMocs
|
||||
false, // useGlobalAtomics
|
||||
false, // isInternal
|
||||
false, // isCooperative
|
||||
false, // isHostScopeSignalEvent
|
||||
false, // isKernelUsingSystemAllocation
|
||||
false // isKernelDispatchedFromImmediateCmdList
|
||||
};
|
||||
|
||||
return args;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
struct WalkerThreadFixture {
|
||||
void SetUp() { // NOLINT(readability-identifier-naming)
|
||||
startWorkGroup[0] = startWorkGroup[1] = startWorkGroup[2] = 0u;
|
||||
numWorkGroups[0] = numWorkGroups[1] = numWorkGroups[2] = 1u;
|
||||
workGroupSizes[0] = 32u;
|
||||
workGroupSizes[1] = workGroupSizes[2] = 1u;
|
||||
simd = 32u;
|
||||
localIdDimensions = 3u;
|
||||
requiredWorkGroupOrder = 0u;
|
||||
}
|
||||
void TearDown() {} // NOLINT(readability-identifier-naming)
|
||||
|
||||
uint32_t startWorkGroup[3];
|
||||
uint32_t numWorkGroups[3];
|
||||
uint32_t workGroupSizes[3];
|
||||
uint32_t simd;
|
||||
uint32_t localIdDimensions;
|
||||
uint32_t requiredWorkGroupOrder;
|
||||
};
|
||||
|
||||
using WalkerThreadTest = Test<WalkerThreadFixture>;
|
||||
58
shared/test/unit_test/fixtures/direct_submission_fixture.h
Normal file
58
shared/test/unit_test/fixtures/direct_submission_fixture.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
namespace CpuIntrinsicsTests {
|
||||
extern std::atomic<uintptr_t> lastClFlushedPtr;
|
||||
}
|
||||
|
||||
struct DirectSubmissionFixture : public DeviceFixture {
|
||||
void SetUp() {
|
||||
DeviceFixture::SetUp();
|
||||
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
|
||||
|
||||
osContext = pDevice->getDefaultEngine().osContext;
|
||||
}
|
||||
|
||||
OsContext *osContext = nullptr;
|
||||
};
|
||||
|
||||
struct DirectSubmissionDispatchBufferFixture : public DirectSubmissionFixture {
|
||||
void SetUp() {
|
||||
DirectSubmissionFixture::SetUp();
|
||||
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
const AllocationProperties commandBufferProperties{pDevice->getRootDeviceIndex(), 0x1000,
|
||||
AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
|
||||
commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandBufferProperties);
|
||||
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
batchBuffer.commandBufferAllocation = commandBuffer;
|
||||
batchBuffer.usedSize = 0x40;
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
|
||||
DirectSubmissionFixture::TearDown();
|
||||
}
|
||||
|
||||
BatchBuffer batchBuffer;
|
||||
uint8_t bbStart[64];
|
||||
GraphicsAllocation *commandBuffer;
|
||||
};
|
||||
26
shared/test/unit_test/fixtures/front_window_fixture.cpp
Normal file
26
shared/test/unit_test/fixtures/front_window_fixture.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/fixtures/front_window_fixture.h"
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
MemManagerFixture::FrontWindowMemManagerMock::FrontWindowMemManagerMock(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
|
||||
void MemManagerFixture::FrontWindowMemManagerMock::forceLimitedRangeAllocator(uint32_t rootDeviceIndex, uint64_t range) { getGfxPartition(rootDeviceIndex)->init(range, 0, 0, gfxPartitions.size(), true); }
|
||||
void MemManagerFixture::SetUp() {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseExternalAllocatorForSshAndDsh.set(true);
|
||||
DeviceFixture::SetUp();
|
||||
memManager = std::unique_ptr<FrontWindowMemManagerMock>(new FrontWindowMemManagerMock(*pDevice->getExecutionEnvironment()));
|
||||
}
|
||||
void MemManagerFixture::TearDown() {
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
27
shared/test/unit_test/fixtures/front_window_fixture.h
Normal file
27
shared/test/unit_test/fixtures/front_window_fixture.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class MemManagerFixture : public DeviceFixture {
|
||||
public:
|
||||
struct FrontWindowMemManagerMock : public MockMemoryManager {
|
||||
FrontWindowMemManagerMock(NEO::ExecutionEnvironment &executionEnvironment);
|
||||
void forceLimitedRangeAllocator(uint32_t rootDeviceIndex, uint64_t range);
|
||||
};
|
||||
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
std::unique_ptr<FrontWindowMemManagerMock> memManager;
|
||||
};
|
||||
} // namespace NEO
|
||||
38
shared/test/unit_test/fixtures/implicit_scaling_fixture.cpp
Normal file
38
shared/test/unit_test/fixtures/implicit_scaling_fixture.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/fixtures/implicit_scaling_fixture.h"
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
void ImplicitScalingFixture::SetUp() {
|
||||
CommandEncodeStatesFixture::SetUp();
|
||||
apiSupportBackup = std::make_unique<VariableBackup<bool>>(&ImplicitScaling::apiSupport, true);
|
||||
osLocalMemoryBackup = std::make_unique<VariableBackup<bool>>(&OSInterface::osEnableLocalMemory, true);
|
||||
|
||||
singleTile = DeviceBitfield(static_cast<uint32_t>(maxNBitValue(1)));
|
||||
twoTile = DeviceBitfield(static_cast<uint32_t>(maxNBitValue(2)));
|
||||
|
||||
alignedMemory = alignedMalloc(bufferSize, 4096);
|
||||
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(gpuVa);
|
||||
cmdBufferAlloc.setCpuPtrAndGpuAddress(alignedMemory, canonizedGpuAddress);
|
||||
|
||||
commandStream.replaceBuffer(alignedMemory, bufferSize);
|
||||
commandStream.replaceGraphicsAllocation(&cmdBufferAlloc);
|
||||
|
||||
testHardwareInfo = *defaultHwInfo;
|
||||
}
|
||||
|
||||
void ImplicitScalingFixture::TearDown() {
|
||||
alignedFree(alignedMemory);
|
||||
CommandEncodeStatesFixture::TearDown();
|
||||
}
|
||||
38
shared/test/unit_test/fixtures/implicit_scaling_fixture.h
Normal file
38
shared/test/unit_test/fixtures/implicit_scaling_fixture.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_container/implicit_scaling.h"
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct ImplicitScalingFixture : public CommandEncodeStatesFixture {
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
static constexpr uint64_t gpuVa = (1ull << 48);
|
||||
static constexpr size_t bufferSize = 1024u;
|
||||
DebugManagerStateRestore restorer;
|
||||
LinearStream commandStream;
|
||||
MockGraphicsAllocation cmdBufferAlloc;
|
||||
HardwareInfo testHardwareInfo = {};
|
||||
std::unique_ptr<VariableBackup<bool>> apiSupportBackup;
|
||||
std::unique_ptr<VariableBackup<bool>> osLocalMemoryBackup;
|
||||
DeviceBitfield singleTile;
|
||||
DeviceBitfield twoTile;
|
||||
void *alignedMemory = nullptr;
|
||||
};
|
||||
|
||||
using ImplicitScalingTests = Test<ImplicitScalingFixture>;
|
||||
40
shared/test/unit_test/fixtures/preemption_fixture.cpp
Normal file
40
shared/test/unit_test/fixtures/preemption_fixture.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/fixtures/preemption_fixture.h"
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "patch_g7.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
DevicePreemptionTests::DevicePreemptionTests() = default;
|
||||
DevicePreemptionTests::~DevicePreemptionTests() = default;
|
||||
|
||||
void DevicePreemptionTests::SetUp() {
|
||||
if (dbgRestore == nullptr) {
|
||||
dbgRestore.reset(new DebugManagerStateRestore());
|
||||
}
|
||||
|
||||
device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
executionEnvironment.reset(new iOpenCL::SPatchExecutionEnvironment);
|
||||
memset(executionEnvironment.get(), 0, sizeof(iOpenCL::SPatchExecutionEnvironment));
|
||||
|
||||
ASSERT_NE(nullptr, device);
|
||||
|
||||
waTable = &device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable;
|
||||
}
|
||||
|
||||
void DevicePreemptionTests::TearDown() {
|
||||
dbgRestore.reset();
|
||||
}
|
||||
64
shared/test/unit_test/fixtures/preemption_fixture.h
Normal file
64
shared/test/unit_test/fixtures/preemption_fixture.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_stream/preemption_mode.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace iOpenCL {
|
||||
struct SPatchExecutionEnvironment;
|
||||
}
|
||||
|
||||
namespace NEO {
|
||||
class MockCommandQueue;
|
||||
class MockContext;
|
||||
class MockDevice;
|
||||
class MockProgram;
|
||||
struct KernelInfo;
|
||||
struct WorkaroundTable;
|
||||
} // namespace NEO
|
||||
|
||||
class DevicePreemptionTests : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
DevicePreemptionTests();
|
||||
~DevicePreemptionTests() override;
|
||||
|
||||
NEO::PreemptionMode preemptionMode;
|
||||
NEO::WorkaroundTable *waTable = nullptr;
|
||||
std::unique_ptr<NEO::MockDevice> device;
|
||||
std::unique_ptr<DebugManagerStateRestore> dbgRestore;
|
||||
std::unique_ptr<iOpenCL::SPatchExecutionEnvironment> executionEnvironment;
|
||||
};
|
||||
|
||||
struct PreemptionTestHwDetails {
|
||||
struct PreemptionModeHashT {
|
||||
auto operator()(const NEO::PreemptionMode &preemptionMode) const -> std::underlying_type<NEO::PreemptionMode>::type {
|
||||
return static_cast<std::underlying_type<NEO::PreemptionMode>::type>(preemptionMode);
|
||||
}
|
||||
};
|
||||
|
||||
bool supportsPreemptionProgramming() const {
|
||||
return modeToRegValueMap.size() > 0;
|
||||
}
|
||||
|
||||
uint32_t regAddress = 0;
|
||||
std::unordered_map<NEO::PreemptionMode, uint32_t, PreemptionModeHashT> modeToRegValueMap;
|
||||
uint32_t defaultRegValue = 0;
|
||||
};
|
||||
|
||||
template <typename FamilyType>
|
||||
PreemptionTestHwDetails getPreemptionTestHwDetails();
|
||||
47
shared/test/unit_test/fixtures/product_config_fixture.h
Normal file
47
shared/test/unit_test/fixtures/product_config_fixture.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "platforms.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
template <typename T>
|
||||
struct ProductConfigTest : public T {
|
||||
void SetUp() override {
|
||||
T::SetUp();
|
||||
hwInfo = *NEO::defaultHwInfo;
|
||||
hwInfoConfig = NEO::HwInfoConfig::get(productFamily);
|
||||
}
|
||||
|
||||
NEO::HwInfoConfig *hwInfoConfig = nullptr;
|
||||
NEO::HardwareInfo hwInfo = {};
|
||||
AOT::PRODUCT_CONFIG productConfig = AOT::UNKNOWN_ISA;
|
||||
};
|
||||
|
||||
struct ProductConfigHwInfoTests : public ProductConfigTest<::testing::TestWithParam<std::tuple<AOT::PRODUCT_CONFIG, PRODUCT_FAMILY>>> {
|
||||
void SetUp() override {
|
||||
ProductConfigTest::SetUp();
|
||||
std::tie(productConfig, prod) = GetParam();
|
||||
if (prod != productFamily) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
}
|
||||
PRODUCT_FAMILY prod = IGFX_UNKNOWN;
|
||||
const AheadOfTimeConfig invalidConfig = {CommonConstants::invalidRevisionID};
|
||||
};
|
||||
|
||||
using ProductConfigTests = ProductConfigTest<::testing::Test>;
|
||||
using ProductConfigHwInfoBadRevisionTests = ProductConfigHwInfoTests;
|
||||
using ProductConfigHwInfoBadArchTests = ProductConfigHwInfoTests;
|
||||
Reference in New Issue
Block a user