diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index a449a3ed4d..17784ffc5b 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -477,6 +477,10 @@ struct CommandList : _ze_command_list_handle_t { void forceDisableInOrderWaits() { inOrderWaitsDisabled = true; } + ze_command_list_flags_t getCmdListFlags() const { + return flags; + } + protected: NEO::GraphicsAllocation *getAllocationFromHostPtrMap(const void *buffer, uint64_t bufferSize, bool copyOffload); NEO::GraphicsAllocation *getHostPtrAlloc(const void *buffer, uint64_t bufferSize, bool hostCopyAllowed, bool copyOffload); @@ -519,6 +523,7 @@ struct CommandList : _ze_command_list_handle_t { CommandQueue *cmdQImmediateCopyOffload = nullptr; Device *device = nullptr; NEO::ScratchSpaceController *usedScratchController = nullptr; + Graph *captureTarget = nullptr; size_t minimalSizeForBcsSplit = 4 * MemoryConstants::megaByte; size_t cmdListCurrentStartOffset = 0; @@ -579,8 +584,6 @@ struct CommandList : _ze_command_list_handle_t { bool isWalkerWithProfilingEnqueued = false; bool shouldRegisterEnqueuedWalkerWithProfiling = false; bool inOrderWaitsDisabled = false; - - Graph *captureTarget = nullptr; }; using CommandListAllocatorFn = CommandList *(*)(uint32_t); diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index b34cb17a02..d3c0e0554b 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -237,6 +237,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device if ((cmdQdesc.flags & ZE_COMMAND_QUEUE_FLAG_IN_ORDER) || (NEO::debugManager.flags.ForceInOrderImmediateCmdListExecution.get() == 1)) { commandList->enableInOrderExecution(); + commandList->flags |= ZE_COMMAND_LIST_FLAG_IN_ORDER; } if (queueProperties.synchronizedDispatchMode != NEO::SynchronizedDispatchMode::disabled) { diff --git a/level_zero/core/test/unit_tests/experimental/test_graph.cpp b/level_zero/core/test/unit_tests/experimental/test_graph.cpp index f06ccdaa2a..e175208937 100644 --- a/level_zero/core/test/unit_tests/experimental/test_graph.cpp +++ b/level_zero/core/test/unit_tests/experimental/test_graph.cpp @@ -82,6 +82,7 @@ TEST(GraphTestApiCaptureBeginEnd, GivenValidDestinyGraphThenBeginCaptureReturnsS GraphsCleanupGuard graphCleanup; Mock ctx; Mock cmdlist; + cmdlist.flags = ZE_COMMAND_LIST_FLAG_IN_ORDER; L0::Graph graph(&ctx, true); auto err = ::zeCommandListBeginCaptureIntoGraphExp(&cmdlist, &graph, nullptr); @@ -91,6 +92,8 @@ TEST(GraphTestApiCaptureBeginEnd, GivenValidDestinyGraphThenBeginCaptureReturnsS err = ::zeCommandListEndGraphCaptureExp(&cmdlist, &retGraph, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, err); EXPECT_EQ(retGraph, &graph); + + EXPECT_EQ(static_cast(ZE_COMMAND_LIST_FLAG_IN_ORDER), graph.getCaptureTargetDesc().desc.flags); } TEST(GraphTestApiCaptureBeginEnd, GivenNonNullPNextThenGraphEndCaptureReturnsError) { diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp index 2462e8fb11..342dc074f1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp @@ -130,6 +130,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenQueueFlagWhenCreatingCmdL EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListCreateImmediate(context, device, &cmdQueueDesc, &cmdList)); EXPECT_TRUE(static_cast *>(cmdList)->isInOrderExecutionEnabled()); + auto flags = static_cast *>(cmdList)->getCmdListFlags(); + EXPECT_EQ(static_cast(ZE_COMMAND_LIST_FLAG_IN_ORDER), flags); EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListDestroy(cmdList)); } diff --git a/level_zero/experimental/source/graph/graph.cpp b/level_zero/experimental/source/graph/graph.cpp index 82c7203f30..fe61ac4c79 100644 --- a/level_zero/experimental/source/graph/graph.cpp +++ b/level_zero/experimental/source/graph/graph.cpp @@ -34,6 +34,7 @@ void Graph::startCapturingFrom(L0::CommandList &captureSrc, bool isSubGraph) { captureSrc.getDeviceHandle(&this->captureTargetDesc.hDevice); this->captureTargetDesc.desc.stype = ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC; this->captureTargetDesc.desc.pNext = nullptr; + this->captureTargetDesc.desc.flags = captureSrc.getCmdListFlags(); captureSrc.getOrdinal(&this->captureTargetDesc.desc.commandQueueGroupOrdinal); if (isSubGraph) { this->executionTarget = &captureSrc; diff --git a/level_zero/experimental/source/graph/graph.h b/level_zero/experimental/source/graph/graph.h index 0e19f87dca..2a6cfe9d22 100644 --- a/level_zero/experimental/source/graph/graph.h +++ b/level_zero/experimental/source/graph/graph.h @@ -136,7 +136,7 @@ struct Graph : _ze_graph_handle_t { struct CaptureTargetDesc { ze_device_handle_t hDevice = nullptr; - ze_command_list_desc_t desc; + ze_command_list_desc_t desc{}; }; const CaptureTargetDesc &getCaptureTargetDesc() const { @@ -182,20 +182,21 @@ struct Graph : _ze_graph_handle_t { void unregisterSignallingEvents(); ClosureExternalStorage externalStorage; + CaptureTargetDesc captureTargetDesc; + std::vector commands; StackVec subGraphs; - L0::CommandList *captureSrc = nullptr; - CaptureTargetDesc captureTargetDesc; - L0::CommandList *executionTarget = nullptr; - - L0::Context *ctx = nullptr; - bool preallocated = false; - bool wasCapturingStopped = false; - std::unordered_map recordedSignals; std::unordered_map unjoinedForks; std::unordered_map joinedForks; + + L0::CommandList *captureSrc = nullptr; + L0::CommandList *executionTarget = nullptr; + L0::Context *ctx = nullptr; + + bool preallocated = false; + bool wasCapturingStopped = false; }; void recordHandleWaitEventsFromNextCommand(L0::CommandList &srcCmdList, Graph *&captureTarget, std::span events);