feature: add methods to handle additional extensions in graph dump

Related-To: NEO-15606

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2025-11-25 14:27:21 +00:00
committed by Compute-Runtime-Automation
parent c3467abdb3
commit 21ec747aa3
7 changed files with 57 additions and 7 deletions

View File

@@ -355,7 +355,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt(
return L0::zeCommandListAppendWaitExternalSemaphoreExt(hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents);
}
ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelWithArguments(
ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelWithArguments(
ze_command_list_handle_t hCommandList,
ze_kernel_handle_t hKernel,
const ze_group_count_t groupCounts,

View File

@@ -649,10 +649,6 @@ TEST(GraphForks, GivenUnknownChildCommandlistThenJoinDoesNothing) {
TEST(GraphForks, GivenNullEventThenRecordHandleSignaleEventDoesNothing) {
GraphsCleanupGuard graphCleanup;
struct MockGraph : Graph {
using Graph::Graph;
using Graph::recordedSignals;
};
Mock<Context> ctx;
Mock<CommandList> cmdlist;
cmdlist.cmdListType = L0::CommandList::CommandListType::typeImmediate;
@@ -1026,6 +1022,8 @@ TEST_F(GraphTestInstantiationTest, WhenInstantiatingGraphThenBakeCommandsIntoCom
EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListAppendLaunchMultipleKernelsIndirect(immCmdListHandle, numKernels, pKernelHandles, pCountBuffer, &groupCount, nullptr, 0, nullptr));
EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListAppendLaunchKernelWithParameters(immCmdListHandle, kernelHandle, &groupCount, nullptr, nullptr, 0, nullptr));
EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListAppendLaunchKernelWithArguments(immCmdListHandle, kernelHandle, groupCount, groupSize, nullptr, nullptr, nullptr, 0, nullptr));
EXPECT_EQ(ZE_RESULT_SUCCESS, zexCommandListAppendMemoryCopyWithParameters(immCmdListHandle, memA, memB, sizeof(memA), nullptr, 0, nullptr, nullptr));
EXPECT_EQ(ZE_RESULT_SUCCESS, zexCommandListAppendMemoryFillWithParameters(immCmdListHandle, memA, memB, 4, sizeof(memA), nullptr, nullptr, 0, nullptr));
EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListEndGraphCaptureExp(immCmdListHandle, &srcGraphHandle, nullptr));
@@ -1059,6 +1057,8 @@ TEST_F(GraphTestInstantiationTest, WhenInstantiatingGraphThenBakeCommandsIntoCom
EXPECT_EQ(0U, graphHwCommands->appendLaunchKernelIndirectCalled);
EXPECT_EQ(0U, graphHwCommands->appendLaunchMultipleKernelsIndirectCalled);
EXPECT_EQ(0U, graphHwCommands->appendLaunchKernelWithParametersCalled);
EXPECT_EQ(0U, graphHwCommands->appendMemoryCopyWithParametersCalled);
EXPECT_EQ(0U, graphHwCommands->appendMemoryFillWithParametersCalled);
execGraph.instantiateFrom(srcGraph);
EXPECT_EQ(1U, graphHwCommands->appendBarrierCalled);
EXPECT_EQ(1U, graphHwCommands->appendMemoryCopyCalled);
@@ -1085,6 +1085,8 @@ TEST_F(GraphTestInstantiationTest, WhenInstantiatingGraphThenBakeCommandsIntoCom
EXPECT_EQ(1U, graphHwCommands->appendLaunchKernelIndirectCalled);
EXPECT_EQ(1U, graphHwCommands->appendLaunchMultipleKernelsIndirectCalled);
EXPECT_EQ(2U, graphHwCommands->appendLaunchKernelWithParametersCalled); // +1 for zeCommandListAppendLaunchKernelWithArguments
EXPECT_EQ(1U, graphHwCommands->appendMemoryCopyWithParametersCalled);
EXPECT_EQ(1U, graphHwCommands->appendMemoryFillWithParametersCalled);
}
TEST_F(GraphTestInstantiationTest, GivenGraphPatchPreambleDebugFlagWhenInstantiatingGraphThenUseDebugSettingForPatchPreamble) {

View File

@@ -17,6 +17,7 @@ namespace ult {
struct MockGraph : Graph {
using Graph::captureTargetDesc;
using Graph::Graph;
using Graph::recordedSignals;
};
struct MockExecutableGraph : ExecutableGraph {

View File

@@ -9,9 +9,10 @@ target_sources(${L0_STATIC_LIB_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/graph.h
${CMAKE_CURRENT_SOURCE_DIR}/graph_captured_apis.h
${CMAKE_CURRENT_SOURCE_DIR}/graph_export.cpp
${CMAKE_CURRENT_SOURCE_DIR}/graph_export.h
${CMAKE_CURRENT_SOURCE_DIR}/graph_captured_apis.h
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}graph_export_imp.cpp
)
add_subdirectories()

View File

@@ -455,7 +455,7 @@ void addLaunchKernelExtensionParameters(std::vector<std::pair<std::string, std::
params.emplace_back("cooperative.stype", stypeValue);
params.emplace_back("cooperative.isCooperative", (cooperativeDesc->isCooperative != 0) ? "true" : "false");
} else {
params.emplace_back("extension.stype", stypeValue + " (not recognized)");
addLaunchKernelAdditionalExtensionParameters(params, baseDesc);
}
baseDesc = reinterpret_cast<const ze_base_desc_t *>(baseDesc->pNext);
@@ -469,6 +469,13 @@ void addMemoryTransferExtensionParameters(std::vector<std::pair<std::string, std
}
params.emplace_back("pNext", formatPointer(pNext));
const auto *baseDesc = reinterpret_cast<const ze_base_desc_t *>(pNext);
while (baseDesc != nullptr) {
addMemoryTransferAdditionalExtensionParameters(params, baseDesc);
baseDesc = reinterpret_cast<const ze_base_desc_t *>(baseDesc->pNext);
}
}
template <>

View File

@@ -63,6 +63,10 @@ std::string_view getKernelName(ze_kernel_handle_t kernelHandle);
std::string_view getKernelName(const CapturedCommand &cmd);
void addKernelInformation(std::vector<std::pair<std::string, std::string>> &params, ze_kernel_handle_t kernelHandle);
void addLaunchKernelExtensionParameters(std::vector<std::pair<std::string, std::string>> &params, const void *pNext);
void addMemoryTransferExtensionParameters(std::vector<std::pair<std::string, std::string>> &params, const void *pNext);
void addLaunchKernelAdditionalExtensionParameters(std::vector<std::pair<std::string, std::string>> &params, const ze_base_desc_t *baseDesc);
void addMemoryTransferAdditionalExtensionParameters(std::vector<std::pair<std::string, std::string>> &params, const ze_base_desc_t *baseDesc);
} // namespace GraphDumpHelper

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/experimental/source/graph/graph.h"
#include "level_zero/experimental/source/graph/graph_export.h"
#include "level_zero/ze_api.h"
#include <optional>
#include <sstream>
#include <string>
#include <string_view>
namespace L0 {
namespace GraphDumpHelper {
void addLaunchKernelAdditionalExtensionParameters(std::vector<std::pair<std::string, std::string>> &params, const ze_base_desc_t *baseDesc) {
const auto stypeValue = std::to_string(static_cast<uint32_t>(baseDesc->stype));
params.emplace_back("extension.stype", stypeValue + " (not recognized)");
}
void addMemoryTransferAdditionalExtensionParameters(std::vector<std::pair<std::string, std::string>> &params, const ze_base_desc_t *baseDesc) {
const auto stypeValue = std::to_string(static_cast<uint32_t>(baseDesc->stype));
params.emplace_back("extension.stype", stypeValue + " (not recognized)");
}
} // namespace GraphDumpHelper
} // namespace L0