Files
TheRock/rocm-libraries/shared/rocroller/lib/include/rocRoller/Operations/CommandArgument.hpp
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

102 lines
3.3 KiB
C++

// Copyright Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
/**
*/
#pragma once
#include <optional>
#include <string>
#include <rocRoller/AssemblyKernel_fwd.hpp>
#include <rocRoller/DataTypes/DataTypes.hpp>
#include <rocRoller/Expression_fwd.hpp>
#include <rocRoller/InstructionValues/Register_fwd.hpp>
#include <rocRoller/KernelArguments_fwd.hpp>
#include <rocRoller/Operations/CommandArgument_fwd.hpp>
#include <rocRoller/Operations/Command_fwd.hpp>
#include <rocRoller/Serialization/Base_fwd.hpp>
namespace rocRoller
{
// CommandArgumentValue: type alias for std::variant of all value type.
// Defined in CommandArgument_fwd.hpp.
// RuntimeArguments: type alias for a container that holds runtime arguments.
/**
* An incoming argument. Obtaining the underlying value is
* intentionally difficult, to prevent accidentally generating a
* kernel dependent on an argument having a specific value.
*
* Any specific optimizations based on an argument having a
* specific value or type of value should be implemented through
* the predication mechanism.
*/
class CommandArgument : public std::enable_shared_from_this<CommandArgument>
{
public:
CommandArgument(CommandPtr com,
VariableType variableType,
size_t offset,
DataDirection direction = DataDirection::ReadWrite,
std::string name = "");
VariableType variableType() const;
/**
* Size & offset into the argument packet. May not be set
*/
int size() const;
int offset() const;
std::string name() const;
DataDirection direction() const;
std::string toString() const;
CommandArgumentValue getValue(RuntimeArguments const& args) const;
Expression::ExpressionPtr expression();
template <typename T>
requires(!std::is_pointer_v<T>) CommandArgumentValue getValue(RuntimeArguments const& args)
const;
bool operator==(CommandArgument const& rhs) const;
private:
template <typename T1, typename T2, typename T3>
friend struct rocRoller::Serialization::MappingTraits;
std::weak_ptr<Command> m_command;
int m_size;
size_t m_offset;
VariableType m_variableType;
DataDirection m_direction;
std::string m_name;
};
std::ostream& operator<<(std::ostream&, CommandArgument const&);
std::ostream& operator<<(std::ostream&, CommandArgumentPtr const&);
std::ostream& operator<<(std::ostream&, std::vector<CommandArgumentPtr> const&);
VariableType variableType(CommandArgumentValue const& val);
std::string name(CommandArgumentValue const& val);
std::string toString(CommandArgumentValue const& val);
std::ostream& operator<<(std::ostream&, CommandArgumentValue const&);
/**
* Returns an unsigned integer from a CommandArgumentValue.
* If the CommandArgumentValue is not an integer, an exception will be thrown.
*/
unsigned int getUnsignedInt(CommandArgumentValue val);
/**
* Returns true if a CommandArgumentValue is an integer type.
*/
bool isInteger(CommandArgumentValue val);
}
#include <rocRoller/Operations/CommandArgument_impl.hpp>