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
112 lines
3.6 KiB
C++
112 lines
3.6 KiB
C++
// Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#pragma once
|
|
|
|
#include <rocRoller/DataTypes/DataTypes.hpp>
|
|
#include <rocRoller/Graph/Hypergraph.hpp>
|
|
#include <rocRoller/Serialization/Base.hpp>
|
|
#include <rocRoller/Serialization/Containers.hpp>
|
|
#include <rocRoller/Serialization/Expression.hpp>
|
|
#include <rocRoller/Serialization/HasTraits.hpp>
|
|
#include <rocRoller/Serialization/Variant.hpp>
|
|
|
|
namespace rocRoller
|
|
{
|
|
namespace Serialization
|
|
{
|
|
template <typename IO>
|
|
struct MappingTraits<Graph::HypergraphIncidenceContainer, IO, EmptyContext>
|
|
{
|
|
using iot = IOTraits<IO>;
|
|
|
|
static void mapping(IO& io, Graph::HypergraphIncidenceContainer& incidence)
|
|
{
|
|
iot::mapRequired(io, "incidenceBySrc", incidence.m_incidenceBySrc);
|
|
iot::mapRequired(io, "incidenceByDst", incidence.m_incidenceByDst);
|
|
}
|
|
|
|
static void
|
|
mapping(IO& io, Graph::HypergraphIncidenceContainer& incidence, EmptyContext&)
|
|
{
|
|
mapping(io, incidence);
|
|
}
|
|
};
|
|
|
|
template <CNamedVariant Var>
|
|
struct ElementEntry
|
|
{
|
|
int id;
|
|
Var value;
|
|
};
|
|
|
|
template <CNamedVariant Var, typename IO, typename Context>
|
|
struct MappingTraits<ElementEntry<Var>, IO, Context>
|
|
{
|
|
using iot = IOTraits<IO>;
|
|
using Entry = ElementEntry<Var>;
|
|
|
|
static void mapping(IO& io, Entry& entry, Context ctx)
|
|
{
|
|
iot::mapRequired(io, "id", entry.id);
|
|
|
|
MappingTraits<Var, IO, Context>::mapping(io, entry.value, ctx);
|
|
}
|
|
|
|
static void mapping(IO& io, Entry& entry)
|
|
{
|
|
AssertFatal((std::same_as<EmptyContext, Context>));
|
|
|
|
Context ctx;
|
|
mapping(io, entry, ctx);
|
|
}
|
|
};
|
|
|
|
template <CNamedVariant Var, typename IO>
|
|
struct SequenceTraits<std::vector<ElementEntry<Var>>, IO>
|
|
: public DefaultSequenceTraits<std::vector<ElementEntry<Var>>, IO, false>
|
|
{
|
|
};
|
|
|
|
// template <CNamedVariant Value, typename IO>
|
|
// struct CustomMappingTraits<std::map<int, Value>, IO>
|
|
// : public DefaultCustomMappingTraits<std::map<int, Value>, IO, false, false>
|
|
// {
|
|
// };
|
|
|
|
template <typename Node, typename Edge, bool Hyper, typename IO>
|
|
struct MappingTraits<Graph::Hypergraph<Node, Edge, Hyper>, IO, EmptyContext>
|
|
{
|
|
using iot = IOTraits<IO>;
|
|
using HG = Graph::Hypergraph<Node, Edge, Hyper>;
|
|
using Element = typename HG::Element;
|
|
|
|
static void mapping(IO& io, HG& graph)
|
|
{
|
|
std::vector<ElementEntry<Element>> elements;
|
|
if(iot::outputting(io))
|
|
{
|
|
elements.reserve(graph.m_elements.size());
|
|
for(auto const& pair : graph.m_elements)
|
|
elements.push_back({pair.first, pair.second});
|
|
}
|
|
|
|
iot::mapRequired(io, "elements", elements);
|
|
|
|
if(!iot::outputting(io))
|
|
{
|
|
for(auto const& entry : elements)
|
|
graph.m_elements[entry.id] = entry.value;
|
|
}
|
|
|
|
iot::mapRequired(io, "incidence", graph.m_incidence);
|
|
}
|
|
|
|
static void mapping(IO& io, HG& graph, EmptyContext&)
|
|
{
|
|
mapping(io, graph);
|
|
}
|
|
};
|
|
}
|
|
}
|