From e16112473c09dfdbbc3be42e2a1015a01b69df02 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Thu, 21 Nov 2024 03:31:14 +0000 Subject: [PATCH] merlin/hr_router: support user-defined portcontrol subcomponents For my use-case, I wish to assign bandwidths to local ports different from router-to-router port bandwidths. Although a mechanism exists in hr_router to set heterogeneous port control parameters, it relies on topology logical groups, which is too coarse for assigning properties to local ports (and it's only really used by the dragonfly topology). This patch checks for user-defined subcomponents on an hr_router's portcontrol slots during initialization and assigns them to the associated port. This is enough to override any port settings by setting the subcomponent on any router after building a topology in pymerlin. Also includes a small unit-conversion fix for flit_size in portControl that turned up while testing. --- src/sst/elements/merlin/hr_router/hr_router.cc | 17 +++++++++++++++++ .../elements/merlin/interfaces/portControl.cc | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/sst/elements/merlin/hr_router/hr_router.cc b/src/sst/elements/merlin/hr_router/hr_router.cc index ab5d578d7a..971d691f1d 100644 --- a/src/sst/elements/merlin/hr_router/hr_router.cc +++ b/src/sst/elements/merlin/hr_router/hr_router.cc @@ -245,11 +245,28 @@ hr_router::hr_router(ComponentId_t cid, Params& params) : pc_params.insert("oql_track_port", params.find("oql_track_port","false")); pc_params.insert("oql_track_remote", params.find("oql_track_remote","false")); + SubComponentSlotInfo *pc_info = getSubComponentSlotInfo("portcontrol"); + if ( pc_info ) { + int max_slot = pc_info->getMaxPopulatedSlotNumber(); + if ( max_slot > num_ports ) { + merlin_abort.fatal( + CALL_INFO, 1, + "hr_router has %d ports but portcontrol uses slot %d\n", + num_ports, max_slot); + } + } + for ( int i = 0; i < num_ports; i++ ) { in_port_busy[i] = 0; out_port_busy[i] = 0; progress_vcs[i] = -1; + if ( pc_info && pc_info->isPopulated(i) ) { + ports[i] = pc_info->create + (i, ComponentInfo::SHARE_PORTS | ComponentInfo::SHARE_STATS | ComponentInfo::INSERT_STATS, this, id, i, topo); + continue; + } + std::stringstream port_name; port_name << "port"; port_name << i; diff --git a/src/sst/elements/merlin/interfaces/portControl.cc b/src/sst/elements/merlin/interfaces/portControl.cc index 713a5e8c25..fc88c2e106 100644 --- a/src/sst/elements/merlin/interfaces/portControl.cc +++ b/src/sst/elements/merlin/interfaces/portControl.cc @@ -286,7 +286,7 @@ PortControl::PortControl(ComponentId_t cid, Params& params, Router* rif, int rt "bits (b) or bytes (B): %s\n",flit_size.toStringBestSI().c_str()); } if ( flit_size.hasUnits("B") ) { - flit_size *= UnitAlgebra("8b"); + flit_size *= UnitAlgebra("8b/B"); } std::string output_latency_timebase = params.find("output_latency","0ns");