Files
TheRock/rocm-libraries/shared/rocroller/lib/include/rocRoller/Graph/HypergraphIncidenceContainer.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

108 lines
3.9 KiB
C++

// Copyright Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
#pragma once
#include <map>
#include <vector>
#include <rocRoller/Serialization/Base_fwd.hpp>
#include <rocRoller/Utilities/Concepts.hpp>
namespace rocRoller
{
namespace Graph
{
class HypergraphIncidenceContainer
{
public:
/**
* @brief Add incident connections to container. These represent connection between
* elements of a graph.
*
* @tparam T_Inputs Range of graph tags
* @tparam T_Outputs Range of graph tags
* @param tag Graph tag of element to be connected
* @param inputs Graph tags of input elements to be connected upstream of `tag`
* @param outputs Graph indices of output elements to be connected downstream of `tag`
*/
template <CForwardRangeOf<int> T_Inputs, CForwardRangeOf<int> T_Outputs>
void addIncidentConnections(int tag, T_Inputs const& inputs, T_Outputs const& outputs);
/**
* @brief Gets the number of incident connections in the container
*
* @return size_t Number of unique connections
*/
size_t size() const;
/**
* @brief Purge incident connections that refer to this tag
*
* @param tag Graph tag of element to be deleted
*/
void deleteTag(int tag);
/**
* @brief Get all connected sources
*
* @param tag Graph tag of element to be queried
* @return std::vector<int> a series of graph indices for incoming elements
*/
std::vector<int> getSrcs(int tag) const;
/**
* @brief Get all connected destinations
*
* @param tag Graph tag of element to be queried
* @return std::vector<int> a series of graph indices for outgoing elements
*/
std::vector<int> getDsts(int tag) const;
/**
* @brief Get a count of all connected sources to element at tag
*
* @param tag Graph tag of element to be queried
* @return size_t Count of all connected sources
*/
size_t getSrcCount(int tag) const;
/**
* @brief Get a count of all connected destinations to element at tag
*
* @param tag Graph tag of element to be queried
* @return size_t Count of all connected destinations
*/
size_t getDstCount(int tag) const;
std::string toDOTSection(std::string const& prefix = "") const;
private:
template <typename T1, typename T2, typename T3>
friend struct rocRoller::Serialization::MappingTraits;
/**
* @brief The incidence structure of the Hypergraph, sorted by sources, then by
* connection order.
*
* NOTE: This structure does not preserve the order of sources connected to a
* destination element. This storage structure is duplicated to maintain that ordering
* and for quick lookup.
*/
std::map<int, std::vector<int>> m_incidenceBySrc;
/**
* @brief The incidence structure of the Hypergraph, sorted by destinations, then by
* connection order.
*
* NOTE: This structure does not preserve the order of destinations connected to a
* source element. This storage structure is duplicated to maintain that ordering and
* for quick lookup.
*/
std::map<int, std::vector<int>> m_incidenceByDst;
};
}
}
#include <rocRoller/Graph/HypergraphIncidenceContainer_impl.hpp>