Skip to content

Commit

Permalink
merlin/bridge: load user subcomponent for networkIF
Browse files Browse the repository at this point in the history
pymerlin expects to override a SimpleNetwork subcomponent with its own
network subcomponent (e.g., LinkControl). When using a Bridge, this
subcomponent is ignored and link initialization crashes on
SST::Link::sendUntimedData when trying to access a null rtr object. This
patch extends the Bridge component to use the user subcomponent if the
subcomponent slot is populated and if not then fall back to using an
anonymous subcomponent as before.
  • Loading branch information
heyitsanthony committed Oct 7, 2024
1 parent 5ae55c8 commit c273614
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/sst/elements/merlin/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,29 @@ class Bridge : public SST::Component {
dbg.debug(CALL_INFO, 2, 0, "Initializing network interface %d\n", id);
Nic_t &nic = interfaces[id];

Params if_params;

if_params.insert("link_bw",params.find<std::string>("network_bw","80GiB/s"));
if_params.insert("input_buf_size",params.find<std::string>("network_input_buffer_size", "1KiB"));
if_params.insert("output_buf_size",params.find<std::string>("network_output_buffer_size", "1KiB"));
if_params.insert("port_name","network" + std::to_string(id));

nic.nic = loadAnonymousSubComponent<SST::Interfaces::SimpleNetwork>
("merlin.linkcontrol", "networkIF", id,
ComponentInfo::SHARE_PORTS | ComponentInfo::INSERT_STATS, if_params, 1 /* vns */);

SubComponentSlotInfo *info = getSubComponentSlotInfo("networkIF");
if (info) {
int maxSlot = info->getMaxPopulatedSlotNumber();
if (maxSlot > 1) {
dbg.fatal(CALL_INFO, 1,
"May only specify slots 0 and 1 for 'networkIF'; maximum slot given: %d.\n",
maxSlot);
}
}
if (!info || !info->isPopulated(id)) {
Params if_params;
if_params.insert("link_bw",params.find<std::string>("network_bw","80GiB/s"));
if_params.insert("input_buf_size",params.find<std::string>("network_input_buffer_size", "1KiB"));
if_params.insert("output_buf_size",params.find<std::string>("network_output_buffer_size", "1KiB"));
if_params.insert("port_name","network" + std::to_string(id));

nic.nic = loadAnonymousSubComponent<SimpleNetwork>
("merlin.linkcontrol", "networkIF", id,
ComponentInfo::SHARE_PORTS | ComponentInfo::INSERT_STATS, if_params, 1 /* vns */);
} else {
nic.nic = info->create<SimpleNetwork>(id, ComponentInfo::SHARE_PORTS, 1 /* vns */);
}

// nic.nic = (SimpleNetwork*)loadSubComponent("merlin.linkcontrol", this, params);
// nic.nic->initialize( "network" + std::to_string(id),
// params.find<SST::UnitAlgebra>("network_bw", SST::UnitAlgebra("80GiB/s")),
// 1, /* should be num VN */
// params.find<SST::UnitAlgebra>("network_input_buffer_size", SST::UnitAlgebra("1KiB")),
// params.find<SST::UnitAlgebra>("network_output_buffer_size", SST::UnitAlgebra("1KiB")));

nic.nic->setNotifyOnReceive(new SimpleNetwork::Handler<Bridge, uint8_t>(this, &Bridge::handleIncoming, id));
sendNotify[id] = new SimpleNetwork::Handler<Bridge, uint8_t>(this, &Bridge::spaceAvailable, id);

Expand Down

0 comments on commit c273614

Please sign in to comment.