diff --git a/hipamd/src/hip_graph_internal.cpp b/hipamd/src/hip_graph_internal.cpp index 49e8f795d2..523cd26c28 100644 --- a/hipamd/src/hip_graph_internal.cpp +++ b/hipamd/src/hip_graph_internal.cpp @@ -576,21 +576,17 @@ hipError_t GraphExec::Run(hipStream_t stream) { repeatLaunch_ = true; } - if (parallelLists_.size() == 1 && - instantiateDeviceId_ == hip_stream->DeviceId()) { + if (parallelLists_.size() == 1 && instantiateDeviceId_ == hip_stream->DeviceId()) { + // Accumulate command tracks all the AQL packet batch that we submit to the HW. For now + // we track only kernel nodes. amd::AccumulateCommand* accumulate = nullptr; - bool isLastKernelWithoutHiddenHeap = - ((topoOrder_.back()->GetType() == hipGraphNodeTypeKernel) && - !reinterpret_cast(topoOrder_.back())->HasHiddenHeap()); + if (DEBUG_CLR_GRAPH_PACKET_CAPTURE) { - uint8_t* lastCapturedPacket = - isLastKernelWithoutHiddenHeap ? topoOrder_.back()->GetAqlPacket() : nullptr; - if (topoOrder_.back()->GetEnabled()) { - accumulate = new amd::AccumulateCommand(*hip_stream, {}, nullptr, lastCapturedPacket); - } + accumulate = new amd::AccumulateCommand(*hip_stream, {}, nullptr); } - for (int i = 0; i < topoOrder_.size() - 1; i++) { - if (DEBUG_CLR_GRAPH_PACKET_CAPTURE && topoOrder_[i]->GetType() == hipGraphNodeTypeKernel && + for (int i = 0; i < topoOrder_.size(); i++) { + if (DEBUG_CLR_GRAPH_PACKET_CAPTURE && + topoOrder_[i]->GetType() == hipGraphNodeTypeKernel && !reinterpret_cast(topoOrder_[i])->HasHiddenHeap()) { if (topoOrder_[i]->GetEnabled()) { hip_stream->vdev()->dispatchAqlPacket(topoOrder_[i]->GetAqlPacket(), accumulate); @@ -603,19 +599,6 @@ hipError_t GraphExec::Run(hipStream_t stream) { } } - // If last captured packet is kernel, optimize to detect completion of last kernel - // This saves on extra packet submitted to determine end of graph - if (DEBUG_CLR_GRAPH_PACKET_CAPTURE && isLastKernelWithoutHiddenHeap) { - // Add the last kernel node name to the accumulate command - if (topoOrder_.back()->GetEnabled()) { - accumulate->addKernelName(topoOrder_.back()->GetKernelName()); - } - } else { - topoOrder_.back()->SetStream(hip_stream, this); - status = topoOrder_.back()->CreateCommand(topoOrder_.back()->GetQueue()); - topoOrder_.back()->EnqueueCommands(stream); - } - if (DEBUG_CLR_GRAPH_PACKET_CAPTURE) { accumulate->enqueue(); accumulate->release(); diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index 04e5aea379..59fa10e394 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -3477,23 +3477,11 @@ void VirtualGPU::submitAccumulate(amd::AccumulateCommand& vcmd) { amd::ScopedLock lock(execution()); profilingBegin(vcmd, true); - uint8_t* aqlPacket = vcmd.getLastPacket(); - if (aqlPacket != nullptr) { - dispatchBlockingWait(); - auto packet = reinterpret_cast(aqlPacket); - dispatchGenericAqlPacket(packet, packet->header, packet->setup, false); - // We need to set fence_dirty_ flag as we would use a dispatch packet with a completion signal - // to track graph finish for the last. The sync logic assumes HW event to a barrier packet that - // has a system scope release. This would cause isFenceDirty() check at top level to insert - // barrier packet wherever needed - fence_dirty_ = true; + const Settings& settings = dev().settings(); + if (settings.barrier_value_packet_) { + dispatchBarrierValuePacket(kBarrierVendorPacketNopScopeHeader, true); } else { - const Settings& settings = dev().settings(); - if (settings.barrier_value_packet_) { - dispatchBarrierValuePacket(kBarrierVendorPacketNopScopeHeader, true); - } else { - dispatchBarrierPacket(kNopPacketHeader, false); - } + dispatchBarrierPacket(kNopPacketHeader, false); } profilingEnd(vcmd); diff --git a/rocclr/platform/command.hpp b/rocclr/platform/command.hpp index 06fd4d81cd..aec5417e30 100644 --- a/rocclr/platform/command.hpp +++ b/rocclr/platform/command.hpp @@ -1251,8 +1251,6 @@ class Marker : public Command { class AccumulateCommand : public Command { private: - uint8_t* lastPacket_; - //! Kernel names and timestamps list for activity profiling std::vector kernelNames_; std::vector> tsList_; @@ -1260,12 +1258,9 @@ class AccumulateCommand : public Command { public: //! Create a new Marker AccumulateCommand(HostQueue& queue, const EventWaitList& eventWaitList = nullWaitList, - const Event* waitingEvent = nullptr, uint8_t* lastPacket = nullptr) - : Command(queue, CL_COMMAND_TASK, eventWaitList, 0, waitingEvent), - lastPacket_(lastPacket) + const Event* waitingEvent = nullptr) + : Command(queue, CL_COMMAND_TASK, eventWaitList, 0, waitingEvent) {} - //! Return last packet - uint8_t* getLastPacket() const { return lastPacket_; } //! Add kernel name to the list if available void addKernelName(const std::string& kernelName) {