From 0644eb29d81fb4587ef64adb8f428b565fc6164b Mon Sep 17 00:00:00 2001 From: Nebojsa Pilipovic Date: Thu, 25 Aug 2022 17:10:41 +0200 Subject: [PATCH] Added the option to specify how often and by how much do PEs consume flits --- config_examples/256_12h.yaml | 8 ++++ config_examples/256_16h.yaml | 8 ++++ config_examples/256_16h_4channels.yaml | 8 ++++ config_examples/256_4h.yaml | 8 ++++ config_examples/256_4h_2channels.yaml | 8 ++++ config_examples/256_8h.yaml | 8 ++++ config_examples/article.yaml | 8 ++++ .../configWirelessCore2CoreBfly.yaml | 8 ++++ config_examples/default_config.yaml | 8 ++++ config_examples/default_configBaseline.yaml | 8 ++++ config_examples/default_configBfly.yaml | 8 ++++ config_examples/default_configMesh.yaml | 8 ++++ config_examples/default_configMeshNoHUB.yaml | 8 ++++ config_examples/default_configOmega.yaml | 8 ++++ config_examples/multi_channel.yaml | 8 ++++ config_examples/testdelta.yaml | 8 ++++ config_examples/testdelta_hops_1.yaml | 8 ++++ config_examples/testdelta_hops_16.yaml | 8 ++++ config_examples/testdelta_hops_2.yaml | 8 ++++ src/ConfigurationManager.cpp | 14 ++++++ src/GlobalParams.cpp | 3 ++ src/GlobalParams.h | 3 ++ src/ProcessingElement.cpp | 47 ++++++++++++++++++- src/ProcessingElement.h | 10 ++++ 24 files changed, 228 insertions(+), 1 deletion(-) diff --git a/config_examples/256_12h.yaml b/config_examples/256_12h.yaml index a53f7b0f..d8c3b278 100644 --- a/config_examples/256_12h.yaml +++ b/config_examples/256_12h.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/256_16h.yaml b/config_examples/256_16h.yaml index 36911633..65009dcc 100644 --- a/config_examples/256_16h.yaml +++ b/config_examples/256_16h.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/256_16h_4channels.yaml b/config_examples/256_16h_4channels.yaml index adad9fb6..6db62e04 100644 --- a/config_examples/256_16h_4channels.yaml +++ b/config_examples/256_16h_4channels.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/256_4h.yaml b/config_examples/256_4h.yaml index 965ce29a..206774af 100644 --- a/config_examples/256_4h.yaml +++ b/config_examples/256_4h.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/256_4h_2channels.yaml b/config_examples/256_4h_2channels.yaml index 82cabc0e..5ba31de1 100644 --- a/config_examples/256_4h_2channels.yaml +++ b/config_examples/256_4h_2channels.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/256_8h.yaml b/config_examples/256_8h.yaml index 5f15b4fb..6e839592 100644 --- a/config_examples/256_8h.yaml +++ b/config_examples/256_8h.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/article.yaml b/config_examples/article.yaml index c0b5badf..921bf125 100644 --- a/config_examples/article.yaml +++ b/config_examples/article.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 3 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/configWirelessCore2CoreBfly.yaml b/config_examples/configWirelessCore2CoreBfly.yaml index cd83df90..d3d583a3 100644 --- a/config_examples/configWirelessCore2CoreBfly.yaml +++ b/config_examples/configWirelessCore2CoreBfly.yaml @@ -23,6 +23,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # DELTA diff --git a/config_examples/default_config.yaml b/config_examples/default_config.yaml index 37b7f6e0..aa7e7ba6 100644 --- a/config_examples/default_config.yaml +++ b/config_examples/default_config.yaml @@ -25,6 +25,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # DELTA diff --git a/config_examples/default_configBaseline.yaml b/config_examples/default_configBaseline.yaml index 46eb9776..4bb37bc1 100644 --- a/config_examples/default_configBaseline.yaml +++ b/config_examples/default_configBaseline.yaml @@ -20,6 +20,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # DELTA diff --git a/config_examples/default_configBfly.yaml b/config_examples/default_configBfly.yaml index d5ba7b94..55e60c73 100644 --- a/config_examples/default_configBfly.yaml +++ b/config_examples/default_configBfly.yaml @@ -20,6 +20,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # DELTA diff --git a/config_examples/default_configMesh.yaml b/config_examples/default_configMesh.yaml index a0070aa9..48492baa 100644 --- a/config_examples/default_configMesh.yaml +++ b/config_examples/default_configMesh.yaml @@ -25,6 +25,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/default_configMeshNoHUB.yaml b/config_examples/default_configMeshNoHUB.yaml index 6d84f28a..6979347d 100644 --- a/config_examples/default_configMeshNoHUB.yaml +++ b/config_examples/default_configMeshNoHUB.yaml @@ -25,6 +25,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # DELTA diff --git a/config_examples/default_configOmega.yaml b/config_examples/default_configOmega.yaml index bc7710eb..eeff80e6 100644 --- a/config_examples/default_configOmega.yaml +++ b/config_examples/default_configOmega.yaml @@ -20,6 +20,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/multi_channel.yaml b/config_examples/multi_channel.yaml index f18df83c..d8667e06 100644 --- a/config_examples/multi_channel.yaml +++ b/config_examples/multi_channel.yaml @@ -17,6 +17,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + # Routing algorithms: # XY # WEST_FIRST diff --git a/config_examples/testdelta.yaml b/config_examples/testdelta.yaml index 3975e6c7..2772d908 100644 --- a/config_examples/testdelta.yaml +++ b/config_examples/testdelta.yaml @@ -14,6 +14,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + routing_algorithm: DELTA routing_table_filename: "" diff --git a/config_examples/testdelta_hops_1.yaml b/config_examples/testdelta_hops_1.yaml index 8bbc0989..94f1aceb 100644 --- a/config_examples/testdelta_hops_1.yaml +++ b/config_examples/testdelta_hops_1.yaml @@ -20,6 +20,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + routing_algorithm: DELTA routing_table_filename: "" diff --git a/config_examples/testdelta_hops_16.yaml b/config_examples/testdelta_hops_16.yaml index 83b46ede..8aa694d5 100644 --- a/config_examples/testdelta_hops_16.yaml +++ b/config_examples/testdelta_hops_16.yaml @@ -22,6 +22,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + routing_algorithm: DELTA routing_table_filename: "" diff --git a/config_examples/testdelta_hops_2.yaml b/config_examples/testdelta_hops_2.yaml index 512e358b..c4c2f3b9 100644 --- a/config_examples/testdelta_hops_2.yaml +++ b/config_examples/testdelta_hops_2.yaml @@ -22,6 +22,14 @@ r2h_link_length: 2.0 r2r_link_length: 1.0 n_virtual_channels: 1 +# pe input buffer size +pe_rx_buffer_size: 1 +# how often does PE process a batch of flits (eg. 4 = once +# every four cycles) +processing_frequency: 1 +# how many flits are processed in a batch +processing_size: 1 + routing_algorithm: DELTA routing_table_filename: "" diff --git a/src/ConfigurationManager.cpp b/src/ConfigurationManager.cpp index d57378db..dc808637 100644 --- a/src/ConfigurationManager.cpp +++ b/src/ConfigurationManager.cpp @@ -87,6 +87,9 @@ void loadConfiguration() { GlobalParams::detailed = readParam(config, "detailed"); GlobalParams::dyad_threshold = readParam(config, "dyad_threshold"); GlobalParams::max_volume_to_be_drained = readParam(config, "max_volume_to_be_drained"); + GlobalParams::processing_frequency = readParam(config, "processing_frequency"); + GlobalParams::pe_rx_buffer_size = readParam(config, "pe_rx_buffer_size"); + GlobalParams::processing_size = readParam(config, "processing_size"); //GlobalParams::hotspots; GlobalParams::show_buffer_stats = readParam(config, "show_buffer_stats"); GlobalParams::use_winoc = readParam(config, "use_winoc"); @@ -247,6 +250,9 @@ void showHelp(char selfname[]) << "\t\t\t\tbeen delivered" << endl << "\t-asciimonitor\t\tShow status of the network while running (experimental)" << endl << "\t-sim N\t\t\tRun for the specified simulation time [cycles]" << endl + << "\t-pe_rx_buffer_size N\t\t\tSets PE internal receive buffer size (default 1)" << endl + << "\t-processing_frequency N\t\t\tSets the frequency at which PEs consume packet(s) (default 1 - every cycle)" << endl + << "\t-processing_size N\t\t\tSets how many flits does a PE consume at a time (default 1 - one flit)" << endl << endl << "If you find this program useful please don't forget to mention in your paper Maurizio Palesi " << endl << "If you find this program useless please feel free to complain with Davide Patti " << endl @@ -486,6 +492,14 @@ void parseCmdLine(int arg_num, char *arg_vet[]) setBufferAntenna(atoi(arg_vet[++i])); else if (!strcmp(arg_vet[i], "-vc")) GlobalParams::n_virtual_channels = (atoi(arg_vet[++i])); + //-----------------------EXTRA------------------------/ + else if (!strcmp(arg_vet[i], "-pe_rx_buffer_size")) + GlobalParams::pe_rx_buffer_size = (atoi(arg_vet[++i])); + else if (!strcmp(arg_vet[i], "-processing_frequency")) + GlobalParams::processing_frequency = (atoi(arg_vet[++i])); + else if (!strcmp(arg_vet[i], "-processing_size")) + GlobalParams::processing_size = (atoi(arg_vet[++i])); + //-----------------------EXTRA------------------------/ else if (!strcmp(arg_vet[i], "-flit")) GlobalParams::flit_size = atoi(arg_vet[++i]); else if (!strcmp(arg_vet[i], "-winoc")) diff --git a/src/GlobalParams.cpp b/src/GlobalParams.cpp index 10a6c886..a6f258ce 100644 --- a/src/GlobalParams.cpp +++ b/src/GlobalParams.cpp @@ -27,6 +27,9 @@ int GlobalParams::buffer_depth; int GlobalParams::flit_size; int GlobalParams::min_packet_size; int GlobalParams::max_packet_size; +int GlobalParams::pe_rx_buffer_size; +int GlobalParams::processing_frequency; +int GlobalParams::processing_size; string GlobalParams::routing_algorithm; string GlobalParams::routing_table_filename; string GlobalParams::selection_strategy; diff --git a/src/GlobalParams.h b/src/GlobalParams.h index 174d2a39..5304e17f 100644 --- a/src/GlobalParams.h +++ b/src/GlobalParams.h @@ -152,6 +152,9 @@ struct GlobalParams { static int flit_size; static int min_packet_size; static int max_packet_size; + static int processing_frequency; + static int processing_size; + static int pe_rx_buffer_size; static string routing_algorithm; static string routing_table_filename; static string selection_strategy; diff --git a/src/ProcessingElement.cpp b/src/ProcessingElement.cpp index d4cec96e..32799ec8 100644 --- a/src/ProcessingElement.cpp +++ b/src/ProcessingElement.cpp @@ -10,6 +10,31 @@ #include "ProcessingElement.h" + +void ProcessingElement::consume(){ + + //LOG << "PE BUFFER: " << rx_buffer.size() << endl; + + if(GlobalParams::processing_frequency > 1){ // Consumes `processing_size` flits every `processing_frequency` cycles + + if((consume_counter % (GlobalParams::processing_frequency-1)) == 0){ + consume_counter = 0; + for(int i = 0; i < GlobalParams::processing_size; i++) + if (rx_buffer.size() > 0) + rx_buffer.pop(); + + } + consume_counter++; + + }else{ // Case processing_frequency = 1 (tries to consume `processing_size` flits every cycle) + + for(int i = 0; i < GlobalParams::processing_size; i++) + if (rx_buffer.size() > 0) + rx_buffer.pop(); + + } +} + int ProcessingElement::randInt(int min, int max) { return min + @@ -19,13 +44,33 @@ int ProcessingElement::randInt(int min, int max) void ProcessingElement::rxProcess() { if (reset.read()) { + TBufferFullStatus bfs; ack_rx.write(0); current_level_rx = 0; + buffer_full_status_rx.write(bfs); } else { + TBufferFullStatus bfs; if (req_rx.read() == 1 - current_level_rx) { Flit flit_tmp = flit_rx.read(); - current_level_rx = 1 - current_level_rx; // Negate the old value for Alternating Bit Protocol (ABP) + int vc = flit_tmp.vc_id; + + if(rx_buffer.size() >= GlobalParams::pe_rx_buffer_size){ // if pe buffer is full + + for (int vcn = 0; vcn < GlobalParams::n_virtual_channels; vcn++) // set bfs flag to true for all VCs (PE is the endpoint, there are no VCs) + bfs.mask[vcn] = true; + LOG << " Flit " << flit_tmp << " PE buffer full, from vc = " << vc << endl; + + }else{ + + rx_buffer.push(flit_tmp); + current_level_rx = 1 - current_level_rx; // Negate the old value for Alternating Bit Protocol (ABP) + for (int vcn = 0; vcn < GlobalParams::n_virtual_channels; vcn++) + bfs.mask[vcn] = false; + //LOG << " Flit " << flit_tmp << " PE buffer NOT full, from vc = " << vc << endl; + } + } + buffer_full_status_rx.write(bfs); ack_rx.write(current_level_rx); } } diff --git a/src/ProcessingElement.h b/src/ProcessingElement.h index e8e7a7b7..cba4fce7 100644 --- a/src/ProcessingElement.h +++ b/src/ProcessingElement.h @@ -41,9 +41,11 @@ SC_MODULE(ProcessingElement) // Registers int local_id; // Unique identification number + int consume_counter; bool current_level_rx; // Current level for Alternating Bit Protocol (ABP) bool current_level_tx; // Current level for Alternating Bit Protocol (ABP) queue < Packet > packet_queue; // Local queue of packets + queue < Flit > rx_buffer; // Used to simulate finite processing speed/buffer space bool transmittedAtPreviousCycle; // Used for distributions with memory // Functions @@ -76,6 +78,8 @@ SC_MODULE(ProcessingElement) int findRandomDestination(int local_id,int hops); unsigned int getQueueSize() const; + void consume(); + // Constructor SC_CTOR(ProcessingElement) { SC_METHOD(rxProcess); @@ -85,6 +89,12 @@ SC_MODULE(ProcessingElement) SC_METHOD(txProcess); sensitive << reset; sensitive << clock.pos(); + + SC_METHOD(consume); + sensitive << reset; + sensitive << clock.pos(); + + consume_counter = 0; } };