SWDEV-422207 - Track commands for capture

- Track all captured commands under a new AccumulateCommand
- Add begin() and end() methods to capture commands
- Explicit TS object now passed to certain methods because
profilingBegin() and profilingEnd() now happen separately and thus can
run into threading issues

Change-Id: I171106bdcad72b057836cb2f3fc398db3533119f
This commit is contained in:
Saleel Kudchadker
2023-10-26 20:06:18 +00:00
parent 1338ff37e8
commit 40f41f4d0b
8 changed files with 110 additions and 56 deletions
+8 -8
View File
@@ -529,9 +529,14 @@ hipError_t GraphExec::Run(hipStream_t stream) {
}
if (parallelLists_.size() == 1) {
amd::AccumulateCommand* accumulate = nullptr;
if (DEBUG_CLR_GRAPH_PACKET_CAPTURE) {
accumulate = new amd::AccumulateCommand(*hip_stream);
}
for (int i = 0; i < topoOrder_.size(); i++) {
if (DEBUG_CLR_GRAPH_PACKET_CAPTURE && topoOrder_[i]->GetType() == hipGraphNodeTypeKernel) {
hip_stream->vdev()->dispatchAqlPacket(topoOrder_[i]->GetAqlPacket());
hip_stream->vdev()->dispatchAqlPacket(topoOrder_[i]->GetAqlPacket(), accumulate);
} else {
topoOrder_[i]->SetStream(hip_stream, this);
status = topoOrder_[i]->CreateCommand(topoOrder_[i]->GetQueue());
@@ -540,13 +545,8 @@ hipError_t GraphExec::Run(hipStream_t stream) {
}
if (DEBUG_CLR_GRAPH_PACKET_CAPTURE) {
amd::Command* endCommand = nullptr;
endCommand = new amd::Marker(*hip_stream, false);
// Since the end command is for graph completion tracking,
// it may not need release scopes
endCommand->setEventScope(amd::Device::kCacheStateIgnore);
endCommand->enqueue();
endCommand->release();
accumulate->enqueue();
accumulate->release();
}
} else {
UpdateStream(parallelLists_, hip_stream, this);