Split test_l0_debugger file
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
e182aa6055
commit
6e7515a12b
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2020 Intel Corporation
|
# Copyright (C) 2020-2021 Intel Corporation
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,8 @@ target_sources(${TARGET_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/active_debugger_fixture.h
|
${CMAKE_CURRENT_SOURCE_DIR}/active_debugger_fixture.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/l0_debugger_fixture.h
|
${CMAKE_CURRENT_SOURCE_DIR}/l0_debugger_fixture.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test_source_level_debugger.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test_source_level_debugger.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger_1.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_debugger_2.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test_module_with_debug.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test_module_with_debug.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,17 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/command_stream/linear_stream.h"
|
|
||||||
#include "shared/source/gen_common/reg_configs_common.h"
|
#include "shared/source/gen_common/reg_configs_common.h"
|
||||||
#include "shared/source/helpers/blit_commands_helper.h"
|
|
||||||
#include "shared/source/helpers/preamble.h"
|
#include "shared/source/helpers/preamble.h"
|
||||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
|
||||||
#include "shared/source/os_interface/os_context.h"
|
|
||||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||||
#include "shared/test/common/helpers/variable_backup.h"
|
|
||||||
#include "shared/test/common/mocks/mock_gmm_helper.h"
|
#include "shared/test/common/mocks/mock_gmm_helper.h"
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
#include "level_zero/core/source/image/image_hw.h"
|
|
||||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||||
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
|
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
|
||||||
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
|
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
|
||||||
|
|
||||||
#include <bitset>
|
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
namespace ult {
|
namespace ult {
|
||||||
|
|
||||||
|
@ -517,448 +509,6 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledWhenCommandListIsExecutedThenSbaB
|
||||||
commandList->destroy();
|
commandList->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct L0DebuggerInternalUsageTest : public L0DebuggerTest {
|
|
||||||
void SetUp() override {
|
|
||||||
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
|
|
||||||
defaultHwInfo->capabilityTable.blitterOperationsSupported = true;
|
|
||||||
L0DebuggerTest::SetUp();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenFlushTaskSubmissionEnabledWhenCommandListIsInititalizedOrResetThenCaptureSbaIsNotCalled) {
|
|
||||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
|
||||||
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
size_t usedSpaceBefore = 0;
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
|
|
||||||
ASSERT_GE(usedSpaceAfter, usedSpaceBefore);
|
|
||||||
|
|
||||||
GenCmdList cmdList;
|
|
||||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
|
||||||
cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter));
|
|
||||||
|
|
||||||
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
|
||||||
ASSERT_EQ(cmdList.end(), sbaItor);
|
|
||||||
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
|
||||||
|
|
||||||
commandList->reset();
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenFlushTaskSubmissionDisabledWhenCommandListIsInititalizedOrResetThenCaptureSbaIsCalled) {
|
|
||||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
|
||||||
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
size_t usedSpaceBefore = 0;
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
|
|
||||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
|
||||||
|
|
||||||
GenCmdList cmdList;
|
|
||||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
|
||||||
cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter));
|
|
||||||
|
|
||||||
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
|
||||||
ASSERT_NE(cmdList.end(), sbaItor);
|
|
||||||
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
|
||||||
|
|
||||||
commandList->reset();
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenDebuggerLogsDisabledWhenCommandListIsSynchronizedThenSbaAddressesAreNotPrinted) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.DebuggerLogBitmask.set(0);
|
|
||||||
|
|
||||||
EXPECT_NE(nullptr, device->getL0Debugger());
|
|
||||||
testing::internal::CaptureStdout();
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
commandList->executeCommandListImmediate(false);
|
|
||||||
|
|
||||||
std::string output = testing::internal::GetCapturedStdout();
|
|
||||||
size_t pos = output.find("Debugger: SBA");
|
|
||||||
EXPECT_EQ(std::string::npos, pos);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendLaunchKernelThenSuccessIsReturned) {
|
|
||||||
Mock<::L0::Kernel> kernel;
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
ze_group_count_t groupCount{1, 1, 1};
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendLaunchKernelThenSuccessIsReturned) {
|
|
||||||
Mock<::L0::Kernel> kernel;
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
ze_group_count_t groupCount{1, 1, 1};
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendLaunchKernelIndirectThenSuccessIsReturned) {
|
|
||||||
Mock<::L0::Kernel> kernel;
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
ze_group_count_t groupCount{1, 1, 1};
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendLaunchKernelIndirect(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendLaunchKernelIndirectThenSuccessIsReturned) {
|
|
||||||
Mock<::L0::Kernel> kernel;
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
ze_group_count_t groupCount{1, 1, 1};
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendLaunchKernelIndirect(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendMemoryCopyThenSuccessIsReturned) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendMemoryCopyThenSuccessIsReturned) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendMemoryCopyRegionThenSuccessIsReturned) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
uint32_t width = 16;
|
|
||||||
uint32_t height = 16;
|
|
||||||
ze_copy_region_t sr = {0U, 0U, 0U, width, height, 0U};
|
|
||||||
ze_copy_region_t dr = {0U, 0U, 0U, width, height, 0U};
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dr, 0, 0, srcPtr, &sr, 0, 0, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForRegularCommandListForAppendMemoryCopyRegionThenSuccessIsReturned) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
uint32_t width = 16;
|
|
||||||
uint32_t height = 16;
|
|
||||||
ze_copy_region_t sr = {0U, 0U, 0U, width, height, 0U};
|
|
||||||
ze_copy_region_t dr = {0U, 0U, 0U, width, height, 0U};
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue;
|
|
||||||
auto commandQueue = whitebox_cast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue));
|
|
||||||
ASSERT_NE(nullptr, commandQueue->commandStream);
|
|
||||||
|
|
||||||
ze_command_list_handle_t commandLists[] = {
|
|
||||||
CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()};
|
|
||||||
const uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
|
|
||||||
|
|
||||||
auto commandList = CommandList::fromHandle(commandLists[0]);
|
|
||||||
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dr, 0, 0, srcPtr, &sr, 0, 0, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandQueue->synchronize(0);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
commandQueue->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendMemoryCopyRegionThenSuccessIsReturned) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
ze_copy_region_t dstRegion = {};
|
|
||||||
ze_copy_region_t srcRegion = {};
|
|
||||||
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
|
|
||||||
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dstRegion, 0, 0, srcPtr, &srcRegion, 0, 0, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
const ze_command_queue_desc_t queueDesc = {};
|
|
||||||
bool internalEngine = true;
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
|
|
||||||
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
|
|
||||||
ze_result_t returnValue;
|
|
||||||
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
|
|
||||||
device,
|
|
||||||
&queueDesc,
|
|
||||||
internalEngine,
|
|
||||||
NEO::EngineGroupType::Copy,
|
|
||||||
returnValue));
|
|
||||||
ASSERT_NE(nullptr, commandList0);
|
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
|
||||||
if (neoDevice->getInternalCopyEngine()) {
|
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
|
||||||
} else {
|
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
|
||||||
desc.type = ZE_IMAGE_TYPE_3D;
|
|
||||||
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
|
|
||||||
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
|
|
||||||
desc.width = 11;
|
|
||||||
desc.height = 13;
|
|
||||||
desc.depth = 17;
|
|
||||||
|
|
||||||
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
|
|
||||||
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
|
|
||||||
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
|
|
||||||
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
|
|
||||||
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
|
||||||
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
|
||||||
imageHWSrc->initialize(device, &desc);
|
|
||||||
imageHWDst->initialize(device, &desc);
|
|
||||||
|
|
||||||
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
|
||||||
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
|
||||||
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
const ze_command_queue_desc_t queueDesc = {};
|
|
||||||
bool internalEngine = true;
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
|
|
||||||
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
|
|
||||||
ze_result_t returnValue;
|
|
||||||
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
|
|
||||||
device,
|
|
||||||
&queueDesc,
|
|
||||||
internalEngine,
|
|
||||||
NEO::EngineGroupType::Copy,
|
|
||||||
returnValue));
|
|
||||||
ASSERT_NE(nullptr, commandList0);
|
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
|
||||||
if (neoDevice->getInternalCopyEngine()) {
|
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
|
||||||
} else {
|
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
|
||||||
desc.type = ZE_IMAGE_TYPE_3D;
|
|
||||||
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
|
|
||||||
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
|
|
||||||
desc.width = 11;
|
|
||||||
desc.height = 13;
|
|
||||||
desc.depth = 17;
|
|
||||||
|
|
||||||
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
|
|
||||||
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
|
|
||||||
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
|
|
||||||
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
|
|
||||||
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
|
||||||
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
|
||||||
imageHWSrc->initialize(device, &desc);
|
|
||||||
imageHWDst->initialize(device, &desc);
|
|
||||||
|
|
||||||
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
|
||||||
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
|
||||||
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledCommandListAndAppendMemoryCopyCalledInLoopThenMultipleCommandBufferAreUsedAndSuccessIsReturned, IsSklOrAbove) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
ASSERT_NE(nullptr, commandList);
|
|
||||||
|
|
||||||
for (uint32_t count = 0; count < 2048; count++) {
|
|
||||||
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
}
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledCommandListAndAppendMemoryCopyCalledInLoopThenMultipleCommandBufferAreUsedAndSuccessIsReturned, IsSklOrAbove) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
|
||||||
|
|
||||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
|
||||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
|
||||||
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
|
||||||
ASSERT_NE(nullptr, commandList);
|
|
||||||
|
|
||||||
for (uint32_t count = 0; count < 2048; count++) {
|
|
||||||
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
|
||||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
}
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenDebuggingEnabledWhenInternalCmdQIsUsedThenDebuggerPathsAreNotExecuted, IsSklOrAbove) {
|
|
||||||
ze_command_queue_desc_t queueDesc = {};
|
|
||||||
|
|
||||||
std::unique_ptr<MockCommandQueueHw<gfxCoreFamily>, Deleter> commandQueue(new MockCommandQueueHw<gfxCoreFamily>(device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc));
|
|
||||||
commandQueue->initialize(false, true);
|
|
||||||
EXPECT_TRUE(commandQueue->internalUsage);
|
|
||||||
ze_result_t returnValue;
|
|
||||||
ze_command_list_handle_t commandLists[] = {
|
|
||||||
CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue)->toHandle()};
|
|
||||||
uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
|
|
||||||
|
|
||||||
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
|
|
||||||
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().getContextId());
|
|
||||||
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
|
|
||||||
auto debugSurface = device->getDebugSurface();
|
|
||||||
bool sbaFound = false;
|
|
||||||
bool sipFound = false;
|
|
||||||
bool debugSurfaceFound = false;
|
|
||||||
|
|
||||||
for (auto iter : commandQueue->residencyContainerSnapshot) {
|
|
||||||
if (iter == sbaBuffer) {
|
|
||||||
sbaFound = true;
|
|
||||||
}
|
|
||||||
if (iter == sipIsa) {
|
|
||||||
sipFound = true;
|
|
||||||
}
|
|
||||||
if (iter == debugSurface) {
|
|
||||||
debugSurfaceFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXPECT_FALSE(sbaFound);
|
|
||||||
EXPECT_FALSE(sipFound);
|
|
||||||
EXPECT_FALSE(debugSurfaceFound);
|
|
||||||
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->programSbaTrackingCommandsCount);
|
|
||||||
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->getSbaTrackingCommandsSizeCount);
|
|
||||||
|
|
||||||
auto commandList = CommandList::fromHandle(commandLists[0]);
|
|
||||||
commandList->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionEnabledWithImmediateCommandListToInvokeNonKernelOperationsThenSuccessIsReturned) {
|
HWTEST_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionEnabledWithImmediateCommandListToInvokeNonKernelOperationsThenSuccessIsReturned) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
|
@ -0,0 +1,473 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2021 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
#include "level_zero/core/source/image/image_hw.h"
|
||||||
|
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||||
|
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
|
||||||
|
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
using L0DebuggerTest = Test<L0DebuggerHwFixture>;
|
||||||
|
|
||||||
|
struct L0DebuggerInternalUsageTest : public L0DebuggerTest {
|
||||||
|
void SetUp() override {
|
||||||
|
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
|
||||||
|
defaultHwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||||
|
L0DebuggerTest::SetUp();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenFlushTaskSubmissionEnabledWhenCommandListIsInititalizedOrResetThenCaptureSbaIsNotCalled) {
|
||||||
|
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||||
|
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
size_t usedSpaceBefore = 0;
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
|
||||||
|
ASSERT_GE(usedSpaceAfter, usedSpaceBefore);
|
||||||
|
|
||||||
|
GenCmdList cmdList;
|
||||||
|
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||||
|
cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter));
|
||||||
|
|
||||||
|
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||||
|
ASSERT_EQ(cmdList.end(), sbaItor);
|
||||||
|
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
||||||
|
|
||||||
|
commandList->reset();
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenFlushTaskSubmissionDisabledWhenCommandListIsInititalizedOrResetThenCaptureSbaIsCalled) {
|
||||||
|
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||||
|
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
size_t usedSpaceBefore = 0;
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
|
||||||
|
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||||
|
|
||||||
|
GenCmdList cmdList;
|
||||||
|
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||||
|
cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter));
|
||||||
|
|
||||||
|
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||||
|
ASSERT_NE(cmdList.end(), sbaItor);
|
||||||
|
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
||||||
|
|
||||||
|
commandList->reset();
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenDebuggerLogsDisabledWhenCommandListIsSynchronizedThenSbaAddressesAreNotPrinted) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.DebuggerLogBitmask.set(0);
|
||||||
|
|
||||||
|
EXPECT_NE(nullptr, device->getL0Debugger());
|
||||||
|
testing::internal::CaptureStdout();
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
commandList->executeCommandListImmediate(false);
|
||||||
|
|
||||||
|
std::string output = testing::internal::GetCapturedStdout();
|
||||||
|
size_t pos = output.find("Debugger: SBA");
|
||||||
|
EXPECT_EQ(std::string::npos, pos);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendLaunchKernelThenSuccessIsReturned) {
|
||||||
|
Mock<::L0::Kernel> kernel;
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
ze_group_count_t groupCount{1, 1, 1};
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendLaunchKernelThenSuccessIsReturned) {
|
||||||
|
Mock<::L0::Kernel> kernel;
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
ze_group_count_t groupCount{1, 1, 1};
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendLaunchKernelIndirectThenSuccessIsReturned) {
|
||||||
|
Mock<::L0::Kernel> kernel;
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
ze_group_count_t groupCount{1, 1, 1};
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendLaunchKernelIndirect(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendLaunchKernelIndirectThenSuccessIsReturned) {
|
||||||
|
Mock<::L0::Kernel> kernel;
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
ze_group_count_t groupCount{1, 1, 1};
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendLaunchKernelIndirect(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendMemoryCopyThenSuccessIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendMemoryCopyThenSuccessIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendMemoryCopyRegionThenSuccessIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
uint32_t width = 16;
|
||||||
|
uint32_t height = 16;
|
||||||
|
ze_copy_region_t sr = {0U, 0U, 0U, width, height, 0U};
|
||||||
|
ze_copy_region_t dr = {0U, 0U, 0U, width, height, 0U};
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dr, 0, 0, srcPtr, &sr, 0, 0, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForRegularCommandListForAppendMemoryCopyRegionThenSuccessIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
uint32_t width = 16;
|
||||||
|
uint32_t height = 16;
|
||||||
|
ze_copy_region_t sr = {0U, 0U, 0U, width, height, 0U};
|
||||||
|
ze_copy_region_t dr = {0U, 0U, 0U, width, height, 0U};
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue;
|
||||||
|
auto commandQueue = whitebox_cast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue));
|
||||||
|
ASSERT_NE(nullptr, commandQueue->commandStream);
|
||||||
|
|
||||||
|
ze_command_list_handle_t commandLists[] = {
|
||||||
|
CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()};
|
||||||
|
const uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
|
||||||
|
|
||||||
|
auto commandList = CommandList::fromHandle(commandLists[0]);
|
||||||
|
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dr, 0, 0, srcPtr, &sr, 0, 0, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandQueue->synchronize(0);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
commandQueue->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendMemoryCopyRegionThenSuccessIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
ze_copy_region_t dstRegion = {};
|
||||||
|
ze_copy_region_t srcRegion = {};
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
|
||||||
|
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dstRegion, 0, 0, srcPtr, &srcRegion, 0, 0, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
const ze_command_queue_desc_t queueDesc = {};
|
||||||
|
bool internalEngine = true;
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
|
||||||
|
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
|
||||||
|
ze_result_t returnValue;
|
||||||
|
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
|
||||||
|
device,
|
||||||
|
&queueDesc,
|
||||||
|
internalEngine,
|
||||||
|
NEO::EngineGroupType::Copy,
|
||||||
|
returnValue));
|
||||||
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_image_desc_t desc = {};
|
||||||
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
desc.type = ZE_IMAGE_TYPE_3D;
|
||||||
|
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
|
||||||
|
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
|
||||||
|
desc.width = 11;
|
||||||
|
desc.height = 13;
|
||||||
|
desc.depth = 17;
|
||||||
|
|
||||||
|
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
|
||||||
|
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
|
||||||
|
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
|
||||||
|
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
|
||||||
|
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
||||||
|
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
||||||
|
imageHWSrc->initialize(device, &desc);
|
||||||
|
imageHWDst->initialize(device, &desc);
|
||||||
|
|
||||||
|
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
const ze_command_queue_desc_t queueDesc = {};
|
||||||
|
bool internalEngine = true;
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
|
||||||
|
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
|
||||||
|
ze_result_t returnValue;
|
||||||
|
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
|
||||||
|
device,
|
||||||
|
&queueDesc,
|
||||||
|
internalEngine,
|
||||||
|
NEO::EngineGroupType::Copy,
|
||||||
|
returnValue));
|
||||||
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_image_desc_t desc = {};
|
||||||
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
desc.type = ZE_IMAGE_TYPE_3D;
|
||||||
|
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
|
||||||
|
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
|
||||||
|
desc.width = 11;
|
||||||
|
desc.height = 13;
|
||||||
|
desc.depth = 17;
|
||||||
|
|
||||||
|
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
|
||||||
|
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
|
||||||
|
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
|
||||||
|
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
|
||||||
|
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
||||||
|
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
|
||||||
|
imageHWSrc->initialize(device, &desc);
|
||||||
|
imageHWDst->initialize(device, &desc);
|
||||||
|
|
||||||
|
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
using IsSklOrAbove = IsAtLeastProduct<IGFX_SKYLAKE>;
|
||||||
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledCommandListAndAppendMemoryCopyCalledInLoopThenMultipleCommandBufferAreUsedAndSuccessIsReturned, IsSklOrAbove) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
ASSERT_NE(nullptr, commandList);
|
||||||
|
|
||||||
|
for (uint32_t count = 0; count < 2048; count++) {
|
||||||
|
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
}
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledCommandListAndAppendMemoryCopyCalledInLoopThenMultipleCommandBufferAreUsedAndSuccessIsReturned, IsSklOrAbove) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue);
|
||||||
|
ASSERT_NE(nullptr, commandList);
|
||||||
|
|
||||||
|
for (uint32_t count = 0; count < 2048; count++) {
|
||||||
|
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
}
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Deleter {
|
||||||
|
void operator()(CommandQueueImp *cmdQ) {
|
||||||
|
cmdQ->destroy();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenDebuggingEnabledWhenInternalCmdQIsUsedThenDebuggerPathsAreNotExecuted, IsSklOrAbove) {
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
|
||||||
|
std::unique_ptr<MockCommandQueueHw<gfxCoreFamily>, Deleter> commandQueue(new MockCommandQueueHw<gfxCoreFamily>(device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc));
|
||||||
|
commandQueue->initialize(false, true);
|
||||||
|
EXPECT_TRUE(commandQueue->internalUsage);
|
||||||
|
ze_result_t returnValue;
|
||||||
|
ze_command_list_handle_t commandLists[] = {
|
||||||
|
CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue)->toHandle()};
|
||||||
|
uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
|
||||||
|
|
||||||
|
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().getContextId());
|
||||||
|
auto sipIsa = NEO::SipKernel::getSipKernel(*neoDevice).getSipAllocation();
|
||||||
|
auto debugSurface = device->getDebugSurface();
|
||||||
|
bool sbaFound = false;
|
||||||
|
bool sipFound = false;
|
||||||
|
bool debugSurfaceFound = false;
|
||||||
|
|
||||||
|
for (auto iter : commandQueue->residencyContainerSnapshot) {
|
||||||
|
if (iter == sbaBuffer) {
|
||||||
|
sbaFound = true;
|
||||||
|
}
|
||||||
|
if (iter == sipIsa) {
|
||||||
|
sipFound = true;
|
||||||
|
}
|
||||||
|
if (iter == debugSurface) {
|
||||||
|
debugSurfaceFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPECT_FALSE(sbaFound);
|
||||||
|
EXPECT_FALSE(sipFound);
|
||||||
|
EXPECT_FALSE(debugSurfaceFound);
|
||||||
|
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->programSbaTrackingCommandsCount);
|
||||||
|
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->getSbaTrackingCommandsSizeCount);
|
||||||
|
|
||||||
|
auto commandList = CommandList::fromHandle(commandLists[0]);
|
||||||
|
commandList->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
Loading…
Reference in New Issue