// Copyright Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #pragma once #include #include namespace rocRoller::KernelGraph { class LastRWTracer : public ControlFlowRWTracer { public: LastRWTracer(KernelGraph const& graph, int start = -1, bool trackConnections = false) : ControlFlowRWTracer(graph, start, trackConnections) { } using ControlStack = std::deque; /** * @brief Return operations that read/write coordinate last. * * Returns a map where the keys are coordinate tags, and the * value is a set with all of the control nodes that touch the * coordinate last. */ std::unordered_map> lastRWLocations() const; std::unordered_map> lastArgLocations(ControlFlowArgumentTracer const& argTracer) const; private: template std::unordered_map> getLastLocationsFromControlStacks( std::unordered_map> const& controlStacks) const; }; }