Move L0Debugger tests to shared

- change tests to non-parameterized when parameters are not needed

Related-To: NEO-7075

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2022-07-05 15:55:15 +00:00
committed by Compute-Runtime-Automation
parent e8494abbe8
commit 3cd4114733
30 changed files with 744 additions and 672 deletions

View File

@@ -55,7 +55,6 @@ target_sources(${TARGET_NAME} PRIVATE
$<TARGET_OBJECTS:${BUILTINS_BINARIES_BINDFUL_LIB_NAME}>
$<TARGET_OBJECTS:${BUILTINS_BINARIES_BINDLESS_LIB_NAME}>
$<TARGET_OBJECTS:neo_aub_tests_config>
$<TARGET_OBJECTS:l0_libult>
)
if(TARGET ${BUILTINS_SPIRV_LIB_NAME})
target_sources(${TARGET_NAME} PRIVATE

View File

@@ -44,25 +44,3 @@ apply_macro_for_each_core_type("TESTED")
add_custom_target(l0_common_test_kernels DEPENDS ${l0_test_kernel_outputs} ${l0_bindless_test_kernel_outputs} copy_compiler_files)
set_target_properties(l0_common_test_kernels PROPERTIES FOLDER ${TARGET_NAME_L0})
add_dependencies(prepare_test_kernels_for_l0 l0_common_test_kernels)
macro(macro_for_each_core_type)
foreach(BRANCH_DIR ${BRANCH_DIR_LIST})
set(ENABLE_L0_MOCKS_CPP ${NEO_SOURCE_DIR}/level_zero/core/test/unit_tests${BRANCH_DIR}${CORE_TYPE_LOWER}/enable_l0_mocks_${CORE_TYPE_LOWER}.cpp)
if(EXISTS ${ENABLE_L0_MOCKS_CPP})
list(APPEND LIBULT_L0_SOURCES ${ENABLE_L0_MOCKS_CPP})
endif()
endforeach()
endmacro()
apply_macro_for_each_core_type("TESTED")
add_library(l0_libult OBJECT EXCLUDE_FROM_ALL
${LIBULT_L0_SOURCES}
)
set_target_properties(l0_libult PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(l0_libult PROPERTIES FOLDER ${TARGET_NAME_L0})
set_property(TARGET l0_libult APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS} ${TSAN_FLAGS})
target_include_directories(l0_libult PRIVATE $<TARGET_PROPERTY:${L0_MOCKABLE_LIB_NAME},INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(l0_libult PRIVATE $<TARGET_PROPERTY:${L0_MOCKABLE_LIB_NAME},INTERFACE_COMPILE_DEFINITIONS>)
create_project_source_tree(l0_libult)

View File

@@ -39,7 +39,6 @@ target_sources(${TARGET_NAME} PRIVATE
$<TARGET_OBJECTS:neo_libult>
$<TARGET_OBJECTS:neo_shared_mocks>
$<TARGET_OBJECTS:neo_unit_tests_config>
$<TARGET_OBJECTS:l0_libult>
)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS})

View File

@@ -5,7 +5,7 @@
*
*/
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "shared/test/unit_test/mocks/mock_l0_debugger.h"
namespace NEO {

View File

@@ -5,7 +5,7 @@
*
*/
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "shared/test/unit_test/mocks/mock_l0_debugger.h"
namespace NEO {

View File

@@ -5,7 +5,7 @@
*
*/
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "shared/test/unit_test/mocks/mock_l0_debugger.h"
namespace NEO {
struct SKLFamily;

View File

@@ -8,7 +8,6 @@ set(TARGET_NAME ${TARGET_NAME_L0}_mocks)
set(L0_MOCKS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/debugger_l0_create.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_built_ins.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_built_ins.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_builtin_functions_lib_impl.h
@@ -33,7 +32,6 @@ set(L0_MOCKS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/mock_host_pointer_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_image.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_l0_debugger.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_module.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_sampler.h

View File

@@ -1,22 +0,0 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device/device.h"
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
NEO::DebugerL0CreateFn mockDebuggerL0HwFactory[IGFX_MAX_CORE];
namespace NEO {
std::unique_ptr<Debugger> DebuggerL0::create(NEO::Device *device) {
initDebuggingInOs(device->getRootDeviceEnvironment().osInterface.get());
auto debugger = mockDebuggerL0HwFactory[device->getHardwareInfo().platform.eRenderCoreFamily](device);
return std::unique_ptr<DebuggerL0>(debugger);
}
} // namespace NEO

View File

@@ -1,105 +0,0 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/debugger/debugger_l0.h"
#include "shared/source/kernel/debug_data.h"
extern NEO::DebugerL0CreateFn mockDebuggerL0HwFactory[];
namespace L0 {
namespace ult {
template <class BaseClass>
struct WhiteBox;
template <typename GfxFamily>
class MockDebuggerL0Hw : public NEO::DebuggerL0Hw<GfxFamily> {
public:
using NEO::DebuggerL0::perContextSbaAllocations;
using NEO::DebuggerL0::sbaTrackingGpuVa;
using NEO::DebuggerL0::singleAddressSpaceSbaTracking;
MockDebuggerL0Hw(NEO::Device *device) : NEO::DebuggerL0Hw<GfxFamily>(device) {}
~MockDebuggerL0Hw() override = default;
static NEO::DebuggerL0 *allocate(NEO::Device *device) {
return new MockDebuggerL0Hw<GfxFamily>(device);
}
void captureStateBaseAddress(NEO::LinearStream &cmdStream, NEO::Debugger::SbaAddresses sba) override {
captureStateBaseAddressCount++;
NEO::DebuggerL0Hw<GfxFamily>::captureStateBaseAddress(cmdStream, sba);
}
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
getSbaTrackingCommandsSizeCount++;
return NEO::DebuggerL0Hw<GfxFamily>::getSbaTrackingCommandsSize(trackedAddressCount);
}
void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const NEO::Debugger::SbaAddresses &sba) override {
programSbaTrackingCommandsCount++;
NEO::DebuggerL0Hw<GfxFamily>::programSbaTrackingCommands(cmdStream, sba);
}
void registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation) override {
registerElfCount++;
lastReceivedElf = debugData->vIsa;
NEO::DebuggerL0Hw<GfxFamily>::registerElf(debugData, isaAllocation);
}
bool attachZebinModuleToSegmentAllocations(const StackVec<NEO::GraphicsAllocation *, 32> &allocs, uint32_t &moduleHandle) override {
segmentCountWithAttachedModuleHandle = static_cast<uint32_t>(allocs.size());
if (std::numeric_limits<uint32_t>::max() != moduleHandleToReturn) {
moduleHandle = moduleHandleToReturn;
return true;
}
return NEO::DebuggerL0Hw<GfxFamily>::attachZebinModuleToSegmentAllocations(allocs, moduleHandle);
}
bool removeZebinModule(uint32_t moduleHandle) override {
removedZebinModuleHandle = moduleHandle;
return NEO::DebuggerL0Hw<GfxFamily>::removeZebinModule(moduleHandle);
}
void notifyCommandQueueCreated() override {
commandQueueCreatedCount++;
NEO::DebuggerL0Hw<GfxFamily>::notifyCommandQueueCreated();
}
void notifyCommandQueueDestroyed() override {
commandQueueDestroyedCount++;
NEO::DebuggerL0Hw<GfxFamily>::notifyCommandQueueDestroyed();
}
uint32_t captureStateBaseAddressCount = 0;
uint32_t programSbaTrackingCommandsCount = 0;
uint32_t getSbaTrackingCommandsSizeCount = 0;
uint32_t registerElfCount = 0;
uint32_t commandQueueCreatedCount = 0;
uint32_t commandQueueDestroyedCount = 0;
const char *lastReceivedElf = nullptr;
uint32_t segmentCountWithAttachedModuleHandle = 0;
uint32_t removedZebinModuleHandle = 0;
uint32_t moduleHandleToReturn = std::numeric_limits<uint32_t>::max();
};
template <>
struct WhiteBox<NEO::DebuggerL0> : public NEO::DebuggerL0 {
using BaseClass = NEO::DebuggerL0;
using BaseClass::initDebuggingInOs;
};
template <uint32_t productFamily, typename GfxFamily>
struct MockDebuggerL0HwPopulateFactory {
MockDebuggerL0HwPopulateFactory() {
mockDebuggerL0HwFactory[productFamily] = L0::ult::MockDebuggerL0Hw<GfxFamily>::allocate;
}
};
} // namespace ult
} // namespace L0

View File

@@ -12,7 +12,6 @@ target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger_1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger_2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger_sba_tracking.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger_single_address_space.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_module_with_debug.cpp
)

View File

@@ -11,11 +11,11 @@
#include "shared/test/common/mocks/mock_builtins.h"
#include "shared/test/common/mocks/mock_compilers.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_l0_debugger.h"
#include "shared/test/common/mocks/mock_memory_operations_handler.h"
#include "shared/test/common/mocks/mock_sip.h"
#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h"
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
namespace L0 {
namespace ult {

View File

@@ -95,7 +95,7 @@ TEST(L0DebuggerLinux, givenVmBindAndPerContextVmEnabledInDrmWhenInitializingDebu
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drmMock));
auto result = WhiteBox<NEO::DebuggerL0>::initDebuggingInOs(osInterface);
auto result = NEO::WhiteBox<NEO::DebuggerL0>::initDebuggingInOs(osInterface);
EXPECT_TRUE(result);
EXPECT_TRUE(drmMock->registerClassesCalled);
}
@@ -117,7 +117,7 @@ TEST(L0DebuggerLinux, givenVmBindNotAvailableInDrmWhenInitializingDebuggingInOsT
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drmMock));
auto result = WhiteBox<NEO::DebuggerL0>::initDebuggingInOs(osInterface);
auto result = NEO::WhiteBox<NEO::DebuggerL0>::initDebuggingInOs(osInterface);
EXPECT_FALSE(result);
EXPECT_FALSE(drmMock->registerClassesCalled);
}
@@ -139,7 +139,7 @@ TEST(L0DebuggerLinux, givenPerContextVmNotEnabledWhenInitializingDebuggingInOsTh
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drmMock));
auto result = WhiteBox<NEO::DebuggerL0>::initDebuggingInOs(osInterface);
auto result = NEO::WhiteBox<NEO::DebuggerL0>::initDebuggingInOs(osInterface);
EXPECT_FALSE(result);
EXPECT_FALSE(drmMock->registerClassesCalled);
}

View File

@@ -24,20 +24,19 @@ namespace ult {
using L0DebuggerTest = Test<L0DebuggerHwFixture>;
using L0DebuggerParameterizedTests = L0DebuggerHwParameterizedFixture;
TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenCallingIsLegacyThenFalseIsReturned) {
TEST_F(L0DebuggerTest, givenL0DebuggerWhenCallingIsLegacyThenFalseIsReturned) {
EXPECT_FALSE(neoDevice->getDebugger()->isLegacy());
}
TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingSourceLevelDebuggerThenNullptrReturned) {
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingSourceLevelDebuggerThenNullptrReturned) {
EXPECT_EQ(nullptr, neoDevice->getSourceLevelDebugger());
}
TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingL0DebuggerThenValidDebuggerInstanceIsReturned) {
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingL0DebuggerThenValidDebuggerInstanceIsReturned) {
EXPECT_NE(nullptr, device->getL0Debugger());
}
TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingSipAllocationThenValidSipTypeIsReturned) {
neoDevice->setDebuggerActive(true);
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingSipAllocationThenValidSipTypeIsReturned) {
auto systemRoutine = SipKernel::getSipKernel(*neoDevice).getSipAllocation();
ASSERT_NE(nullptr, systemRoutine);
@@ -51,12 +50,12 @@ TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingSipAllocationThen
EXPECT_EQ(expectedSipAllocation, systemRoutine);
}
TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingSipTypeThenDebugBindlessIsReturned) {
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingSipTypeThenDebugBindlessIsReturned) {
auto sipType = SipKernel::getSipKernelType(*neoDevice);
EXPECT_EQ(NEO::SipKernelType::DbgBindless, sipType);
}
TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingStateSaveAreaHeaderThenValidSipTypeIsReturned) {
TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingStateSaveAreaHeaderThenValidSipTypeIsReturned) {
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*neoDevice).getStateSaveAreaHeader();
auto sipType = SipKernel::getSipKernelType(*neoDevice);
@@ -65,82 +64,17 @@ TEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenGettingStateSaveAreaHead
EXPECT_EQ(expectedStateSaveAreaHeader, stateSaveAreaHeader);
}
TEST_P(L0DebuggerParameterizedTests, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenFusedEusAreDisabled) {
TEST_F(L0DebuggerTest, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenFusedEusAreDisabled) {
EXPECT_TRUE(driverHandle->enableProgramDebugging);
EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.fusedEuEnabled);
}
TEST_P(L0DebuggerParameterizedTests, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenCompressionIsDisabled) {
TEST_F(L0DebuggerTest, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenCompressionIsDisabled) {
EXPECT_TRUE(driverHandle->enableProgramDebugging);
EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages);
}
TEST(Debugger, givenL0DebuggerOFFWhenGettingStateSaveAreaHeaderThenValidSipTypeIsReturned) {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
auto isHexadecimalArrayPreferred = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).isSipKernelAsHexadecimalArrayPreferred();
if (!isHexadecimalArrayPreferred) {
auto mockBuiltIns = new NEO::MockBuiltins();
executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns);
}
auto hwInfo = *NEO::defaultHwInfo.get();
hwInfo.featureTable.flags.ftrLocalMemory = true;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
auto neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u);
NEO::DeviceVector devices;
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
driverHandle->enableProgramDebugging = false;
driverHandle->initialize(std::move(devices));
auto sipType = SipKernel::getSipKernelType(*neoDevice);
if (isHexadecimalArrayPreferred) {
SipKernel::initSipKernel(sipType, *neoDevice);
}
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*neoDevice).getStateSaveAreaHeader();
if (isHexadecimalArrayPreferred) {
auto sipKernel = neoDevice->getRootDeviceEnvironment().sipKernels[static_cast<uint32_t>(sipType)].get();
ASSERT_NE(sipKernel, nullptr);
auto &expectedStateSaveAreaHeader = sipKernel->getStateSaveAreaHeader();
EXPECT_EQ(expectedStateSaveAreaHeader, stateSaveAreaHeader);
} else {
auto &expectedStateSaveAreaHeader = neoDevice->getBuiltIns()->getSipKernel(sipType, *neoDevice).getStateSaveAreaHeader();
EXPECT_EQ(expectedStateSaveAreaHeader, stateSaveAreaHeader);
}
}
TEST(Debugger, givenDebuggingEnabledInExecEnvWhenAllocatingIsaThenSingleBankIsUsed) {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingEnabled();
auto hwInfo = *NEO::defaultHwInfo.get();
hwInfo.featureTable.flags.ftrLocalMemory = true;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
std::unique_ptr<NEO::MockDevice> neoDevice(NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u));
auto allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{neoDevice->getRootDeviceIndex(), 4096, NEO::AllocationType::KERNEL_ISA, neoDevice->getDeviceBitfield()});
if (allocation->getMemoryPool() == MemoryPool::LocalMemory) {
EXPECT_EQ(1u, allocation->storageInfo.getMemoryBanks());
} else {
EXPECT_EQ(0u, allocation->storageInfo.getMemoryBanks());
}
neoDevice->getMemoryManager()->freeGraphicsMemory(allocation);
}
using L0DebuggerPerContextAddressSpaceTest = Test<L0DebuggerPerContextAddressSpaceFixture>;
HWTEST_F(L0DebuggerPerContextAddressSpaceTest, givenDebuggingEnabledWhenCommandListIsExecutedThenValidKernelDebugCommandsAreAdded) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
@@ -596,123 +530,6 @@ HWTEST2_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionDisabledCommandLis
commandList->destroy();
}
HWTEST_F(L0DebuggerSimpleTest, whenAllocateCalledThenDebuggerIsCreated) {
auto debugger = DebuggerL0Hw<FamilyType>::allocate(neoDevice);
EXPECT_NE(nullptr, debugger);
delete debugger;
}
HWTEST_F(L0DebuggerSimpleTest, givenDebuggerWithoutMemoryOperationsHandlerWhenNotifyingModuleAllocationsThenNoAllocationIsResident) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
StackVec<NEO::GraphicsAllocation *, 32> allocs;
NEO::GraphicsAllocation alloc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
allocs.push_back(&alloc);
debugger->notifyModuleLoadAllocations(allocs);
}
HWTEST_F(L0DebuggerTest, givenDebuggerWhenCreatedThenModuleHeapDebugAreaIsCreated) {
auto mockBlitMemoryToAllocation = [](const NEO::Device &device, NEO::GraphicsAllocation *memory, size_t offset, const void *hostPtr,
Vec3<size_t> size) -> NEO::BlitOperationResult {
memcpy(memory->getUnderlyingBuffer(), hostPtr, size.x);
return BlitOperationResult::Success;
};
VariableBackup<NEO::BlitHelperFunctions::BlitMemoryToAllocationFunc> blitMemoryToAllocationFuncBackup(
&NEO::BlitHelperFunctions::blitMemoryToAllocation, mockBlitMemoryToAllocation);
memoryOperationsHandler->makeResidentCalledCount = 0;
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
auto debugArea = debugger->getModuleDebugArea();
EXPECT_EQ(1, memoryOperationsHandler->makeResidentCalledCount);
auto allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{neoDevice->getRootDeviceIndex(), 4096, NEO::AllocationType::KERNEL_ISA, neoDevice->getDeviceBitfield()});
EXPECT_EQ(allocation->storageInfo.getMemoryBanks(), debugArea->storageInfo.getMemoryBanks());
DebugAreaHeader *header = reinterpret_cast<DebugAreaHeader *>(debugArea->getUnderlyingBuffer());
EXPECT_EQ(1u, header->pgsize);
uint64_t isShared = debugArea->storageInfo.getNumBanks() == 1 ? 1 : 0;
EXPECT_EQ(isShared, header->isShared);
EXPECT_STREQ("dbgarea", header->magic);
EXPECT_EQ(sizeof(DebugAreaHeader), header->size);
EXPECT_EQ(sizeof(DebugAreaHeader), header->scratchBegin);
EXPECT_EQ(MemoryConstants::pageSize64k - sizeof(DebugAreaHeader), header->scratchEnd);
neoDevice->getMemoryManager()->freeGraphicsMemory(allocation);
}
HWTEST_P(L0DebuggerParameterizedTests, givenBindlessSipWhenModuleHeapDebugAreaIsCreatedThenReservedFieldIsSet) {
DebugManagerStateRestore restorer;
NEO::DebugManager.flags.UseBindlessDebugSip.set(1);
auto mockBlitMemoryToAllocation = [](const NEO::Device &device, NEO::GraphicsAllocation *memory, size_t offset, const void *hostPtr,
Vec3<size_t> size) -> NEO::BlitOperationResult {
memcpy(memory->getUnderlyingBuffer(), hostPtr, size.x);
return BlitOperationResult::Success;
};
VariableBackup<NEO::BlitHelperFunctions::BlitMemoryToAllocationFunc> blitMemoryToAllocationFuncBackup(
&NEO::BlitHelperFunctions::blitMemoryToAllocation, mockBlitMemoryToAllocation);
memoryOperationsHandler->makeResidentCalledCount = 0;
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
auto debugArea = debugger->getModuleDebugArea();
DebugAreaHeader *header = reinterpret_cast<DebugAreaHeader *>(debugArea->getUnderlyingBuffer());
EXPECT_EQ(1u, header->reserved1);
}
HWTEST_P(L0DebuggerParameterizedTests, givenUseBindlessDebugSipZeroWhenModuleHeapDebugAreaIsCreatedThenReservedFieldIsSet) {
DebugManagerStateRestore restorer;
NEO::DebugManager.flags.UseBindlessDebugSip.set(0);
auto mockBlitMemoryToAllocation = [](const NEO::Device &device, NEO::GraphicsAllocation *memory, size_t offset, const void *hostPtr,
Vec3<size_t> size) -> NEO::BlitOperationResult {
memcpy(memory->getUnderlyingBuffer(), hostPtr, size.x);
return BlitOperationResult::Success;
};
VariableBackup<NEO::BlitHelperFunctions::BlitMemoryToAllocationFunc> blitMemoryToAllocationFuncBackup(
&NEO::BlitHelperFunctions::blitMemoryToAllocation, mockBlitMemoryToAllocation);
memoryOperationsHandler->makeResidentCalledCount = 0;
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
auto debugArea = debugger->getModuleDebugArea();
DebugAreaHeader *header = reinterpret_cast<DebugAreaHeader *>(debugArea->getUnderlyingBuffer());
EXPECT_EQ(1u, header->reserved1);
}
TEST(Debugger, givenNonLegacyDebuggerWhenInitializingDeviceCapsThenUnrecoverableIsCalled) {
class MockDebugger : public NEO::Debugger {
public:
MockDebugger() {
isLegacyMode = false;
}
void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override{};
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
return 0;
}
};
auto executionEnvironment = new NEO::ExecutionEnvironment();
auto mockBuiltIns = new NEO::MockBuiltins();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto debugger = new MockDebugger;
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(debugger);
executionEnvironment->initializeMemoryManager();
EXPECT_THROW(NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u), std::exception);
}
using NotXeHPOrDG2 = AreNotGfxCores<IGFX_XE_HP_CORE, IGFX_XE_HPG_CORE>;
HWTEST2_F(L0DebuggerTest, givenNotAtsOrDg2AndDebugIsActiveThenDisableL3CacheInGmmHelperIsNotSet, NotXeHPOrDG2) {
EXPECT_FALSE(static_cast<MockGmmHelper *>(neoDevice->getGmmHelper())->allResourcesUncached);

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen_common/reg_configs_common.h"
#include "shared/source/helpers/register_offsets.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/mocks/mock_gmm_helper.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -31,19 +32,6 @@ struct PerContextAddressSpaceFixture : public Test<DeviceFixture> {
DebugManagerStateRestore restorer;
};
struct L0DebuggerSimpleParameterizedTest : public ::testing::TestWithParam<int>, DeviceFixture {
void SetUp() override {
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(GetParam());
DeviceFixture::SetUp();
}
void TearDown() override {
DeviceFixture::TearDown();
}
DebugManagerStateRestore restorer;
};
using L0DebuggerPerContextAddressSpaceTest = Test<L0DebuggerPerContextAddressSpaceFixture>;
using L0DebuggerTest = Test<L0DebuggerHwFixture>;
@@ -125,73 +113,6 @@ HWTEST_P(L0DebuggerParameterizedTests, givenL0DebuggerWhenCreatedThenPerContextS
}
}
using L0DebuggerMultiSubDeviceTest = Test<SingleRootMultiSubDeviceFixture>;
HWTEST_F(L0DebuggerMultiSubDeviceTest, givenMultiSubDevicesWhenSbaTrackingBuffersAllocatedThenThereIsSeparatePhysicalStorageForEveryContext) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
const auto &engines = neoDevice->getAllEngines();
EXPECT_LE(1u, engines.size());
for (auto &engine : engines) {
auto contextId = engine.osContext->getContextId();
const auto &storageInfo = debugger->perContextSbaAllocations[contextId]->storageInfo;
EXPECT_FALSE(storageInfo.cloningOfPageTables);
EXPECT_EQ(DeviceBitfield{maxNBitValue(numSubDevices)}, storageInfo.memoryBanks);
EXPECT_EQ(DeviceBitfield{maxNBitValue(numSubDevices)}, storageInfo.pageTablesVisibility);
EXPECT_EQ(engine.osContext->getDeviceBitfield().to_ulong(), storageInfo.memoryBanks.to_ulong());
EXPECT_TRUE(storageInfo.tileInstanced);
for (uint32_t i = 0; i < numSubDevices; i++) {
auto sbaHeader = reinterpret_cast<NEO::SbaTrackedAddresses *>(ptrOffset(debugger->perContextSbaAllocations[contextId]->getUnderlyingBuffer(),
debugger->perContextSbaAllocations[contextId]->getUnderlyingBufferSize() * i));
EXPECT_STREQ("sbaarea", sbaHeader->magic);
EXPECT_EQ(0u, sbaHeader->BindlessSamplerStateBaseAddress);
EXPECT_EQ(0u, sbaHeader->BindlessSurfaceStateBaseAddress);
EXPECT_EQ(0u, sbaHeader->DynamicStateBaseAddress);
EXPECT_EQ(0u, sbaHeader->GeneralStateBaseAddress);
EXPECT_EQ(0u, sbaHeader->IndirectObjectBaseAddress);
EXPECT_EQ(0u, sbaHeader->InstructionBaseAddress);
EXPECT_EQ(0u, sbaHeader->SurfaceStateBaseAddress);
EXPECT_EQ(0u, sbaHeader->Version);
}
if (!debugger->singleAddressSpaceSbaTracking) {
EXPECT_EQ(debugger->sbaTrackingGpuVa.address, debugger->perContextSbaAllocations[contextId]->getGpuAddress());
} else {
EXPECT_NE(debugger->sbaTrackingGpuVa.address, debugger->perContextSbaAllocations[contextId]->getGpuAddress());
}
}
const auto &subDevice0Engines = neoDevice->getSubDevice(0)->getAllEngines();
const auto &subDevice1Engines = neoDevice->getSubDevice(1)->getAllEngines();
auto subDeviceEngineSets = {subDevice0Engines, subDevice1Engines};
uint64_t subDeviceIndex = 0;
for (const auto &subDeviceEngines : subDeviceEngineSets) {
for (auto &engine : subDeviceEngines) {
auto contextId = engine.osContext->getContextId();
const auto &storageInfo = debugger->perContextSbaAllocations[contextId]->storageInfo;
EXPECT_FALSE(storageInfo.cloningOfPageTables);
EXPECT_EQ(DeviceBitfield{1llu << subDeviceIndex}, storageInfo.memoryBanks);
EXPECT_EQ(DeviceBitfield{1llu << subDeviceIndex}, storageInfo.pageTablesVisibility);
EXPECT_EQ(engine.osContext->getDeviceBitfield().to_ulong(), storageInfo.memoryBanks.to_ulong());
EXPECT_FALSE(storageInfo.tileInstanced);
if (!debugger->singleAddressSpaceSbaTracking) {
EXPECT_EQ(debugger->sbaTrackingGpuVa.address, debugger->perContextSbaAllocations[contextId]->getGpuAddress());
} else {
EXPECT_NE(debugger->sbaTrackingGpuVa.address, debugger->perContextSbaAllocations[contextId]->getGpuAddress());
}
}
subDeviceIndex++;
}
}
using NotGen8Or11 = AreNotGfxCores<IGFX_GEN8_CORE, IGFX_GEN11_CORE>;
using Gen12Plus = IsAtLeastGfxCore<IGFX_GEN12_CORE>;
@@ -409,267 +330,87 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledWhenCommandListIsExecutedThenSbaB
commandList->destroy();
}
HWTEST_F(PerContextAddressSpaceFixture, givenNonZeroGpuVasWhenProgrammingSbaTrackingThenCorrectCmdsAreAddedToStream) {
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
debugger->singleAddressSpaceSbaTracking = 0;
debugger->sbaTrackingGpuVa.address = 0x45670000;
auto expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, GeneralStateBaseAddress);
StackVec<char, 4096> buffer(4096);
NEO::LinearStream cmdStream(buffer.begin(), buffer.size());
uint64_t gsba = 0x60000;
uint64_t ssba = 0x1234567000;
uint64_t iba = 0xfff80000;
uint64_t ioba = 0x8100000;
uint64_t dsba = 0xffffffffaaaa0000;
NEO::Debugger::SbaAddresses sbaAddresses = {};
sbaAddresses.GeneralStateBaseAddress = gsba;
sbaAddresses.SurfaceStateBaseAddress = ssba;
sbaAddresses.InstructionBaseAddress = iba;
sbaAddresses.IndirectObjectBaseAddress = ioba;
sbaAddresses.DynamicStateBaseAddress = dsba;
sbaAddresses.BindlessSurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommands(cmdStream, sbaAddresses);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
EXPECT_EQ(6 * sizeof(MI_STORE_DATA_IMM), cmdStream.getUsed());
auto sdiItor = find<MI_STORE_DATA_IMM *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), sdiItor);
auto cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
EXPECT_EQ(static_cast<uint32_t>(gsba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(gsba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, SurfaceStateBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(ssba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(ssba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, DynamicStateBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(dsba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(dsba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, IndirectObjectBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(ioba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(ioba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, InstructionBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(iba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(iba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, BindlessSurfaceStateBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(ssba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(ssba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
}
HWTEST_F(PerContextAddressSpaceFixture, givenCanonizedGpuVasWhenProgrammingSbaTrackingThenNonCanonicalAddressesAreStored) {
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
debugger->sbaTrackingGpuVa.address = 0x45670000;
auto expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, GeneralStateBaseAddress);
StackVec<char, 4096> buffer(4096);
NEO::LinearStream cmdStream(buffer.begin(), buffer.size());
uint64_t gsba = 0xffff800000060000;
uint64_t ssba = 0xffff801234567000;
uint64_t iba = 0xffff8000fff80000;
uint64_t ioba = 0xffff800008100000;
uint64_t dsba = 0xffff8000aaaa0000;
NEO::Debugger::SbaAddresses sbaAddresses = {};
sbaAddresses.GeneralStateBaseAddress = gsba;
sbaAddresses.SurfaceStateBaseAddress = ssba;
sbaAddresses.InstructionBaseAddress = iba;
sbaAddresses.IndirectObjectBaseAddress = ioba;
sbaAddresses.DynamicStateBaseAddress = dsba;
sbaAddresses.BindlessSurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommands(cmdStream, sbaAddresses);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
EXPECT_EQ(6 * sizeof(MI_STORE_DATA_IMM), cmdStream.getUsed());
auto sdiItor = find<MI_STORE_DATA_IMM *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), sdiItor);
auto cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
EXPECT_EQ(static_cast<uint32_t>(gsba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(gsba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, SurfaceStateBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(ssba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(ssba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, DynamicStateBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(dsba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(dsba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, IndirectObjectBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(ioba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(ioba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, InstructionBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(iba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(iba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
sdiItor++;
cmdSdi = genCmdCast<MI_STORE_DATA_IMM *>(*sdiItor);
expectedGpuVa = debugger->sbaTrackingGpuVa.address + offsetof(NEO::SbaTrackedAddresses, BindlessSurfaceStateBaseAddress);
EXPECT_EQ(static_cast<uint32_t>(ssba & 0x0000FFFFFFFFULL), cmdSdi->getDataDword0());
EXPECT_EQ(static_cast<uint32_t>(ssba >> 32), cmdSdi->getDataDword1());
EXPECT_EQ(expectedGpuVa, cmdSdi->getAddress());
EXPECT_TRUE(cmdSdi->getStoreQword());
}
HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenZeroGpuVasWhenProgrammingSbaTrackingThenStreamIsNotUsed, Gen12Plus) {
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
debugger->sbaTrackingGpuVa.address = 0x45670000;
StackVec<char, 4096> buffer(4096);
NEO::LinearStream cmdStream(buffer.begin(), buffer.size());
uint64_t gsba = 0;
uint64_t ssba = 0;
NEO::Debugger::SbaAddresses sbaAddresses = {};
sbaAddresses.GeneralStateBaseAddress = gsba;
sbaAddresses.SurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommands(cmdStream, sbaAddresses);
EXPECT_EQ(0u, cmdStream.getUsed());
}
HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenNotChangedSurfaceStateWhenCapturingSBAThenNoTrackingCmdsAreAdded, Gen12Plus) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
debugger->sbaTrackingGpuVa.address = 0x45670000;
NEO::CommandContainer container;
container.initialize(neoDevice, nullptr, true);
NEO::Debugger::SbaAddresses sba = {};
sba.SurfaceStateBaseAddress = 0x123456000;
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
auto sizeUsed = container.getCommandStream()->getUsed();
EXPECT_NE(0u, sizeUsed);
sba.SurfaceStateBaseAddress = 0;
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
auto sizeUsed2 = container.getCommandStream()->getUsed();
EXPECT_EQ(sizeUsed, sizeUsed2);
}
HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenChangedBaseAddressesWhenCapturingSBAThenTrackingCmdsAreAdded, Gen12Plus) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(neoDevice);
debugger->sbaTrackingGpuVa.address = 0x45670000;
{
NEO::CommandContainer container;
container.initialize(neoDevice, nullptr, true);
NEO::Debugger::SbaAddresses sba = {};
sba.SurfaceStateBaseAddress = 0x123456000;
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
auto sizeUsed = container.getCommandStream()->getUsed();
EXPECT_NE(0u, sizeUsed);
}
{
NEO::CommandContainer container;
container.initialize(neoDevice, nullptr, true);
NEO::Debugger::SbaAddresses sba = {};
sba.GeneralStateBaseAddress = 0x123456000;
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
auto sizeUsed = container.getCommandStream()->getUsed();
EXPECT_NE(0u, sizeUsed);
}
{
NEO::CommandContainer container;
container.initialize(neoDevice, nullptr, true);
NEO::Debugger::SbaAddresses sba = {};
sba.BindlessSurfaceStateBaseAddress = 0x123456000;
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
auto sizeUsed = container.getCommandStream()->getUsed();
EXPECT_NE(0u, sizeUsed);
}
}
INSTANTIATE_TEST_CASE_P(SBAModesForDebugger, L0DebuggerParameterizedTests, ::testing::Values(0, 1));
INSTANTIATE_TEST_CASE_P(SBAModesForDebugger, L0DebuggerSimpleParameterizedTest, ::testing::Values(0, 1));
struct L0DebuggerSingleAddressSpace : public Test<L0DebuggerHwFixture> {
void SetUp() override {
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(1);
Test<L0DebuggerHwFixture>::SetUp();
}
void TearDown() override {
Test<L0DebuggerHwFixture>::TearDown();
}
DebugManagerStateRestore restorer;
};
HWTEST2_F(L0DebuggerSingleAddressSpace, givenDebuggingEnabledWhenCommandListIsExecutedThenValidKernelDebugCommandsAreAdded, IsAtLeastGen12lp) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
using STATE_SIP = typename FamilyType::STATE_SIP;
ze_command_queue_desc_t queueDesc = {};
ze_result_t returnValue;
auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue));
ASSERT_NE(nullptr, commandQueue->commandStream);
auto usedSpaceBefore = commandQueue->commandStream->getUsed();
ze_command_list_handle_t commandLists[] = {
CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()};
uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandQueue->commandStream->getUsed();
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandQueue->commandStream->getCpuBase(), 0), usedSpaceAfter));
auto miLoadImm = findAll<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
size_t gpr15RegisterCount = 0;
size_t gprMiLoadindex = std::numeric_limits<size_t>::max();
for (size_t i = 0; i < miLoadImm.size(); i++) {
MI_LOAD_REGISTER_IMM *miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[i]);
ASSERT_NE(nullptr, miLoad);
if (miLoad->getRegisterOffset() == CS_GPR_R15) {
gpr15RegisterCount++;
gprMiLoadindex = i;
}
if (miLoad->getRegisterOffset() == CS_GPR_R15 + 4) {
gpr15RegisterCount++;
}
}
// 2 LRI commands to store SBA buffer address
EXPECT_EQ(2u, gpr15RegisterCount);
auto sbaGpuVa = getMockDebuggerL0Hw<FamilyType>()->getSbaTrackingBuffer(commandQueue->getCsr()->getOsContext().getContextId())->getGpuAddress();
uint32_t low = sbaGpuVa & 0xffffffff;
uint32_t high = (sbaGpuVa >> 32) & 0xffffffff;
MI_LOAD_REGISTER_IMM *miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[gprMiLoadindex]);
EXPECT_EQ(CS_GPR_R15, miLoad->getRegisterOffset());
EXPECT_EQ(low, miLoad->getDataDword());
miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[gprMiLoadindex + 1]);
EXPECT_EQ(CS_GPR_R15 + 4, miLoad->getRegisterOffset());
EXPECT_EQ(high, miLoad->getDataDword());
for (auto i = 0u; i < numCommandLists; i++) {
auto commandList = CommandList::fromHandle(commandLists[i]);
commandList->destroy();
}
commandQueue->destroy();
}
} // namespace ult
} // namespace L0

View File

@@ -1,407 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/cmdlist/cmdlist.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
namespace L0 {
namespace ult {
struct SingleAddressSpaceFixture : public Test<NEO::DeviceFixture> {
void SetUp() override {
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(1);
Test<NEO::DeviceFixture>::SetUp();
}
void TearDown() override {
Test<NEO::DeviceFixture>::TearDown();
}
DebugManagerStateRestore restorer;
};
struct L0DebuggerSingleAddressSpace : public Test<L0DebuggerHwFixture> {
void SetUp() override {
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(1);
Test<L0DebuggerHwFixture>::SetUp();
}
void TearDown() override {
Test<L0DebuggerHwFixture>::TearDown();
}
DebugManagerStateRestore restorer;
};
HWTEST_F(SingleAddressSpaceFixture, givenDebugFlagForceSbaTrackingModeSetWhenDebuggerIsCreatedThenItHasCorrectSingleAddressSpaceValue) {
DebugManagerStateRestore restorer;
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(1);
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
EXPECT_TRUE(debugger->singleAddressSpaceSbaTracking);
NEO::DebugManager.flags.DebuggerForceSbaTrackingMode.set(0);
debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
EXPECT_FALSE(debugger->singleAddressSpaceSbaTracking);
}
HWTEST_F(SingleAddressSpaceFixture, givenSingleAddressSpaceWhenDebuggerIsCreatedThenSbaTrackingGpuVaIsNotReserved) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
EXPECT_EQ(0u, debugger->sbaTrackingGpuVa.address);
EXPECT_EQ(0u, debugger->sbaTrackingGpuVa.size);
EXPECT_EQ(0u, debugger->getSbaTrackingGpuVa());
std::vector<NEO::GraphicsAllocation *> allocations;
auto &allEngines = pDevice->getMemoryManager()->getRegisteredEngines();
for (auto &engine : allEngines) {
auto sbaAllocation = debugger->getSbaTrackingBuffer(engine.osContext->getContextId());
ASSERT_NE(nullptr, sbaAllocation);
allocations.push_back(sbaAllocation);
EXPECT_EQ(NEO::AllocationType::DEBUG_SBA_TRACKING_BUFFER, sbaAllocation->getAllocationType());
}
for (uint32_t i = 0; i < allocations.size() - 1; i++) {
EXPECT_NE(allocations[i]->getGpuAddress(), allocations[i + 1]->getGpuAddress());
}
}
HWTEST2_F(SingleAddressSpaceFixture, WhenProgrammingSbaTrackingCommandsForSingleAddressSpaceThenAbortIsCalledAndNoCommandsAreAddedToStream, IsAtMostGen11) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
using MI_MATH = typename FamilyType::MI_MATH;
StackVec<char, 4096> buffer(4096);
NEO::LinearStream cmdStream(buffer.begin(), buffer.size());
uint64_t gsba = 0x60000;
uint64_t ssba = 0x1234567000;
uint64_t iba = 0xfff80000;
uint64_t ioba = 0x8100000;
uint64_t dsba = 0xffff0000aaaa0000;
NEO::Debugger::SbaAddresses sbaAddresses = {};
sbaAddresses.GeneralStateBaseAddress = gsba;
sbaAddresses.SurfaceStateBaseAddress = ssba;
sbaAddresses.InstructionBaseAddress = iba;
sbaAddresses.IndirectObjectBaseAddress = ioba;
sbaAddresses.DynamicStateBaseAddress = dsba;
sbaAddresses.BindlessSurfaceStateBaseAddress = ssba;
EXPECT_THROW(debugger->programSbaTrackingCommandsSingleAddressSpace(cmdStream, sbaAddresses), std::exception);
EXPECT_EQ(0u, cmdStream.getUsed());
EXPECT_THROW(debugger->getSbaTrackingCommandsSize(6), std::exception);
}
HWTEST2_F(SingleAddressSpaceFixture, GivenNonZeroSbaAddressesWhenProgrammingSbaTrackingCommandsForSingleAddressSpaceThenCorrectSequenceOfCommandsAreAddedToStream, IsAtLeastGen12lp) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
using MI_MATH = typename FamilyType::MI_MATH;
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
AllocationProperties commandBufferProperties = {pDevice->getRootDeviceIndex(),
true,
MemoryConstants::pageSize,
AllocationType::COMMAND_BUFFER,
false,
pDevice->getDeviceBitfield()};
auto streamAllocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandBufferProperties);
ASSERT_NE(nullptr, streamAllocation);
NEO::LinearStream cmdStream;
cmdStream.replaceGraphicsAllocation(streamAllocation);
cmdStream.replaceBuffer(streamAllocation->getUnderlyingBuffer(), streamAllocation->getUnderlyingBufferSize());
uint64_t gsba = 0x60000;
uint64_t ssba = 0x1234567000;
uint64_t iba = 0xfff80000;
uint64_t ioba = 0x8100000;
uint64_t dsba = 0xffff0000aaaa0000;
NEO::Debugger::SbaAddresses sbaAddresses = {};
sbaAddresses.GeneralStateBaseAddress = gsba;
sbaAddresses.SurfaceStateBaseAddress = ssba;
sbaAddresses.InstructionBaseAddress = iba;
sbaAddresses.IndirectObjectBaseAddress = ioba;
sbaAddresses.DynamicStateBaseAddress = dsba;
sbaAddresses.BindlessSurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommandsSingleAddressSpace(cmdStream, sbaAddresses);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
size_t sizeExpected = sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
for (int i = 0; i < 6; i++) {
sizeExpected += NEO::EncodeSetMMIO<FamilyType>::sizeIMM;
sizeExpected += NEO::EncodeMath<FamilyType>::streamCommandSize;
sizeExpected += 2 * sizeof(MI_STORE_REGISTER_MEM);
sizeExpected += 2 * sizeof(MI_STORE_DATA_IMM);
sizeExpected += sizeof(MI_ARB_CHECK);
sizeExpected += sizeof(MI_BATCH_BUFFER_START);
sizeExpected += sizeof(MI_STORE_DATA_IMM);
}
sizeExpected += sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
EXPECT_EQ(sizeExpected, cmdStream.getUsed());
EXPECT_EQ(sizeExpected, debugger->getSbaTrackingCommandsSize(6));
auto itor = find<MI_ARB_CHECK *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_BATCH_BUFFER_START *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
for (int i = 0; i < 6; i++) {
itor = find<MI_LOAD_REGISTER_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
auto lri = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itor);
EXPECT_EQ(CS_GPR_R0, lri->getRegisterOffset());
itor = find<MI_MATH *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_REGISTER_MEM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_REGISTER_MEM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_DATA_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_DATA_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_ARB_CHECK *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_BATCH_BUFFER_START *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_DATA_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
}
itor = find<MI_BATCH_BUFFER_START *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_ARB_CHECK *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
auto miArb = genCmdCast<MI_ARB_CHECK *>(*itor);
EXPECT_FALSE(miArb->getPreParserDisable());
pDevice->getMemoryManager()->freeGraphicsMemory(streamAllocation);
}
HWTEST2_F(SingleAddressSpaceFixture, GivenOneNonZeroSbaAddressesWhenProgrammingSbaTrackingCommandsForSingleAddressSpaceThenONlyPartOfCommandsAreAddedToStream, IsAtLeastGen12lp) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
using MI_MATH = typename FamilyType::MI_MATH;
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
AllocationProperties commandBufferProperties = {pDevice->getRootDeviceIndex(),
true,
MemoryConstants::pageSize,
AllocationType::COMMAND_BUFFER,
false,
pDevice->getDeviceBitfield()};
auto streamAllocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandBufferProperties);
ASSERT_NE(nullptr, streamAllocation);
NEO::LinearStream cmdStream;
cmdStream.replaceGraphicsAllocation(streamAllocation);
cmdStream.replaceBuffer(streamAllocation->getUnderlyingBuffer(), streamAllocation->getUnderlyingBufferSize());
uint64_t ssba = 0x1234567000;
NEO::Debugger::SbaAddresses sbaAddresses = {0};
sbaAddresses.SurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommandsSingleAddressSpace(cmdStream, sbaAddresses);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
size_t sizeExpected = sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
sizeExpected += NEO::EncodeSetMMIO<FamilyType>::sizeIMM;
sizeExpected += NEO::EncodeMath<FamilyType>::streamCommandSize;
sizeExpected += 2 * sizeof(MI_STORE_REGISTER_MEM);
sizeExpected += 2 * sizeof(MI_STORE_DATA_IMM);
sizeExpected += sizeof(MI_ARB_CHECK);
sizeExpected += sizeof(MI_BATCH_BUFFER_START);
sizeExpected += sizeof(MI_STORE_DATA_IMM);
sizeExpected += sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
EXPECT_EQ(sizeExpected, cmdStream.getUsed());
EXPECT_EQ(sizeExpected, debugger->getSbaTrackingCommandsSize(1));
auto itor = find<MI_ARB_CHECK *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_BATCH_BUFFER_START *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_LOAD_REGISTER_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
auto lri = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itor);
EXPECT_EQ(CS_GPR_R0, lri->getRegisterOffset());
itor = find<MI_MATH *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_REGISTER_MEM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_REGISTER_MEM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_DATA_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_DATA_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_ARB_CHECK *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_BATCH_BUFFER_START *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_STORE_DATA_IMM *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_BATCH_BUFFER_START *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
itor = find<MI_ARB_CHECK *>(itor, cmdList.end());
ASSERT_NE(cmdList.end(), itor);
auto miArb = genCmdCast<MI_ARB_CHECK *>(*itor);
EXPECT_FALSE(miArb->getPreParserDisable());
pDevice->getMemoryManager()->freeGraphicsMemory(streamAllocation);
}
HWTEST2_F(SingleAddressSpaceFixture, GivenAllZeroSbaAddressesWhenProgrammingSbaTrackingCommandsForSingleAddressSpaceThenNoCommandsAreAddedToStream, IsAtLeastGen12lp) {
auto debugger = std::make_unique<MockDebuggerL0Hw<FamilyType>>(pDevice);
AllocationProperties commandBufferProperties = {pDevice->getRootDeviceIndex(),
true,
MemoryConstants::pageSize,
AllocationType::COMMAND_BUFFER,
false,
pDevice->getDeviceBitfield()};
auto streamAllocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandBufferProperties);
ASSERT_NE(nullptr, streamAllocation);
NEO::LinearStream cmdStream;
cmdStream.replaceGraphicsAllocation(streamAllocation);
cmdStream.replaceBuffer(streamAllocation->getUnderlyingBuffer(), streamAllocation->getUnderlyingBufferSize());
NEO::Debugger::SbaAddresses sbaAddresses = {0};
debugger->programSbaTrackingCommandsSingleAddressSpace(cmdStream, sbaAddresses);
size_t sizeExpected = 0;
EXPECT_EQ(sizeExpected, cmdStream.getUsed());
pDevice->getMemoryManager()->freeGraphicsMemory(streamAllocation);
}
HWTEST2_F(L0DebuggerSingleAddressSpace, givenDebuggingEnabledWhenCommandListIsExecutedThenValidKernelDebugCommandsAreAdded, IsAtLeastGen12lp) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
using STATE_SIP = typename FamilyType::STATE_SIP;
ze_command_queue_desc_t queueDesc = {};
ze_result_t returnValue;
auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue));
ASSERT_NE(nullptr, commandQueue->commandStream);
auto usedSpaceBefore = commandQueue->commandStream->getUsed();
ze_command_list_handle_t commandLists[] = {
CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()};
uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandQueue->commandStream->getUsed();
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandQueue->commandStream->getCpuBase(), 0), usedSpaceAfter));
auto miLoadImm = findAll<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
size_t gpr15RegisterCount = 0;
size_t gprMiLoadindex = std::numeric_limits<size_t>::max();
for (size_t i = 0; i < miLoadImm.size(); i++) {
MI_LOAD_REGISTER_IMM *miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[i]);
ASSERT_NE(nullptr, miLoad);
if (miLoad->getRegisterOffset() == CS_GPR_R15) {
gpr15RegisterCount++;
gprMiLoadindex = i;
}
if (miLoad->getRegisterOffset() == CS_GPR_R15 + 4) {
gpr15RegisterCount++;
}
}
// 2 LRI commands to store SBA buffer address
EXPECT_EQ(2u, gpr15RegisterCount);
auto sbaGpuVa = getMockDebuggerL0Hw<FamilyType>()->getSbaTrackingBuffer(commandQueue->getCsr()->getOsContext().getContextId())->getGpuAddress();
uint32_t low = sbaGpuVa & 0xffffffff;
uint32_t high = (sbaGpuVa >> 32) & 0xffffffff;
MI_LOAD_REGISTER_IMM *miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[gprMiLoadindex]);
EXPECT_EQ(CS_GPR_R15, miLoad->getRegisterOffset());
EXPECT_EQ(low, miLoad->getDataDword());
miLoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*miLoadImm[gprMiLoadindex + 1]);
EXPECT_EQ(CS_GPR_R15 + 4, miLoad->getRegisterOffset());
EXPECT_EQ(high, miLoad->getDataDword());
for (auto i = 0u; i < numCommandLists; i++) {
auto commandList = CommandList::fromHandle(commandLists[i]);
commandList->destroy();
}
commandQueue->destroy();
}
} // namespace ult
} // namespace L0

View File

@@ -12,12 +12,12 @@
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_compilers.h"
#include "shared/test/common/mocks/mock_elf.h"
#include "shared/test/common/mocks/mock_l0_debugger.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/unit_test/compiler_interface/linker_mock.h"
#include "level_zero/core/source/module/module_imp.h"
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "level_zero/core/test/unit_tests/mocks/mock_module.h"
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"

View File

@@ -5,7 +5,7 @@
*
*/
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "shared/test/unit_test/mocks/mock_l0_debugger.h"
namespace NEO {
struct XeHpFamily;

View File

@@ -5,7 +5,7 @@
*
*/
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "shared/test/unit_test/mocks/mock_l0_debugger.h"
namespace NEO {
struct XE_HPC_COREFamily;

View File

@@ -5,7 +5,7 @@
*
*/
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
#include "shared/test/unit_test/mocks/mock_l0_debugger.h"
namespace NEO {
struct XE_HPG_COREFamily;