// Copyright Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #pragma once #include #include #include #include #include #include #include #include namespace rocRoller { namespace Scheduling { /** * A `Cost` is a base class for the different types of costs used to determine scheduling order. * * - This class should be able to be made into `ComponentBase` class */ class Cost { public: using Argument = std::tuple; /** * @brief Collection of Tuples where the first member is the index of the generator * and the second member is the cost next instruction for the given iteration * */ using Result = std::vector>; Cost(ContextPtr); static const std::string Basename; virtual std::string name() const = 0; virtual float cost(Instruction const& inst, InstructionStatus const& status) const = 0; /** * @brief Gets the sorted costs for the collection of generator iterators * * @return Sorted collection of Tuples based on lowest cost where * the first member is the index of the generator * and the second member is the cost next instruction for the given iteration */ Result operator()(std::vector::iterator>&) const; float operator()(Instruction const& inst) const; /** * @brief Gets the cost of one generator for the given iteration * * @return float */ float operator()(Generator::iterator&) const; protected: std::weak_ptr m_ctx; }; std::ostream& operator<<(std::ostream&, CostFunction); } } #include