[UR][L0v2] Add graph support for batched queue#21324
[UR][L0v2] Add graph support for batched queue#21324KFilipek wants to merge 15 commits intointel:syclfrom
Conversation
560edb4 to
7c9779b
Compare
09eaf7d to
2200aa5
Compare
2200aa5 to
3f6298f
Compare
1d21010 to
66e360e
Compare
44d0c9e to
77ae0d5
Compare
| ur_bool_t graph_supported = false; | ||
| ASSERT_SUCCESS(urDeviceGetInfo( | ||
| device, UR_DEVICE_INFO_GRAPH_RECORD_AND_REPLAY_SUPPORT_EXP, | ||
| sizeof(graph_supported), &graph_supported, nullptr)); | ||
|
|
||
| if (!graph_supported) { |
There was a problem hiding this comment.
I think this part could be moved to a helper method.
116ac26 to
c975178
Compare
There was a problem hiding this comment.
setGraphCapture() is not set to true here, but it is set to false in ur_queue_batched_t::queueEndGraphCapteExp(). Is it intentional?
There was a problem hiding this comment.
Fixed — setGraphCapture(true) is now called at line 1048 in queueBeginCapteIntoGraphExp, symmetrically with the false in queueEndGraphCapteExp. Both begin variants set the flag.
There was a problem hiding this comment.
markIssuedCommandInBatch() is intended to be used only with regular lists. Are we sure that getListManager() does not return an immediate list? According to this comment and this comment, it is likely that we work on an immediate list here.
There was a problem hiding this comment.
markIssuedCommandInBatch() now returns early when isGraphCaptureActive() is true (lines 164–168). During capture, commands go to the immediate list, so there's nothing to track in the batch counter.
There was a problem hiding this comment.
Is it possible to record queueFlush() or queueFinish() on the graph?
There was a problem hiding this comment.
We could verify whether the data is correctly written to the buffer.
5bb0193 to
24efe33
Compare
| ur_result_t ur_queue_batched_t::queueFlush() { | ||
| auto batchLocked = currentCmdLists.lock(); | ||
|
|
||
| if (batchLocked->isActiveBatchEmpty()) { |
There was a problem hiding this comment.
I think we should first check whether the graph capture mode is active, and then, if active - enqueue the graph, return from the function.
There was a problem hiding this comment.
I might be wrong, see the comment for queueFinish
| } | ||
|
|
||
| ur_result_t | ||
| ur_queue_batched_t::queueFinishUnlocked(locked<batch_manager> &batchLocked) { |
There was a problem hiding this comment.
Firstly, we should check whether the graph capture is active and enqueue the graph if active.
There was a problem hiding this comment.
I don't think that recorded graph should be enqueued when graph capture is active and queueFinish is called. There's a separate enqueueGraph function for enqueueing graphs, so for active graph capture queueFinish should probably be noop.
There was a problem hiding this comment.
@kswiecicki It's what I've added, noop when graph capture is active.
There was a problem hiding this comment.
Why should this be noop? I don't mean that it's bad, I just want to understand the reasoning behind this decision.
Maybe I don't understand what are the consequences of the active graph mode. Are operations immediately submitted then?
There was a problem hiding this comment.
We can't synchronize the current queue with host, since the queue is in graph capture mode, and the graph wasn't finalized yet. Hence I think that this should either return some INVALID error or be a noop.
e59a819 to
3109250
Compare
| // Firstly, enqueue the current batch (a regular list), then enqueue the | ||
| // command buffer batch (also a regular list) to preserve the order of | ||
| // operations | ||
| if (!lockedBatch->isActiveBatchEmpty()) { |
There was a problem hiding this comment.
Does it work with the current implementation and the graph capture being enabled?
cb286b4 to
375088d
Compare
|
Rebased |
…ero v2 batched queue
During graph capture, commands are appended to an immediate command list instead of the regular batch.
Before beginning graph capture, enqueue the current batch (regular command list) to preserve operation order. This ensures the queue is empty before switching to immediate list mode for graph capture, similar to command buffer handling. Apply to both queueBeginGraphCapteExp and queueBeginCapteIntoGraphExp.
During graph capture, operations are recorded to the immediate command list. Synchronization and flushing operations don't apply to graph recording, so return early when graph capture is active. Also added a clarifying comment in queueIsGraphCapteEnabledExp about the returned command list.
This ensures consistency with other enqueue methods and provides proper context for event handling during graph capture.
375088d to
a1f61c9
Compare
This reverts commit e7c2d50.
This PR adds support for graph capture and execution in the Level Zero v2 batched queue implementation.
Changes:
capture state