Changes to run higher number of tasks with retry loop

This commit is contained in:
HelenClaraGeorge 2024-11-18 22:47:28 +01:00
parent d9017eaa8e
commit f047dfbf91
9 changed files with 11855 additions and 76 deletions

View file

@ -0,0 +1,55 @@
<?xml version="1.0" ?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<general>
<simulationTime value="5000"/>
<outputToFile value="true">report</outputToFile>
</general>
<noc>
<nocFile>config/throttle_test/net.xml</nocFile>
<flitsPerPacket value="1"/>
<bitWidth value="32"/>
<Vdd value="5"/>
</noc>
<application>
<benchmark>task</benchmark>
<dataFile>config/throttle_test/data.xml</dataFile>
<mapFile>config/throttle_test/map.xml</mapFile>
</application>
<verbose>
<processingElements>
<function_calls value="false"/>
<send_flit value="false"/>
<send_head_flit value="true"/>
<receive_flit value="false"/>
<receive_tail_flit value="true"/>
<throttle value="false"/>
<reset value="false"/>
</processingElements>
<router>
<function_calls value="false"/>
<send_flit value="false"/>
<send_head_flit value="false"/>
<receive_flit value="false"/>
<receive_tail_flit value="false"/>
<throttle value="false"/>
<reset value="false"/>
<assign_channel value="false"/>
<buffer_overflow value="true"/>
</router>
<netrace>
<inject value="true"/>
<eject value="true"/>
<router_receive value="true"/>
</netrace>
<tasks>
<function_calls value="true"/>
<xml_parse value="false"/>
<data_receive value="true"/>
<data_send value="true"/>
<source_execute value="false"/>
</tasks>
</verbose>
<report>
<bufferReportRouters>5 6 9 10</bufferReportRouters>
</report>
</configuration>

View file

@ -0,0 +1,245 @@
<?xml version="1.0" ?>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dataTypes>
<dataType id="0">
<name value="Packet"/>
</dataType>
<dataType id="1">
<name value="Stream"/>
</dataType>
</dataTypes>
<tasks>
<task id="0">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="1">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="2">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="3">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="4">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="5">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="6">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="7">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="8">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="9">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="10">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="11">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="0"/>
<count max="100" min="100"/>
</requirement>
</requires>
</task>
</tasks>
</data>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" ?>
<map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bind>
<task value="0"/>
<node value="10"/>
</bind>
<bind>
<task value="1"/>
<node value="31"/>
</bind>
<bind>
<task value="2"/>
<node value="18"/>
</bind>
<bind>
<task value="3"/>
<node value="38"/>
</bind>
<bind>
<task value="4"/>
<node value="33"/>
</bind>
<bind>
<task value="5"/>
<node value="23"/>
</bind>
<bind>
<task value="6"/>
<node value="26"/>
</bind>
<bind>
<task value="7"/>
<node value="11"/>
</bind>
<bind>
<task value="8"/>
<node value="9"/>
</bind>
<bind>
<task value="9"/>
<node value="17"/>
</bind>
<bind>
<task value="10"/>
<node value="22"/>
</bind>
<bind>
<task value="11"/>
<node value="15"/>
</bind>
</map>

1136
config/throttle_test/net.xml Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,7 @@ using namespace std;
NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node) :
NetworkInterface(nm, node), lastReceivedCreditID(-1), credit_counter(0), ni_name(nm), resp_in_progress(false)
{
//change the sending tlm function name to different one for identification from receiving function
target_socket.register_nb_transport_fw(this, &NetworkInterfaceTlm::nb_transport_fw); ////from core
//sc_report_handler::set_actions(NI_LOG, SC_INFO, SC_LOG|SC_DISPLAY);
sc_report_handler::set_log_file_name("out/report.log"); //from core
@ -116,83 +117,87 @@ void NetworkInterfaceTlm::generateFlitsForPacket(Packet* p) {
}
void NetworkInterfaceTlm::send_packet_to_router() {
// if no flits to transmit, generate them
Packet* p = packet_send_queue.front();
if (p->toTransmit.empty()){
generateFlitsForPacket(p);
}
// get current flit to send
flitID_t f_id = p->toTransmit.front();
auto iter = find_if(p->flits.begin(), p->flits.end(),
[&f_id](Flit* f) { return f->id==f_id; });
Flit* current_flit = *iter;
current_flit->injectionTime = sc_time_stamp().to_double();
auto toDelete_pos = find(p->toTransmit.begin(), p->toTransmit.end(), current_flit->id);
p->toTransmit.erase(toDelete_pos);
p->inTransmit.push_back(current_flit->id);
if (p->toTransmit.empty()) {
packet_send_queue.pop();
}
my_payload* trans = nullptr;
unsigned int src_core_id = p->src.id;
int src_router_id = ((src_core_id - CORE_OFFSET) / CORE_NO);
std::cout<<"source router id is: "<< src_router_id << std::endl;
unsigned int dst_core_id = p->dst.id;
int destination_router_id = ((dst_core_id - CORE_OFFSET) /CORE_NO);
std::cout<<"destination router id is: "<< destination_router_id << std::endl;
//unsigned int source_core = source_core_id;
//unsigned int src_router_id = source_router_id;
sc_time delay = sc_time(0, SC_NS);
std::cout<<"source PE ID: "<<p->src.id<<" destination PE ID: "<<p->dst.id<<std::endl;
trans = new my_payload(src_core_id, src_router_id, dst_core_id, destination_router_id, current_flit, sc_time_stamp());
// Construct the address (calculation based on router/core IDs)
unsigned int offset = 0x20; // Offset remains the same
unsigned int address = (destination_router_id << 16) | (dst_core_id << 8) | offset;
bool retry = false;
do {
if (!retry) { //When retry is false new flits are generated from packets
Packet* p = packet_send_queue.front();
// if no flits to transmit, generate them
if (p->toTransmit.empty()){
generateFlitsForPacket(p);
}
// get current flit to send
flitID_t f_id = p->toTransmit.front();
auto iter = find_if(p->flits.begin(), p->flits.end(),
[&f_id](Flit* f) { return f->id==f_id; });
Flit* current_flit = *iter;
current_flit->injectionTime = sc_time_stamp().to_double();
trans->set_address(address);
log_info( "Network Interface " + std::to_string(src_core_id) + " of Source Router: " + std::to_string(source_router_id)
+ ": Processing packet flit with ID: " + std::to_string(trans->data->id) + " for router " + std::to_string(destination_router_id)
+ " and Network Interface " + std::to_string(dst_core_id) + " at time: " + trans->timestamp.to_string());
// Set up the rest of the transaction
trans->set_data_length(p->size);
trans->set_streaming_width(4);
trans->set_byte_enable_ptr(nullptr);
trans->set_dmi_allowed(false);
trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
tlm::tlm_phase phase = tlm::BEGIN_REQ; // Transaction phase
tlm::tlm_sync_enum status = socket->nb_transport_fw(*trans, phase, delay); // Non-blocking transport
auto toDelete_pos = find(p->toTransmit.begin(), p->toTransmit.end(), current_flit->id);
p->toTransmit.erase(toDelete_pos);
p->inTransmit.push_back(current_flit->id);
bool retry = false;
do {
if (!retry) {
if (p->toTransmit.empty()) {
packet_send_queue.pop();
}
unsigned int src_core_id = p->src.id;
int src_router_id = ((src_core_id - CORE_OFFSET) / CORE_NO);
unsigned int dst_core_id = p->dst.id;
int destination_router_id = ((dst_core_id - CORE_OFFSET) /CORE_NO);
std::cout<<"source router id is: "<< src_router_id<<"destination router id is: "<< destination_router_id << std::endl;
std::cout<<"source PE ID: "<<p->src.id<<" destination PE ID: "<<p->dst.id<<std::endl;
trans = new my_payload(src_core_id, src_router_id, dst_core_id, destination_router_id, current_flit, sc_time_stamp());
// Construct the address (calculation based on router/core IDs)
unsigned int offset = 0x20; // Offset remains the same
unsigned int address = (destination_router_id << 16) | (dst_core_id << 8) | offset;
trans->set_address(address);
log_info( "Network Interface " + std::to_string(src_core_id) + " of Source Router: " + std::to_string(source_router_id)
+ ": Processing packet flit with ID: " + std::to_string(trans->data->id) + " for router " + std::to_string(destination_router_id)
+ " and Network Interface " + std::to_string(dst_core_id) + " at time: " + trans->timestamp.to_string());
// Set up the rest of the transaction
trans->set_data_length(p->size);
trans->set_streaming_width(4);
trans->set_byte_enable_ptr(nullptr);
trans->set_dmi_allowed(false);
trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
}
tlm::tlm_phase phase = tlm::BEGIN_REQ; // Transaction phase
tlm::tlm_sync_enum status = socket->nb_transport_fw(*trans, phase, delay); // Non-blocking transport
if (status == tlm::TLM_COMPLETED || phase == tlm::END_REQ) {
if (status == tlm::TLM_COMPLETED || phase == tlm::END_REQ) {
log_info("Network Interface " + ni_name + ": Transaction successful, flit sent ID: " + std::to_string(trans->data->id) + " at time: " + sc_time_stamp().to_string());
delete trans; // Clean up the transaction
retry = false; // Move on to the next transaction
//break;
//wait(50, SC_NS);
} else if (status == tlm::TLM_ACCEPTED) {
log_info("Network Interface " + ni_name + ": Transaction accepted, waiting for completion.");
wait(0, SC_NS); // Wait for response
retry = false; // No need to retry, accepted transaction will continue
// break;
} else if (status == tlm::TLM_UPDATED && phase == tlm::BEGIN_REQ) {
log_info("Network Interface " + ni_name + ": FIFO full, retrying...");
wait(delay + sc_time(20, SC_NS)); // Add some delay before retrying
//wait(delay + sc_time(20, SC_NS)); // Add some delay before retrying
retry = true; // Retry the same transaction
wait(20, SC_NS);
}
}
} while(retry); //when retry is true, the transaction is tried again since fifo is full
}while(retry);
wait(0,SC_NS);
wait(0,SC_NS);
}

View file

@ -28,6 +28,7 @@ router::router(sc_module_name name)
sc_report_handler::set_log_file_name("out/report.log");
sc_report_handler::set_actions(LOG_NAME, SC_INFO, SC_LOG|SC_DISPLAY);
for (int i = 0; i < CORE_NO; ++i) {
//changed name to match receiving function
sockets[i].register_nb_transport_fw(this, &router::nb_transport_fw); //register the nb_transport fun to each target socket to receive data from core
}
@ -35,7 +36,7 @@ router::router(sc_module_name name)
SC_THREAD(process_router_receive_fifo); //process to send the data available in output fifo to destination core
}
// Function to handle incoming transactions
// Function to handle incoming transactions, changed function name
tlm::tlm_sync_enum router::nb_transport_fw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_time& delay) {
if (phase == tlm::BEGIN_REQ) {
if (in_fifo.num_free() == 0) {
@ -102,7 +103,12 @@ void router::process_core_fifo() {
unsigned int destination_core_id = (address >> 8) & 0xFF; // Extract core ID from address
std::cout<<"destination core id from address at source router:"<< destination_core_id<<std::endl;
//blocking write to destination router
if(sem_mgr->peek_token(current_router_id, destination_router_id)) {
log_info("Router " + std::to_string(current_router) + " : Token for destination Router: " + std::to_string(destination_router_id) + " is currently available to acquire" );
}
else {
log_info("Router " + std::to_string(current_router) + " : Token for destination Router: " + std::to_string(destination_router_id) + " is currently unavailable to acquire" );
}
// Retry mechanism
bool success = false;
while (!success) {
@ -164,7 +170,6 @@ void router::process_router_receive_fifo() {
// Extract destination core ID from the address
unsigned int address = payload->get_address();
std::cout<<"address "<<address<<std::endl;
unsigned int destination_core_id = (address >> 8) & 0xFF; // Core ID
unsigned int dest_router_id = (address >> 16) & 0xF; // Extract router ID from address
unsigned int src_router = payload->src_router;

View file

@ -35,8 +35,8 @@ using namespace sc_core; // For sc_time
// Global parameters to generalize the design
#define ROUTER_NO 8 // Number of routers
#define CORE_NO 4 // Number of cores per router
#define CORE_FIFO_CAPACITY 8 // Capacity of FIFO in router that receive data from cores
#define ROUTER_RECEIVE_FIFO_CAPACITY 4 // Capacity of FIFO in router that receive data from other routers
#define CORE_FIFO_CAPACITY 20 // Capacity of FIFO in router that receive data from cores
#define ROUTER_RECEIVE_FIFO_CAPACITY 20 // Capacity of FIFO in router that receive data from other routers
#define CORE_OFFSET 8 // To find the Router number, it is same as ROUTER_NO
#define LOG_NAME "MY_LOG"
#define NI_LOG "TLM_NI"

View file

@ -128,6 +128,14 @@ public:
}
return false;
}
bool peek_token(int router_id, int semaphore_id) {
if(semaphore_status[semaphore_id]== false)
{
return true;
}
return false;
}
private:
std::vector<int> semaphore_owners; // Tracks router ownership (-1 means no owner)