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
127 lines
3.9 KiB
C++
127 lines
3.9 KiB
C++
// Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
#include <rocRoller/DataTypes/DataTypes.hpp>
|
|
#include <rocRoller/InstructionValues/Register_fwd.hpp>
|
|
#include <rocRoller/Operations/CommandArgument_fwd.hpp>
|
|
|
|
namespace rocRoller
|
|
{
|
|
class KernelArguments
|
|
{
|
|
public:
|
|
explicit KernelArguments(bool log = true, size_t bytes = 0);
|
|
|
|
void reserve(size_t bytes, size_t count);
|
|
|
|
template <CScaleType T>
|
|
void writeValue(size_t offset, T value);
|
|
|
|
template <typename T>
|
|
void writeValue(size_t offset, T value);
|
|
|
|
template <typename T>
|
|
void append(std::string const& argName, T value);
|
|
|
|
template <typename T>
|
|
void appendUnbound(std::string const& argName);
|
|
|
|
template <typename T>
|
|
void bind(std::string const& argName, T value);
|
|
|
|
bool isFullyBound() const;
|
|
|
|
bool log() const;
|
|
void const* data() const;
|
|
size_t size() const;
|
|
std::vector<uint8_t> const& dataVector() const;
|
|
RuntimeArguments runtimeArguments() const;
|
|
|
|
std::string toString() const;
|
|
|
|
friend std::ostream& operator<<(std::ostream& stream, const KernelArguments& t);
|
|
friend class const_iterator;
|
|
|
|
using ArgPair = std::pair<void const*, size_t>;
|
|
|
|
class const_iterator
|
|
{
|
|
public:
|
|
using iterator_category = std::input_iterator_tag;
|
|
using value_type = ArgPair const;
|
|
using difference_type = std::ptrdiff_t;
|
|
using pointer = ArgPair const*;
|
|
using reference = ArgPair const&;
|
|
|
|
explicit const_iterator(KernelArguments const& args);
|
|
const_iterator(KernelArguments const& args, std::string const& argName);
|
|
const_iterator(const const_iterator& other) = default;
|
|
const_iterator& operator++();
|
|
const_iterator operator++(int);
|
|
bool operator==(const const_iterator& rhs) const;
|
|
bool operator!=(const const_iterator& rhs) const;
|
|
bool isEnd() const;
|
|
ArgPair const& operator*() const;
|
|
ArgPair const* operator->() const;
|
|
void reset();
|
|
template <typename T>
|
|
operator T() const;
|
|
|
|
private:
|
|
void assignCurrentArg();
|
|
|
|
KernelArguments const& m_args;
|
|
std::vector<std::string>::const_iterator m_currentArg;
|
|
ArgPair m_value;
|
|
};
|
|
|
|
const_iterator begin() const;
|
|
const_iterator end() const;
|
|
|
|
private:
|
|
enum
|
|
{
|
|
ArgOffset,
|
|
ArgSize,
|
|
ArgBound,
|
|
ArgString,
|
|
NumArgFields
|
|
};
|
|
using Arg = std::tuple<size_t, size_t, bool, std::string>;
|
|
static_assert(std::tuple_size<Arg>::value == NumArgFields,
|
|
"Enum for fields of Arg tuple doesn't match size of tuple.");
|
|
|
|
void alignTo(size_t alignment);
|
|
|
|
template <CScaleType T>
|
|
void append(std::string const& argName, T value, bool bound);
|
|
|
|
template <typename T>
|
|
void append(std::string const& argName, T value, bool bound);
|
|
|
|
template <typename T>
|
|
std::string stringForValue(T value, bool bound) const;
|
|
|
|
void appendRecord(std::string const& argName, Arg record);
|
|
|
|
std::vector<uint8_t> m_data;
|
|
|
|
std::vector<std::string> m_names;
|
|
std::unordered_map<std::string, Arg> m_argRecords;
|
|
|
|
bool m_log;
|
|
};
|
|
|
|
std::ostream& operator<<(std::ostream& stream, const KernelArguments& t);
|
|
std::ostream& operator<<(std::ostream& stream, const KernelArguments::const_iterator& iter);
|
|
|
|
} // namespace rocRoller
|
|
|
|
#include <rocRoller/KernelArguments_impl.hpp>
|