mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Move execution environment helper to shared
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
38ad58bce3
commit
2047fc88f9
@@ -10,14 +10,13 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/create_command_stream.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct CreateCommandStreamReceiverTest : public ::testing::TestWithParam<CommandStreamReceiverType> {};
|
||||
@@ -26,6 +25,8 @@ HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetTo
|
||||
DebugManagerStateRestore stateRestorer;
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
ASSERT_NE(nullptr, executionEnvironment->memoryManager.get());
|
||||
executionEnvironment->incRefInternal();
|
||||
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
CommandStreamReceiverType csrType = GetParam();
|
||||
@@ -33,14 +34,17 @@ HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetTo
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useHwCsr = true;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(csrType);
|
||||
auto csr = std::unique_ptr<CommandStreamReceiver>(createCommandStream(*executionEnvironment, 0, 1));
|
||||
{
|
||||
auto csr = std::unique_ptr<CommandStreamReceiver>(createCommandStream(*executionEnvironment, 0, 1));
|
||||
|
||||
if (csrType < CommandStreamReceiverType::CSR_TYPES_NUM) {
|
||||
EXPECT_NE(nullptr, csr.get());
|
||||
} else {
|
||||
EXPECT_EQ(nullptr, csr.get());
|
||||
if (csrType < CommandStreamReceiverType::CSR_TYPES_NUM) {
|
||||
EXPECT_NE(nullptr, csr.get());
|
||||
} else {
|
||||
EXPECT_EQ(nullptr, csr.get());
|
||||
}
|
||||
}
|
||||
EXPECT_NE(nullptr, executionEnvironment->memoryManager.get());
|
||||
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
static CommandStreamReceiverType commandStreamReceiverTypes[] = {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/buffer_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/cl_execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/helpers/cl_hw_parse.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
|
||||
using namespace NEO;
|
||||
@@ -27,7 +27,7 @@ struct BufferEnqueueFixture : public ClHardwareParse,
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
executionEnvironment = getClExecutionEnvironmentImpl(hwInfo, 1);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/device_instrumentation_fixture.h"
|
||||
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -13,18 +13,15 @@
|
||||
#include "shared/source/helpers/windows/gmm_callbacks.h"
|
||||
#include "shared/source/os_interface/windows/wddm_device_command_stream.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/fixtures/gmm_callbacks_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using Gen12LpGmmCallbacksTests = ::testing::Test;
|
||||
using Gen12LpGmmCallbacksTests = ::Test<GmmCallbacksFixture>;
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockAubCsrToTestNotifyAubCapture : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
@@ -33,9 +30,6 @@ struct MockAubCsrToTestNotifyAubCapture : public AUBCommandStreamReceiverHw<GfxF
|
||||
};
|
||||
|
||||
GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCsrWithoutAubDumpWhenNotifyAubCaptureCallbackIsCalledThenDoNothing) {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
auto csr = std::make_unique<WddmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0, 1);
|
||||
uint64_t address = 0xFEDCBA9876543210;
|
||||
size_t size = 1024;
|
||||
@@ -46,9 +40,8 @@ GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCsrWithoutAubDumpWhenNotifyAubCaptu
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenWddmCsrWhenWriteL3CalledThenWriteTwoMmio) {
|
||||
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
UltCommandStreamReceiver<FamilyType> csr(*executionEnvironment, 0, 1);
|
||||
uint8_t buffer[128] = {};
|
||||
csr.commandStream.replaceBuffer(buffer, 128);
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/helpers/cl_execution_environment_helper.h"
|
||||
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments) {
|
||||
ExecutionEnvironment *getClExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments) {
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(rootDeviceEnvironments);
|
||||
DebugManagerStateRestore restorer;
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
class ExecutionEnvironment;
|
||||
struct HardwareInfo;
|
||||
ExecutionEnvironment *getClExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments);
|
||||
} // namespace NEO
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
struct HardwareInfo;
|
||||
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments);
|
||||
} // namespace NEO
|
||||
@@ -23,9 +23,9 @@ set(IGDRCL_SRCS_LIB_ULT
|
||||
${NEO_SOURCE_DIR}/opencl/source/helpers/implicit_scaling_ocl.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/source/memory_manager/compression_selector_ocl.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/source/memory_manager/cpu_page_fault_manager_memory_sync.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/execution_environment_helper.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/execution_environment_helper.h
|
||||
${NEO_SOURCE_DIR}/shared/source/helpers/allow_deferred_deleter.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/cl_execution_environment_helper.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/cl_execution_environment_helper.h
|
||||
)
|
||||
|
||||
add_library(igdrcl_libult OBJECT EXCLUDE_FROM_ALL
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "shared/source/program/program_initialization.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
@@ -46,7 +47,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/memory_allocator_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/memory_manager_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <memory>
|
||||
@@ -31,9 +29,14 @@ struct DeviceCommandStreamLeaksTest : ::testing::Test {
|
||||
void SetUp() override {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
executionEnvironment->incRefInternal();
|
||||
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
@@ -35,7 +36,6 @@
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
@@ -34,7 +35,6 @@
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h"
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/mocks/mock_builtins.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
@@ -42,13 +43,7 @@
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
@@ -64,7 +59,7 @@ class WddmCommandStreamFixture {
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
|
||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
@@ -80,7 +75,7 @@ class WddmCommandStreamFixture {
|
||||
csr->getOsContext().ensureContextInitialized();
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() {
|
||||
}
|
||||
};
|
||||
|
||||
@@ -152,7 +147,7 @@ class WddmCommandStreamWithMockGdiFixture {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
GraphicsAllocation *preemptionAllocation = nullptr;
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
|
||||
@@ -170,14 +165,14 @@ class WddmCommandStreamWithMockGdiFixture {
|
||||
this->csr->overrideRecorededCommandBuffer(*device);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() {
|
||||
wddm = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
using WddmCommandStreamTest = ::Test<WddmCommandStreamFixture>;
|
||||
using WddmCommandStreamMockGdiTest = ::Test<WddmCommandStreamWithMockGdiFixture>;
|
||||
using WddmDefaultTest = ::Test<ClDeviceFixture>;
|
||||
using WddmDefaultTest = ::Test<DeviceFixture>;
|
||||
struct DeviceCommandStreamTest : ::Test<MockAubCenterFixture>, DeviceFixture {
|
||||
void SetUp() override {
|
||||
DeviceFixture::SetUp();
|
||||
@@ -306,12 +301,27 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledThenCoherencyRequiredFl
|
||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOffWhenWorkloadIsSubmittedThenHeaderDoesntHavePreemptionFieldSet) {
|
||||
struct WddmPreemptionHeaderFixture {
|
||||
void SetUp() {
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
executionEnvironment->incRefInternal();
|
||||
wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
WddmMock *wddm = nullptr;
|
||||
};
|
||||
|
||||
using WddmPreemptionHeaderTests = ::Test<WddmPreemptionHeaderFixture>;
|
||||
|
||||
TEST_F(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOffWhenWorkloadIsSubmittedThenHeaderDoesntHavePreemptionFieldSet) {
|
||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
|
||||
auto csr = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
|
||||
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
|
||||
csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
|
||||
@@ -332,12 +342,9 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
|
||||
executionEnvironment->memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOnWhenWorkloadIsSubmittedThenHeaderDoesHavePreemptionFieldSet) {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
TEST_F(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOnWhenWorkloadIsSubmittedThenHeaderDoesHavePreemptionFieldSet) {
|
||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
|
||||
auto csr = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
|
||||
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
|
||||
csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
|
||||
@@ -359,9 +366,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
|
||||
executionEnvironment->memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderContainsPreemptionFieldSet) {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
TEST_F(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderContainsPreemptionFieldSet) {
|
||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
|
||||
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
|
||||
@@ -370,9 +375,7 @@ TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStream
|
||||
EXPECT_TRUE(header->NeedsMidBatchPreEmptionSupport);
|
||||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderPreemptionFieldIsNotSet) {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
TEST_F(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderPreemptionFieldIsNotSet) {
|
||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
|
||||
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0, 1);
|
||||
@@ -923,14 +926,13 @@ using WddmSimpleTest = ::testing::Test;
|
||||
|
||||
HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedOn) {
|
||||
DebugManager.flags.CsrDispatchMode.set(0);
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
||||
auto wddm = Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*executionEnvironment, 0, 1));
|
||||
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
|
||||
{
|
||||
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*executionEnvironment, 0, 1));
|
||||
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVersionBasingOnFtrFlag) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "shared/source/utilities/tag_allocator.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_deferred_deleter.h"
|
||||
@@ -34,7 +35,6 @@
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
@@ -136,31 +136,39 @@ TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThe
|
||||
TEST(WddmMemoryManagerExternalHeapTest, WhenExternalHeapIsCreatedThenItHasCorrectBase) {
|
||||
HardwareInfo *hwInfo;
|
||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get())));
|
||||
wddm->init();
|
||||
uint64_t base = 0x56000;
|
||||
uint64_t size = 0x9000;
|
||||
wddm->setHeap32(base, size);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::move(wddm));
|
||||
executionEnvironment->incRefInternal();
|
||||
{
|
||||
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get())));
|
||||
wddm->init();
|
||||
uint64_t base = 0x56000;
|
||||
uint64_t size = 0x9000;
|
||||
wddm->setHeap32(base, size);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::move(wddm));
|
||||
|
||||
std::unique_ptr<WddmMemoryManager> memoryManager = std::unique_ptr<WddmMemoryManager>(new WddmMemoryManager(*executionEnvironment));
|
||||
std::unique_ptr<WddmMemoryManager> memoryManager = std::unique_ptr<WddmMemoryManager>(new WddmMemoryManager(*executionEnvironment));
|
||||
|
||||
EXPECT_EQ(base, memoryManager->getExternalHeapBaseAddress(0, false));
|
||||
EXPECT_EQ(base, memoryManager->getExternalHeapBaseAddress(0, false));
|
||||
}
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWmmWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) {
|
||||
HardwareInfo *hwInfo;
|
||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
auto wddm = std::make_unique<WddmMock>(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
wddm->init();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::move(wddm));
|
||||
bool actualDeleterFlag = DebugManager.flags.EnableDeferredDeleter.get();
|
||||
DebugManager.flags.EnableDeferredDeleter.set(true);
|
||||
MockWddmMemoryManager memoryManager(*executionEnvironment);
|
||||
EXPECT_NE(nullptr, memoryManager.getDeferredDeleter());
|
||||
memoryManager.waitForDeletions();
|
||||
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
|
||||
DebugManager.flags.EnableDeferredDeleter.set(actualDeleterFlag);
|
||||
executionEnvironment->incRefInternal();
|
||||
{
|
||||
auto wddm = std::make_unique<WddmMock>(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
wddm->init();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::move(wddm));
|
||||
bool actualDeleterFlag = DebugManager.flags.EnableDeferredDeleter.get();
|
||||
DebugManager.flags.EnableDeferredDeleter.set(true);
|
||||
MockWddmMemoryManager memoryManager(*executionEnvironment);
|
||||
EXPECT_NE(nullptr, memoryManager.getDeferredDeleter());
|
||||
memoryManager.waitForDeletions();
|
||||
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
|
||||
DebugManager.flags.EnableDeferredDeleter.set(actualDeleterFlag);
|
||||
}
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
@@ -1463,8 +1471,9 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
}
|
||||
|
||||
struct WddmMemoryManagerWithAsyncDeleterTest : public ::testing::Test {
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
executionEnvironment->incRefInternal();
|
||||
wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
|
||||
wddm->resetGdi(new MockGdi());
|
||||
wddm->callBaseDestroyAllocations = false;
|
||||
@@ -1473,6 +1482,11 @@ struct WddmMemoryManagerWithAsyncDeleterTest : public ::testing::Test {
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
MockDeferredDeleter *deleter = nullptr;
|
||||
std::unique_ptr<MockWddmMemoryManager> memoryManager;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
@@ -1554,14 +1568,18 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithoutAsyncDele
|
||||
TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForInternalHeapBaseThenHeapInternalBaseIsReturned) {
|
||||
HardwareInfo *hwInfo;
|
||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
auto wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
wddm->init();
|
||||
MockWddmMemoryManager memoryManager(*executionEnvironment);
|
||||
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base;
|
||||
heapBase = std::max(heapBase, static_cast<uint64_t>(wddm->getWddmMinAddress()));
|
||||
EXPECT_EQ(heapBase, memoryManager.getInternalHeapBaseAddress(0, true));
|
||||
executionEnvironment->incRefInternal();
|
||||
{
|
||||
auto wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
wddm->init();
|
||||
MockWddmMemoryManager memoryManager(*executionEnvironment);
|
||||
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base;
|
||||
heapBase = std::max(heapBase, static_cast<uint64_t>(wddm->getWddmMinAddress()));
|
||||
EXPECT_EQ(heapBase, memoryManager.getInternalHeapBaseAddress(0, true));
|
||||
}
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalledWithTripleAllocationThenSuccessIsReturned) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/os_interface/windows/os_environment_win.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "shared/test/common/mocks/mock_wddm_residency_allocations_container.h"
|
||||
@@ -19,7 +20,6 @@
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
@@ -176,11 +176,16 @@ class MockWddmMemoryManagerTest : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
|
||||
executionEnvironment->incRefInternal();
|
||||
wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
WddmMock *wddm = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/buffer_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/cl_execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/helpers/cl_hw_parse.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
|
||||
@@ -30,7 +30,7 @@ struct EnqueueBufferWindowsTest : public ClHardwareParse,
|
||||
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||
executionEnvironment = getClExecutionEnvironmentImpl(hwInfo, 1);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/mocks/mock_builtins.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
@@ -13,7 +14,6 @@
|
||||
#include "shared/test/common/mocks/mock_source_level_debugger.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/source/source_level_debugger/source_level_debugger.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/source_level_debugger_library.h"
|
||||
@@ -20,7 +21,6 @@
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user