mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
In TBX mode, the host could not write to host buffers after access from device code due to the lack of a migration mechanism post-initial TBX upload. Migration is unnecessary with real hardware, but required for TBX. This patch introduces a new page fault manager type that extends the original CPU fault manager, enabling automatic migration of host buffers in TBX mode. Refactoring was necessary to avoid diamond inheritance, achieved by using a template parameter as the base class for OS-specific fault managers. Related-To: NEO-12268 Signed-off-by: Jack Myers <jack.myers@intel.com>
34 lines
1.2 KiB
C++
34 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/test/common/fixtures/tbx_command_stream_fixture.h"
|
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
#include "shared/source/command_stream/tbx_command_stream_receiver_hw.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/mocks/mock_device.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace NEO {
|
|
|
|
void TbxCommandStreamFixture::setUp(MockDevice *pDevice) {
|
|
// Create our TBX command stream receiver based on HW type
|
|
DebugManagerStateRestore dbgRestore;
|
|
debugManager.flags.SetCommandStreamReceiver.set(static_cast<int32_t>(CommandStreamReceiverType::tbx));
|
|
pCommandStreamReceiver = TbxCommandStreamReceiver::create("", false, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
|
ASSERT_NE(nullptr, pCommandStreamReceiver);
|
|
memoryManager = new OsAgnosticMemoryManager(*pDevice->executionEnvironment);
|
|
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);
|
|
}
|
|
|
|
void TbxCommandStreamFixture::tearDown() {
|
|
delete memoryManager;
|
|
}
|
|
} // namespace NEO
|