CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
131 lines
4.9 KiB
C++
131 lines
4.9 KiB
C++
// Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/**
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include <rocRoller/DataTypes/DataTypes.hpp>
|
|
#include <rocRoller/Expression_fwd.hpp>
|
|
#include <rocRoller/Operations/CommandArgument_fwd.hpp>
|
|
#include <rocRoller/Operations/CommandArguments.hpp>
|
|
#include <rocRoller/Operations/OperationTag.hpp>
|
|
#include <rocRoller/Operations/Operations_fwd.hpp>
|
|
#include <rocRoller/Serialization/Base_fwd.hpp>
|
|
|
|
namespace rocRoller
|
|
{
|
|
|
|
struct Command : public std::enable_shared_from_this<Command>
|
|
{
|
|
public:
|
|
using OperationList = std::vector<std::shared_ptr<Operations::Operation>>;
|
|
|
|
Command();
|
|
explicit Command(bool sync);
|
|
~Command();
|
|
|
|
Command(Command const& rhs);
|
|
Command(Command&& rhs);
|
|
|
|
Operations::OperationTag addOperation(std::shared_ptr<Operations::Operation> op);
|
|
template <Operations::CConcreteOperation T>
|
|
Operations::OperationTag addOperation(T&& op);
|
|
|
|
CommandArgumentPtr allocateArgument(VariableType variableType,
|
|
Operations::OperationTag const&,
|
|
ArgumentType argType,
|
|
DataDirection direction = DataDirection::ReadWrite);
|
|
CommandArgumentPtr allocateArgument(VariableType variableType,
|
|
Operations::OperationTag const&,
|
|
ArgumentType argType,
|
|
DataDirection direction,
|
|
std::string const& name);
|
|
|
|
std::vector<CommandArgumentPtr> allocateArgumentVector(DataType dataType,
|
|
int length,
|
|
Operations::OperationTag const& tag,
|
|
ArgumentType argType,
|
|
DataDirection direction
|
|
= DataDirection::ReadWrite);
|
|
|
|
std::vector<CommandArgumentPtr> allocateArgumentVector(DataType dataType,
|
|
int length,
|
|
Operations::OperationTag const& tag,
|
|
ArgumentType argType,
|
|
DataDirection direction,
|
|
std::string const& name);
|
|
|
|
std::shared_ptr<Operations::Operation> findTag(Operations::OperationTag const& tag) const;
|
|
|
|
template <Operations::CConcreteOperation T>
|
|
T getOperation(Operations::OperationTag const& tag) const;
|
|
|
|
Operations::OperationTag getNextTag() const;
|
|
Operations::OperationTag allocateTag();
|
|
|
|
OperationList const& operations() const;
|
|
|
|
std::string toString() const;
|
|
std::string toString(const unsigned char*) const;
|
|
std::string argInfo() const;
|
|
|
|
/**
|
|
* Returns a list of all of the CommandArguments within a Command.
|
|
*/
|
|
std::vector<CommandArgumentPtr> getArguments() const;
|
|
|
|
/**
|
|
* NOTE: Debugging & testing purposes only.
|
|
*
|
|
* Reads the values of each of the command arguments out of `args` and returns them in
|
|
* a map based on the name of each argument.
|
|
*/
|
|
std::map<std::string, CommandArgumentValue>
|
|
readArguments(RuntimeArguments const& args) const;
|
|
|
|
/**
|
|
* Returns the expected workItemCount for a command.
|
|
* This is determined by finding the sizes for the first T_LOAD_LINEAR
|
|
* command appearing in the command object.
|
|
*/
|
|
std::array<Expression::ExpressionPtr, 3> createWorkItemCount() const;
|
|
|
|
CommandArguments createArguments() const;
|
|
|
|
static std::string toYAML(Command const&);
|
|
static Command fromYAML(std::string const& str);
|
|
|
|
bool operator==(Command const& rhs) const;
|
|
|
|
private:
|
|
template <typename T1, typename T2, typename T3>
|
|
friend struct rocRoller::Serialization::MappingTraits;
|
|
|
|
/// Does this command need to synchronize before continuing the calling CPU thread?
|
|
bool m_sync = false;
|
|
|
|
OperationList m_operations;
|
|
|
|
std::map<Operations::OperationTag, std::shared_ptr<Operations::Operation>> m_tagMap;
|
|
|
|
ArgumentOffsetMap m_argOffsetMap;
|
|
|
|
std::vector<CommandArgumentPtr> m_commandArgs;
|
|
|
|
Operations::OperationTag m_nextTagValue{0};
|
|
|
|
int m_runtimeArgsOffset = 0;
|
|
};
|
|
|
|
std::ostream& operator<<(std::ostream& stream, Command const& command);
|
|
|
|
}
|
|
|
|
#include <rocRoller/Operations/Command_impl.hpp>
|