mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Use ImmediateDispatch mode for L0 command queues
Related-To: LOCI-1988 Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ec40b6562e
commit
e29a85ebb3
@@ -10,6 +10,7 @@ set(NEO_CORE_OS_INTERFACE_TESTS_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_special_heap_test.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_uuid_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_l0_tests.cpp
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_OS_INTERFACE_TESTS_LINUX ${NEO_CORE_OS_INTERFACE_TESTS_LINUX})
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/os_interface/linux/drm_command_stream.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace NEO {
|
||||
extern ApiSpecificConfig::ApiType apiTypeForUlts;
|
||||
} //namespace NEO
|
||||
using namespace NEO;
|
||||
|
||||
class DrmCommandStreamTestL0 : public ::testing::Test {
|
||||
public:
|
||||
template <typename GfxFamily>
|
||||
void SetUpT() {
|
||||
|
||||
//make sure this is disabled, we don't want to test this now
|
||||
DebugManager.flags.EnableForcePin.set(false);
|
||||
|
||||
mock = new ::testing::NiceMock<DrmMockImpl>(mockFd, *executionEnvironment.rootDeviceEnvironments[0]);
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
|
||||
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mock, 0u);
|
||||
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
mock->createVirtualMemoryAddressSpace(HwHelper::getSubDevicesCount(hwInfo));
|
||||
osContext = std::make_unique<OsContextLinux>(*mock, 0u,
|
||||
EngineDescriptorHelper::getDefaultDescriptor(HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
|
||||
PreemptionHelper::getDefaultPreemptionMode(*hwInfo)));
|
||||
osContext->ensureContextInitialized();
|
||||
|
||||
csr = new DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerActive);
|
||||
ASSERT_NE(nullptr, csr);
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
// Memory manager creates pinBB with ioctl, expect one call
|
||||
EXPECT_CALL(*mock, ioctl(::testing::_, ::testing::_))
|
||||
.Times(1);
|
||||
memoryManager = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerActive,
|
||||
DebugManager.flags.EnableForcePin.get(),
|
||||
true,
|
||||
executionEnvironment);
|
||||
executionEnvironment.memoryManager.reset(memoryManager);
|
||||
::testing::Mock::VerifyAndClearExpectations(mock);
|
||||
|
||||
//assert we have memory manager
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void TearDownT() {
|
||||
memoryManager->waitForDeletions();
|
||||
memoryManager->peekGemCloseWorker()->close(true);
|
||||
delete csr;
|
||||
::testing::Mock::VerifyAndClearExpectations(mock);
|
||||
// Memory manager closes pinBB with ioctl, expect one call
|
||||
EXPECT_CALL(*mock, ioctl(::testing::_, ::testing::_))
|
||||
.Times(::testing::AtLeast(1));
|
||||
}
|
||||
|
||||
CommandStreamReceiver *csr = nullptr;
|
||||
DrmMemoryManager *memoryManager = nullptr;
|
||||
::testing::NiceMock<DrmMockImpl> *mock;
|
||||
const int mockFd = 33;
|
||||
static const uint64_t alignment = MemoryConstants::allocationAlignment;
|
||||
DebugManagerStateRestore dbgState;
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
std::unique_ptr<OsContextLinux> osContext;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockDrmCsrL0 : public DrmCommandStreamReceiver<GfxFamily> {
|
||||
using DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::dispatchMode;
|
||||
};
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTestL0, givenL0ApiConfigWhenCreatingDrmCsrThenEnableImmediateDispatch) {
|
||||
VariableBackup<ApiSpecificConfig::ApiType> backup(&apiTypeForUlts, ApiSpecificConfig::L0);
|
||||
MockDrmCsrL0<FamilyType> csr(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
|
||||
}
|
||||
Reference in New Issue
Block a user