Files
TheRock/rocm-systems/projects/rocprofiler-systems/source/bin/rocprof-sys-instrument/function_signature.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

94 lines
3.7 KiB
C++

// Copyright (c) Advanced Micro Devices, Inc.
// SPDX-License-Identifier: MIT
#pragma once
#include "fwd.hpp"
#include <cstdint>
#include <tuple>
struct function_signature
{
using location_t = std::pair<unsigned long, unsigned long>;
function_signature() = default;
function_signature(const function_signature&) = default;
function_signature(function_signature&&) noexcept = default;
function_signature& operator=(const function_signature&) = default;
function_signature& operator=(function_signature&&) noexcept = default;
function_signature(std::string_view _ret, std::string_view _name,
std::string_view _file, location_t _row = { 0, 0 },
location_t _col = { 0, 0 }, bool _loop = false,
bool _info_beg = false, bool _info_end = false);
function_signature(std::string_view _ret, std::string_view _name,
std::string_view _file, const std::vector<std::string>& _params,
location_t _row = { 0, 0 }, location_t _col = { 0, 0 },
bool _loop = false, bool _info_beg = false,
bool _info_end = false);
function_signature& set_loop_number(std::uint32_t _n)
{
m_loop_num = _n;
return *this;
}
static std::string get(function_signature& sig);
std::string get(bool _all = false, bool _save = true) const;
std::string get_coverage(bool _is_basic_block) const;
bool m_loop = false;
bool m_info_beg = false;
bool m_info_end = false;
std::uint32_t m_loop_num = std::numeric_limits<std::uint32_t>::max();
location_t m_row = { 0, 0 };
location_t m_col = { 0, 0 };
std::string m_return = {};
std::string m_name = {};
std::string m_params = "()";
std::string m_file = {};
mutable std::string m_signature = {};
friend bool operator==(const function_signature& lhs, const function_signature& rhs)
{
return lhs.get() == rhs.get();
}
friend bool operator<(const function_signature& lhs, const function_signature& rhs)
{
const auto loop_max = std::numeric_limits<std::uint32_t>::max();
if(lhs.m_loop && !rhs.m_loop) return false;
if(!lhs.m_loop && rhs.m_loop) return true;
if(lhs.m_loop_num < loop_max && rhs.m_loop_num == loop_max) return false;
if(lhs.m_loop_num == loop_max && rhs.m_loop_num < loop_max) return true;
return std::tie(lhs.m_file, lhs.m_name, lhs.m_return, lhs.m_params,
lhs.m_row.first, lhs.m_col.first, lhs.m_loop_num) <
std::tie(rhs.m_file, rhs.m_name, rhs.m_return, rhs.m_params,
rhs.m_row.first, rhs.m_col.first, rhs.m_loop_num);
}
template <typename ArchiveT>
void serialize(ArchiveT& _ar, const unsigned)
{
namespace cereal = tim::cereal;
(void) get();
_ar(cereal::make_nvp("loop", m_loop), cereal::make_nvp("info_beg", m_info_beg),
cereal::make_nvp("info_end", m_info_end), cereal::make_nvp("row", m_row),
cereal::make_nvp("col", m_col), cereal::make_nvp("return", m_return),
cereal::make_nvp("name", m_name), cereal::make_nvp("params", m_params),
cereal::make_nvp("file", m_file), cereal::make_nvp("signature", m_signature));
(void) get();
}
};
struct basic_block_signature
{
using address_t = Dyninst::Address;
address_t start_address = {};
address_t last_address = {};
function_signature signature = {};
};