[gem5-dev] Change in gem5/gem5[develop]: x86: Implement translateFunctional.

2020-03-16 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26405 )


Change subject: x86: Implement translateFunctional.
..

x86: Implement translateFunctional.

This function is based off of vtophys in the full system case, and off
of the page table fill mechanism used in SE mode. It ignores what's
already in the TLB, and also ignores protection mechanisms.

This may need to be reworked in the future if, for instance, pages
still resident in the TLB but not in the page tables need to be
considered, but it should work at least for the time being.

Change-Id: If21701ca36a30805f4199312933a8afc91f20501
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26405
Reviewed-by: Matthew Poremba 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/arch/x86/tlb.cc
M src/arch/x86/tlb.hh
2 files changed, 36 insertions(+), 0 deletions(-)

Approvals:
  Matthew Poremba: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc
index 15c431c..740b6bc 100644
--- a/src/arch/x86/tlb.cc
+++ b/src/arch/x86/tlb.cc
@@ -469,6 +469,40 @@
 return TLB::translate(req, tc, NULL, mode, delayedResponse, false);
 }

+Fault
+TLB::translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode  
mode)

+{
+unsigned logBytes;
+const Addr vaddr = req->getVaddr();
+Addr addr = vaddr;
+Addr paddr = 0;
+if (FullSystem) {
+Fault fault = walker->startFunctional(tc, addr, logBytes, mode);
+if (fault != NoFault)
+return fault;
+paddr = insertBits(addr, logBytes, 0, vaddr);
+} else {
+Process *process = tc->getProcessPtr();
+const auto *pte = process->pTable->lookup(vaddr);
+
+if (!pte && mode != Execute) {
+// Check if we just need to grow the stack.
+if (process->fixupStackFault(vaddr)) {
+// If we did, lookup the entry for the new page.
+pte = process->pTable->lookup(vaddr);
+}
+}
+
+if (!pte)
+return std::make_shared(vaddr, true, mode, true,  
false);

+
+paddr = pte->paddr | process->pTable->pageOffset(vaddr);
+}
+DPRINTF(TLB, "Translated (functional) %#x -> %#x.\n", vaddr, paddr);
+req->setPaddr(paddr);
+return NoFault;
+}
+
 void
 TLB::translateTiming(const RequestPtr &req, ThreadContext *tc,
 Translation *translation, Mode mode)
diff --git a/src/arch/x86/tlb.hh b/src/arch/x86/tlb.hh
index e5ae567..f0a671f 100644
--- a/src/arch/x86/tlb.hh
+++ b/src/arch/x86/tlb.hh
@@ -124,6 +124,8 @@

 Fault translateAtomic(
 const RequestPtr &req, ThreadContext *tc, Mode mode) override;
+Fault translateFunctional(
+const RequestPtr &req, ThreadContext *tc, Mode mode) override;
 void translateTiming(
 const RequestPtr &req, ThreadContext *tc,
 Translation *translation, Mode mode) override;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26405
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If21701ca36a30805f4199312933a8afc91f20501
Gerrit-Change-Number: 26405
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Brandon Potter 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Matthew Poremba 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: tests: Migrated 80.dram scons-based tests to testlib framework

2020-03-16 Thread Bobby R. Bruce (Gerrit)
Bobby R. Bruce has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/25923 )


Change subject: tests: Migrated 80.dram scons-based tests to testlib  
framework

..

tests: Migrated 80.dram scons-based tests to testlib framework

"configs/dram/low_power_sweep.py" has been modified to keep the
generated "lowp_sweep.cfg" file in "configs/dram". This generated file
is now ignored by git.

Change-Id: I700d04944fee58f8a506c71fd474b84024ec4374
Jira: https://gem5.atlassian.net/browse/GEM5-109
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25923
Reviewed-by: Bobby R. Bruce 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M .gitignore
M configs/dram/low_power_sweep.py
A tests/gem5/dram-lowp/ref/simout
A tests/gem5/dram-lowp/test_dram_lowp.py
4 files changed, 70 insertions(+), 3 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/.gitignore b/.gitignore
index 977e82b..b851a23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@
 /system/arm/bootloader/arm64/boot_emm.arm64
 /system/arm/bootloader/arm64/boot_v2.arm64
 configs/example/memcheck.cfg
+configs/dram/lowp_sweep.cfg
diff --git a/configs/dram/low_power_sweep.py  
b/configs/dram/low_power_sweep.py

index e97263f..9a62393 100644
--- a/configs/dram/low_power_sweep.py
+++ b/configs/dram/low_power_sweep.py
@@ -127,8 +127,9 @@
 period = 25000

 # We specify the states in a config file input to the traffic generator.
-cfg_file_name = "configs/dram/lowp_sweep.cfg"
-cfg_file = open(cfg_file_name, 'w')
+cfg_file_name = "lowp_sweep.cfg"
+cfg_file_path = os.path.dirname(__file__) + "/" +cfg_file_name
+cfg_file = open(cfg_file_path, 'w')

 # Get the number of banks
 nbr_banks = int(system.mem_ctrls[0].banks_per_rank.value)
@@ -214,7 +215,7 @@
 cfg_file.close()

 # create a traffic generator, and point it to the file we just created
-system.tgen = TrafficGen(config_file = cfg_file_name)
+system.tgen = TrafficGen(config_file = cfg_file_path)

 # add a communication monitor
 system.monitor = CommMonitor()
diff --git a/tests/gem5/dram-lowp/ref/simout  
b/tests/gem5/dram-lowp/ref/simout

new file mode 100644
index 000..5128ab4
--- /dev/null
+++ b/tests/gem5/dram-lowp/ref/simout
@@ -0,0 +1,14 @@
+gem5 Simulator System.  http://gem5.org
+gem5 is copyrighted software; use the --copyright option for details.
+
+
+Global frequency set at 1 ticks per second
+--- Done DRAM low power sweep ---
+Fixed params -
+   burst: 64, banks: 16, max stride: 512, itt min: 3332.0 ns
+Swept params -
+   itt max multiples input: [1, 20, 100]
+   itt max values [46993.0, 939860.0, 4699300.0]
+   bank utilization values [1, 8, 16]
+   stride values: [64, 256, 512]
+Traffic gen config file: lowp_sweep.cfg
diff --git a/tests/gem5/dram-lowp/test_dram_lowp.py  
b/tests/gem5/dram-lowp/test_dram_lowp.py

new file mode 100644
index 000..7a065f0
--- /dev/null
+++ b/tests/gem5/dram-lowp/test_dram_lowp.py
@@ -0,0 +1,51 @@
+# Copyright (c) 2020 The Regents of the University of California
+# All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from testlib import *
+
+verifiers = (
+verifier.MatchStdoutNoPerf(joinpath(getcwd(), 'ref', 'simout')),
+)
+
+gem5_verify_config(
+name='test-low_power-close_adaptive',
+fixtures=(),
+verifiers=verifiers,
+ 
config=joinpath(config.base_dir, 'configs', 'dram','low_power_sweep

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Remove delete of param pointers of GarnetNetwork

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24246 )


Change subject: mem-garnet: Remove delete of param pointers of GarnetNetwork
..

mem-garnet: Remove delete of param pointers of GarnetNetwork

All over gem5 the params pointers are not deleted within the classes
that they were created for. Although this is a potential memory leak
as of now, it is probably safer to follow general convention so that
it can be fixed at once in the future.

Change-Id: I74b662a8e635cdfb4dc1eae732dd114659fab2e9
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24246
Reviewed-by: Nikos Nikoleris 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/GarnetNetwork.cc
M src/mem/ruby/network/garnet2.0/GarnetNetwork.hh
2 files changed, 1 insertion(+), 11 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/GarnetNetwork.cc  
b/src/mem/ruby/network/garnet2.0/GarnetNetwork.cc

index b4aef13..1eff921 100644
--- a/src/mem/ruby/network/garnet2.0/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet2.0/GarnetNetwork.cc
@@ -33,7 +33,6 @@
 #include 

 #include "base/cast.hh"
-#include "base/stl_helpers.hh"
 #include "mem/ruby/common/NetDest.hh"
 #include "mem/ruby/network/MessageBuffer.hh"
 #include "mem/ruby/network/garnet2.0/CommonTypes.hh"
@@ -45,7 +44,6 @@
 #include "mem/ruby/system/RubySystem.hh"

 using namespace std;
-using m5::stl_helpers::deletePointers;

 /*
  * GarnetNetwork sets up the routers and links and collects stats.
@@ -140,14 +138,6 @@
 }
 }

-GarnetNetwork::~GarnetNetwork()
-{
-deletePointers(m_routers);
-deletePointers(m_nis);
-deletePointers(m_networklinks);
-deletePointers(m_creditlinks);
-}
-
 /*
  * This function creates a link from the Network Interface (NI)
  * into the Network.
diff --git a/src/mem/ruby/network/garnet2.0/GarnetNetwork.hh  
b/src/mem/ruby/network/garnet2.0/GarnetNetwork.hh

index 68658db..9acbeef 100644
--- a/src/mem/ruby/network/garnet2.0/GarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet2.0/GarnetNetwork.hh
@@ -51,8 +51,8 @@
   public:
 typedef GarnetNetworkParams Params;
 GarnetNetwork(const Params *p);
+~GarnetNetwork() = default;

-~GarnetNetwork();
 void init();

 // Configuration (set externally)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/24246
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I74b662a8e635cdfb4dc1eae732dd114659fab2e9
Gerrit-Change-Number: 24246
Gerrit-PatchSet: 5
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in VirtualChannel

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24253 )


Change subject: mem-garnet: Use static allocation in VirtualChannel
..

mem-garnet: Use static allocation in VirtualChannel

The input buffer does not need to be dynamically allocated.

Change-Id: Ice64f40d2a7e16af325ddb6803e34b3eed2e99db
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24253
Reviewed-by: Nikos Nikoleris 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/VirtualChannel.cc
M src/mem/ruby/network/garnet2.0/VirtualChannel.hh
2 files changed, 17 insertions(+), 24 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/VirtualChannel.cc  
b/src/mem/ruby/network/garnet2.0/VirtualChannel.cc

index 2deee32..3b077d4 100644
--- a/src/mem/ruby/network/garnet2.0/VirtualChannel.cc
+++ b/src/mem/ruby/network/garnet2.0/VirtualChannel.cc
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,19 +32,9 @@
 #include "mem/ruby/network/garnet2.0/VirtualChannel.hh"

 VirtualChannel::VirtualChannel(int id)
-: m_enqueue_time(INFINITE_)
+  : m_id(id), inputBuffer(), m_vc_state(IDLE_, Cycles(0)),  
m_output_port(-1),

+m_enqueue_time(INFINITE_), m_output_vc(-1)
 {
-m_id = id;
-m_input_buffer = new flitBuffer();
-m_vc_state.first = IDLE_;
-m_vc_state.second = Cycles(0);
-m_output_vc = -1;
-m_output_port = -1;
-}
-
-VirtualChannel::~VirtualChannel()
-{
-delete m_input_buffer;
 }

 void
@@ -67,9 +58,9 @@
 bool
 VirtualChannel::need_stage(flit_stage stage, Cycles time)
 {
-if (m_input_buffer->isReady(time)) {
+if (inputBuffer.isReady(time)) {
 assert(m_vc_state.first == ACTIVE_ && m_vc_state.second <= time);
-flit *t_flit = m_input_buffer->peekTopFlit();
+flit *t_flit = inputBuffer.peekTopFlit();
 return(t_flit->is_stage(stage, time));
 }
 return false;
@@ -78,5 +69,5 @@
 uint32_t
 VirtualChannel::functionalWrite(Packet *pkt)
 {
-return m_input_buffer->functionalWrite(pkt);
+return inputBuffer.functionalWrite(pkt);
 }
diff --git a/src/mem/ruby/network/garnet2.0/VirtualChannel.hh  
b/src/mem/ruby/network/garnet2.0/VirtualChannel.hh

index 1deac61..52963c8 100644
--- a/src/mem/ruby/network/garnet2.0/VirtualChannel.hh
+++ b/src/mem/ruby/network/garnet2.0/VirtualChannel.hh
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,7 +41,7 @@
 {
   public:
 VirtualChannel(int id);
-~VirtualChannel();
+~VirtualChannel() = default;

 bool need_stage(flit_stage stage, Cycles time);
 void set_idle(Cycles curTime);
@@ -54,15 +55,16 @@
 inline void set_enqueue_time(Cycles time) { m_enqueue_time = time; }
 inline VC_state_type get_state(){ return m_vc_state.first; }

-inline bool isReady(Cycles curTime)
+inline bool
+isReady(Cycles curTime)
 {
-return m_input_buffer->isReady(curTime);
+return inputBuffer.isReady(curTime);
 }

 inline void
 insertFlit(flit *t_flit)
 {
-m_input_buffer->insert(t_flit);
+inputBuffer.insert(t_flit);
 }

 inline void
@@ -75,20 +77,20 @@
 inline flit*
 peekTopFlit()
 {
-return m_input_buffer->peekTopFlit();
+return inputBuffer.peekTopFlit();
 }

 inline flit*
 getTopFlit()
 {
-return m_input_buffer->getTopFlit();
+return inputBuffer.getTopFlit();
 }

 uint32_t functionalWrite(Packet *pkt);

   private:
 int m_id;
-flitBuffer *m_input_buffer;
+flitBuffer inputBuffer;
 std::pair m_vc_state;
 int m_output_port;
 Cycles m_enqueue_time;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/24253
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ice64f40d2a7e16af325ddb6803e34b3eed2e99db
Gerrit-Change-Number: 24253
Gerrit-PatchSet: 5
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/g

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in NetworkInterface

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24247 )


Change subject: mem-garnet: Use static allocation in NetworkInterface
..

mem-garnet: Use static allocation in NetworkInterface

Use static allocation for the pointers managed by NetworkInterface.

Change-Id: Ib97d95165337659f92cb8a078020692baae5b5ca
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24247
Reviewed-by: Nikos Nikoleris 
Reviewed-by: Srikant Bharadwaj 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/NetworkInterface.cc
M src/mem/ruby/network/garnet2.0/NetworkInterface.hh
2 files changed, 48 insertions(+), 61 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  Srikant Bharadwaj: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/NetworkInterface.cc  
b/src/mem/ruby/network/garnet2.0/NetworkInterface.cc

index f7bade5..f4d446d 100644
--- a/src/mem/ruby/network/garnet2.0/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet2.0/NetworkInterface.cc
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,7 +35,6 @@
 #include 

 #include "base/cast.hh"
-#include "base/stl_helpers.hh"
 #include "debug/RubyNetwork.hh"
 #include "mem/ruby/network/MessageBuffer.hh"
 #include "mem/ruby/network/garnet2.0/Credit.hh"
@@ -42,30 +42,22 @@
 #include "mem/ruby/slicc_interface/Message.hh"

 using namespace std;
-using m5::stl_helpers::deletePointers;

 NetworkInterface::NetworkInterface(const Params *p)
-: ClockedObject(p), Consumer(this), m_id(p->id),
-  m_virtual_networks(p->virt_nets), m_vc_per_vnet(p->vcs_per_vnet),
-  m_num_vcs(m_vc_per_vnet * m_virtual_networks),
-  m_deadlock_threshold(p->garnet_deadlock_threshold),
-  vc_busy_counter(m_virtual_networks, 0)
+  : ClockedObject(p), Consumer(this), m_id(p->id),
+m_virtual_networks(p->virt_nets), m_vc_per_vnet(p->vcs_per_vnet),
+m_router_id(-1), m_vc_allocator(m_virtual_networks, 0),
+m_vc_round_robin(0), outFlitQueue(), outCreditQueue(),
+m_deadlock_threshold(p->garnet_deadlock_threshold),
+vc_busy_counter(m_virtual_networks, 0)
 {
-m_router_id = -1;
-m_vc_round_robin = 0;
-m_ni_out_vcs.resize(m_num_vcs);
-m_ni_out_vcs_enqueue_time.resize(m_num_vcs);
-outCreditQueue = new flitBuffer();
+const int num_vcs = m_vc_per_vnet * m_virtual_networks;
+niOutVcs.resize(num_vcs);
+m_ni_out_vcs_enqueue_time.resize(num_vcs);

 // instantiating the NI flit buffers
-for (int i = 0; i < m_num_vcs; i++) {
-m_ni_out_vcs[i] = new flitBuffer();
-m_ni_out_vcs_enqueue_time[i] = Cycles(INFINITE_);
-}
-
-m_vc_allocator.resize(m_virtual_networks); // 1 allocator per vnet
-for (int i = 0; i < m_virtual_networks; i++) {
-m_vc_allocator[i] = 0;
+for (auto& time : m_ni_out_vcs_enqueue_time) {
+time = Cycles(INFINITE_);
 }

 m_stall_count.resize(m_virtual_networks);
@@ -74,19 +66,13 @@
 void
 NetworkInterface::init()
 {
-for (int i = 0; i < m_num_vcs; i++) {
-m_out_vc_state.push_back(new OutVcState(i, m_net_ptr));
+const int num_vcs = m_vc_per_vnet * m_virtual_networks;
+outVcState.reserve(num_vcs);
+for (int i = 0; i < num_vcs; i++) {
+outVcState.emplace_back(i, m_net_ptr);
 }
 }

-NetworkInterface::~NetworkInterface()
-{
-deletePointers(m_out_vc_state);
-deletePointers(m_ni_out_vcs);
-delete outCreditQueue;
-delete outFlitQueue;
-}
-
 void
 NetworkInterface::addInPort(NetworkLink *in_link,
   CreditLink *credit_link)
@@ -94,7 +80,7 @@
 inNetLink = in_link;
 in_link->setLinkConsumer(this);
 outCreditLink = credit_link;
-credit_link->setSourceQueue(outCreditQueue);
+credit_link->setSourceQueue(&outCreditQueue);
 }

 void
@@ -106,8 +92,7 @@
 credit_link->setLinkConsumer(this);

 outNetLink = out_link;
-outFlitQueue = new flitBuffer();
-out_link->setSourceQueue(outFlitQueue);
+out_link->setSourceQueue(&outFlitQueue);

 m_router_id = router_id;
 }
@@ -250,9 +235,9 @@

 if (inCreditLink->isReady(curCycle())) {
 Credit *t_credit = (Credit*) inCreditLink->consumeLink();
-m_out_vc_state[t_credit->get_vc()]->increment_credit();
+outVcState[t_credit->get_vc()].increment_credit();
 if (t_credit->is_free_signal()) {
-m_out_vc_state[t_credit->get_vc()]->setState(IDLE_,  
curCycle());

+outVcState[t_credit->get_vc()].setState(IDLE_, curCycle());
 }
 delete t_credit;
 }
@@

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in OutputUnit

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24243 )


Change subject: mem-garnet: Use static allocation in OutputUnit
..

mem-garnet: Use static allocation in OutputUnit

Use static allocation for the pointers created by OutputUnit.

Change-Id: Ica4fd5d4994078764769702311520c9daf8dba72
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24243
Reviewed-by: Nikos Nikoleris 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/OutputUnit.cc
M src/mem/ruby/network/garnet2.0/OutputUnit.hh
2 files changed, 38 insertions(+), 46 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/OutputUnit.cc  
b/src/mem/ruby/network/garnet2.0/OutputUnit.cc

index bdb9f9a..2270fea 100644
--- a/src/mem/ruby/network/garnet2.0/OutputUnit.cc
+++ b/src/mem/ruby/network/garnet2.0/OutputUnit.cc
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,35 +31,23 @@

 #include "mem/ruby/network/garnet2.0/OutputUnit.hh"

-#include "base/stl_helpers.hh"
 #include "debug/RubyNetwork.hh"
 #include "mem/ruby/network/garnet2.0/Credit.hh"
+#include "mem/ruby/network/garnet2.0/CreditLink.hh"
 #include "mem/ruby/network/garnet2.0/Router.hh"
-
-using namespace std;
-using m5::stl_helpers::deletePointers;
+#include "mem/ruby/network/garnet2.0/flitBuffer.hh"

 OutputUnit::OutputUnit(int id, PortDirection direction, Router *router)
-: Consumer(router)
+  : Consumer(router), m_router(router), m_id(id), m_direction(direction),
+m_vc_per_vnet(m_router->get_vc_per_vnet())
 {
-m_id = id;
-m_direction = direction;
-m_router = router;
-m_num_vcs = m_router->get_num_vcs();
-m_vc_per_vnet = m_router->get_vc_per_vnet();
-m_out_buffer = new flitBuffer();
-
+const int m_num_vcs = m_router->get_num_vcs();
+outVcState.reserve(m_num_vcs);
 for (int i = 0; i < m_num_vcs; i++) {
-m_outvc_state.push_back(new OutVcState(i,  
m_router->get_net_ptr()));

+outVcState.emplace_back(i, m_router->get_net_ptr());
 }
 }

-OutputUnit::~OutputUnit()
-{
-delete m_out_buffer;
-deletePointers(m_outvc_state);
-}
-
 void
 OutputUnit::decrement_credit(int out_vc)
 {
@@ -66,7 +55,7 @@
 "outvc %d at time: %lld\n",
 m_router->get_id(), m_id, out_vc, m_router->curCycle());

-m_outvc_state[out_vc]->decrement_credit();
+outVcState[out_vc].decrement_credit();
 }

 void
@@ -76,7 +65,7 @@
 "outvc %d at time: %lld\n",
 m_router->get_id(), m_id, out_vc, m_router->curCycle());

-m_outvc_state[out_vc]->increment_credit();
+outVcState[out_vc].increment_credit();
 }

 // Check if the output VC (i.e., input VC at next router)
@@ -85,8 +74,8 @@
 bool
 OutputUnit::has_credit(int out_vc)
 {
-assert(m_outvc_state[out_vc]->isInState(ACTIVE_,  
m_router->curCycle()));

-return m_outvc_state[out_vc]->has_credit();
+assert(outVcState[out_vc].isInState(ACTIVE_, m_router->curCycle()));
+return outVcState[out_vc].has_credit();
 }


@@ -110,7 +99,7 @@
 int vc_base = vnet*m_vc_per_vnet;
 for (int vc = vc_base; vc < vc_base + m_vc_per_vnet; vc++) {
 if (is_vc_idle(vc, m_router->curCycle())) {
-m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle());
+outVcState[vc].setState(ACTIVE_, m_router->curCycle());
 return vc;
 }
 }
@@ -143,7 +132,7 @@
 flitBuffer*
 OutputUnit::getOutQueue()
 {
-return m_out_buffer;
+return &outBuffer;
 }

 void
@@ -158,8 +147,15 @@
 m_credit_link = credit_link;
 }

+void
+OutputUnit::insert_flit(flit *t_flit)
+{
+outBuffer.insert(t_flit);
+m_out_link->scheduleEventAbsolute(m_router->clockEdge(Cycles(1)));
+}
+
 uint32_t
 OutputUnit::functionalWrite(Packet *pkt)
 {
-return m_out_buffer->functionalWrite(pkt);
+return outBuffer.functionalWrite(pkt);
 }
diff --git a/src/mem/ruby/network/garnet2.0/OutputUnit.hh  
b/src/mem/ruby/network/garnet2.0/OutputUnit.hh

index a10539c..c720888 100644
--- a/src/mem/ruby/network/garnet2.0/OutputUnit.hh
+++ b/src/mem/ruby/network/garnet2.0/OutputUnit.hh
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,17 +37,17 @@

 #include "mem/ruby/common/Consumer.hh"
 #include "mem/ruby/network/garnet2.0/CommonTypes.hh"
-#include

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in InputUnit

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24245 )


Change subject: mem-garnet: Use static allocation in InputUnit
..

mem-garnet: Use static allocation in InputUnit

Use static allocation for the pointers managed by InputUnit.

Change-Id: I3eab42c6c08b1a519b9b55de26e820bad2ef03c4
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24245
Reviewed-by: Nikos Nikoleris 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/InputUnit.cc
M src/mem/ruby/network/garnet2.0/InputUnit.hh
2 files changed, 31 insertions(+), 44 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/InputUnit.cc  
b/src/mem/ruby/network/garnet2.0/InputUnit.cc

index ae381b9..8fdce06 100644
--- a/src/mem/ruby/network/garnet2.0/InputUnit.cc
+++ b/src/mem/ruby/network/garnet2.0/InputUnit.cc
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,23 +31,17 @@

 #include "mem/ruby/network/garnet2.0/InputUnit.hh"

-#include "base/stl_helpers.hh"
 #include "debug/RubyNetwork.hh"
 #include "mem/ruby/network/garnet2.0/Credit.hh"
 #include "mem/ruby/network/garnet2.0/Router.hh"

 using namespace std;
-using m5::stl_helpers::deletePointers;

 InputUnit::InputUnit(int id, PortDirection direction, Router *router)
-: Consumer(router)
+  : Consumer(router), m_router(router), m_id(id), m_direction(direction),
+m_vc_per_vnet(m_router->get_vc_per_vnet())
 {
-m_id = id;
-m_direction = direction;
-m_router = router;
-m_num_vcs = m_router->get_num_vcs();
-m_vc_per_vnet = m_router->get_vc_per_vnet();
-
+const int m_num_vcs = m_router->get_num_vcs();
 m_num_buffer_reads.resize(m_num_vcs/m_vc_per_vnet);
 m_num_buffer_writes.resize(m_num_vcs/m_vc_per_vnet);
 for (int i = 0; i < m_num_buffer_reads.size(); i++) {
@@ -54,20 +49,13 @@
 m_num_buffer_writes[i] = 0;
 }

-creditQueue = new flitBuffer();
 // Instantiating the virtual channels
-m_vcs.resize(m_num_vcs);
+virtualChannels.reserve(m_num_vcs);
 for (int i=0; i < m_num_vcs; i++) {
-m_vcs[i] = new VirtualChannel(i);
+virtualChannels.emplace_back(i);
 }
 }

-InputUnit::~InputUnit()
-{
-delete creditQueue;
-deletePointers(m_vcs);
-}
-
 /*
  * The InputUnit wakeup function reads the input flit from its input link.
  * Each flit arrives with an input VC.
@@ -91,7 +79,7 @@
 if ((t_flit->get_type() == HEAD_) ||
 (t_flit->get_type() == HEAD_TAIL_)) {

-assert(m_vcs[vc]->get_state() == IDLE_);
+assert(virtualChannels[vc].get_state() == IDLE_);
 set_vc_active(vc, m_router->curCycle());

 // Route computation for this vc
@@ -104,12 +92,12 @@
 grant_outport(vc, outport);

 } else {
-assert(m_vcs[vc]->get_state() == ACTIVE_);
+assert(virtualChannels[vc].get_state() == ACTIVE_);
 }


 // Buffer the flit
-m_vcs[vc]->insertFlit(t_flit);
+virtualChannels[vc].insertFlit(t_flit);

 int vnet = vc/m_vc_per_vnet;
 // number of writes same as reads
@@ -142,7 +130,7 @@
 InputUnit::increment_credit(int in_vc, bool free_signal, Cycles curTime)
 {
 Credit *t_credit = new Credit(in_vc, free_signal, curTime);
-creditQueue->insert(t_credit);
+creditQueue.insert(t_credit);
 m_credit_link->scheduleEventAbsolute(m_router->clockEdge(Cycles(1)));
 }

@@ -151,8 +139,8 @@
 InputUnit::functionalWrite(Packet *pkt)
 {
 uint32_t num_functional_writes = 0;
-for (int i=0; i < m_num_vcs; i++) {
-num_functional_writes += m_vcs[i]->functionalWrite(pkt);
+for (auto& virtual_channel : virtualChannels) {
+num_functional_writes += virtual_channel.functionalWrite(pkt);
 }

 return num_functional_writes;
diff --git a/src/mem/ruby/network/garnet2.0/InputUnit.hh  
b/src/mem/ruby/network/garnet2.0/InputUnit.hh

index 9e53a77..d0e2ef6 100644
--- a/src/mem/ruby/network/garnet2.0/InputUnit.hh
+++ b/src/mem/ruby/network/garnet2.0/InputUnit.hh
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,7 +47,7 @@
 {
   public:
 InputUnit(int id, PortDirection direction, Router *router);
-~InputUnit();
+~InputUnit() = default;

 void wakeup();
  

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in CrossbarSwitch

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24983 )


Change subject: mem-garnet: Use static allocation in CrossbarSwitch
..

mem-garnet: Use static allocation in CrossbarSwitch

There is no need to dynamically allocate these variables.

Change-Id: I6efeaffe75f2b4ba706c26d2a12c42c07dc7c7ee
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24983
Reviewed-by: Srikant Bharadwaj 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
M src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
2 files changed, 18 insertions(+), 23 deletions(-)

Approvals:
  Srikant Bharadwaj: Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc  
b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc

index dba3474..eda9e9e 100644
--- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
+++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
@@ -36,21 +36,15 @@
 #include "mem/ruby/network/garnet2.0/Router.hh"

 CrossbarSwitch::CrossbarSwitch(Router *router)
-: Consumer(router)
+  : Consumer(router), m_router(router), m_num_vcs(m_router->get_num_vcs()),
+m_crossbar_activity(0), switchBuffers(0)
 {
-m_router = router;
-m_num_vcs = m_router->get_num_vcs();
-m_crossbar_activity = 0;
 }

 void
 CrossbarSwitch::init()
 {
-m_num_inports = m_router->get_num_inports();
-m_switch_buffer.resize(m_num_inports);
-for (int i = 0; i < m_num_inports; i++) {
-m_switch_buffer[i].reset(new flitBuffer());
-}
+switchBuffers.resize(m_router->get_num_inports());
 }

 /*
@@ -66,11 +60,12 @@
 "at time: %lld\n",
 m_router->get_id(), m_router->curCycle());

-for (int inport = 0; inport < m_num_inports; inport++) {
-if (!m_switch_buffer[inport]->isReady(m_router->curCycle()))
+for (auto& switch_buffer : switchBuffers) {
+if (!switch_buffer.isReady(m_router->curCycle())) {
 continue;
+}

-flit *t_flit = m_switch_buffer[inport]->peekTopFlit();
+flit *t_flit = switch_buffer.peekTopFlit();
 if (t_flit->is_stage(ST_, m_router->curCycle())) {
 int outport = t_flit->get_outport();

@@ -81,7 +76,7 @@
 // This will take care of waking up the Network Link
 // in the next cycle
 m_router->getOutputUnit(outport)->insert_flit(t_flit);
-m_switch_buffer[inport]->getTopFlit();
+switch_buffer.getTopFlit();
 m_crossbar_activity++;
 }
 }
@@ -92,8 +87,8 @@
 {
uint32_t num_functional_writes = 0;

-   for (uint32_t i = 0; i < m_switch_buffer.size(); ++i) {
-   num_functional_writes += m_switch_buffer[i]->functionalWrite(pkt);
+   for (auto& switch_buffer : switchBuffers) {
+   num_functional_writes += switch_buffer.functionalWrite(pkt);
}

return num_functional_writes;
diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh  
b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh

index 95418d8..7dee784 100644
--- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
+++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
@@ -33,7 +33,6 @@
 #define __MEM_RUBY_NETWORK_GARNET2_0_CROSSBARSWITCH_HH__

 #include 
-#include 
 #include 

 #include "mem/ruby/common/Consumer.hh"
@@ -41,7 +40,6 @@
 #include "mem/ruby/network/garnet2.0/flitBuffer.hh"

 class Router;
-class OutputUnit;

 class CrossbarSwitch : public Consumer
 {
@@ -52,8 +50,11 @@
 void init();
 void print(std::ostream& out) const {};

-inline void update_sw_winner(int inport, flit *t_flit)
-{ m_switch_buffer[inport]->insert(t_flit); }
+inline void
+update_sw_winner(int inport, flit *t_flit)
+{
+switchBuffers[inport].insert(t_flit);
+}

 inline double get_crossbar_activity() { return m_crossbar_activity; }

@@ -61,11 +62,10 @@
 void resetStats();

   private:
-int m_num_vcs;
-int m_num_inports;
-double m_crossbar_activity;
 Router *m_router;
-std::vector> m_switch_buffer;
+int m_num_vcs;
+double m_crossbar_activity;
+std::vector switchBuffers;
 };

 #endif // __MEM_RUBY_NETWORK_GARNET2_0_CROSSBARSWITCH_HH__

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/24983
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I6efeaffe75f2b4ba706c26d2a12c42c07dc7c7ee
Gerrit-Change-Number: 24983
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: Srikant Bharadwaj 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use smart pointers in Router's members

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24248 )


Change subject: mem-garnet: Use smart pointers in Router's members
..

mem-garnet: Use smart pointers in Router's members

Use smart pointers for the pointers managed by Router, and do
static allocation when possible.

Change-Id: I5fad8b2d17ac7950d478d37000ac80a4d2f68b15
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24248
Reviewed-by: Bobby R. Bruce 
Reviewed-by: Srikant Bharadwaj 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
M src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
M src/mem/ruby/network/garnet2.0/Router.cc
M src/mem/ruby/network/garnet2.0/Router.hh
M src/mem/ruby/network/garnet2.0/SwitchAllocator.cc
M src/mem/ruby/network/garnet2.0/SwitchAllocator.hh
6 files changed, 86 insertions(+), 94 deletions(-)

Approvals:
  Srikant Bharadwaj: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc  
b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc

index bfebe65..dba3474 100644
--- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
+++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
@@ -46,8 +46,6 @@
 void
 CrossbarSwitch::init()
 {
-m_output_unit = m_router->get_outputUnit_ref();
-
 m_num_inports = m_router->get_num_inports();
 m_switch_buffer.resize(m_num_inports);
 for (int i = 0; i < m_num_inports; i++) {
@@ -82,7 +80,7 @@

 // This will take care of waking up the Network Link
 // in the next cycle
-m_output_unit[outport]->insert_flit(t_flit);
+m_router->getOutputUnit(outport)->insert_flit(t_flit);
 m_switch_buffer[inport]->getTopFlit();
 m_crossbar_activity++;
 }
diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh  
b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh

index 3464f4e..95418d8 100644
--- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
+++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
@@ -66,7 +66,6 @@
 double m_crossbar_activity;
 Router *m_router;
 std::vector> m_switch_buffer;
-std::vector m_output_unit;
 };

 #endif // __MEM_RUBY_NETWORK_GARNET2_0_CROSSBARSWITCH_HH__
diff --git a/src/mem/ruby/network/garnet2.0/Router.cc  
b/src/mem/ruby/network/garnet2.0/Router.cc

index d8e8fe5..14c0e84 100644
--- a/src/mem/ruby/network/garnet2.0/Router.cc
+++ b/src/mem/ruby/network/garnet2.0/Router.cc
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,52 +31,32 @@

 #include "mem/ruby/network/garnet2.0/Router.hh"

-#include "base/stl_helpers.hh"
 #include "debug/RubyNetwork.hh"
 #include "mem/ruby/network/garnet2.0/CreditLink.hh"
-#include "mem/ruby/network/garnet2.0/CrossbarSwitch.hh"
 #include "mem/ruby/network/garnet2.0/GarnetNetwork.hh"
 #include "mem/ruby/network/garnet2.0/InputUnit.hh"
 #include "mem/ruby/network/garnet2.0/NetworkLink.hh"
 #include "mem/ruby/network/garnet2.0/OutputUnit.hh"
-#include "mem/ruby/network/garnet2.0/RoutingUnit.hh"
-#include "mem/ruby/network/garnet2.0/SwitchAllocator.hh"

 using namespace std;
-using m5::stl_helpers::deletePointers;

 Router::Router(const Params *p)
-: BasicRouter(p), Consumer(this)
+  : BasicRouter(p), Consumer(this), m_latency(p->latency),
+m_virtual_networks(p->virt_nets), m_vc_per_vnet(p->vcs_per_vnet),
+m_num_vcs(m_virtual_networks * m_vc_per_vnet), m_network_ptr(nullptr),
+routingUnit(this), switchAllocator(this), crossbarSwitch(this)
 {
-m_latency = p->latency;
-m_virtual_networks = p->virt_nets;
-m_vc_per_vnet = p->vcs_per_vnet;
-m_num_vcs = m_virtual_networks * m_vc_per_vnet;
-
-m_routing_unit = new RoutingUnit(this);
-m_sw_alloc = new SwitchAllocator(this);
-m_switch = new CrossbarSwitch(this);
-
 m_input_unit.clear();
 m_output_unit.clear();
 }

-Router::~Router()
-{
-deletePointers(m_input_unit);
-deletePointers(m_output_unit);
-delete m_routing_unit;
-delete m_sw_alloc;
-delete m_switch;
-}
-
 void
 Router::init()
 {
 BasicRouter::init();

-m_sw_alloc->init();
-m_switch->init();
+switchAllocator.init();
+crossbarSwitch.init();
 }

 void
@@ -99,10 +80,10 @@
 }

 // Switch Allocation
-m_sw_alloc->wakeup();
+switchAllocator.wakeup();

 // Switch Traversal
-m_switch->wakeup();
+crossbarSwitch.wakeup();
 }

 void
@@ -117,9 +98,9 @@
 in_link->setLinkConsumer(this);
 credit_link->setSourceQueue(input_unit->getCreditQueue(

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in NetworkLink

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24252 )


Change subject: mem-garnet: Use static allocation in NetworkLink
..

mem-garnet: Use static allocation in NetworkLink

Use static allocation to manage NetworkLink's pointers.

Change-Id: I3ab22b1f912f0119448f9013fd0dfff9bf5a6999
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24252
Reviewed-by: Srikant Bharadwaj 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/garnet2.0/NetworkLink.cc
M src/mem/ruby/network/garnet2.0/NetworkLink.hh
2 files changed, 16 insertions(+), 19 deletions(-)

Approvals:
  Srikant Bharadwaj: Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/garnet2.0/NetworkLink.cc  
b/src/mem/ruby/network/garnet2.0/NetworkLink.cc

index c8460d2..d4bccd8 100644
--- a/src/mem/ruby/network/garnet2.0/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet2.0/NetworkLink.cc
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,17 +37,12 @@
 : ClockedObject(p), Consumer(this), m_id(p->link_id),
   m_type(NUM_LINK_TYPES_),
   m_latency(p->link_latency),
-  linkBuffer(new flitBuffer()), link_consumer(nullptr),
+  linkBuffer(), link_consumer(nullptr),
   link_srcQueue(nullptr), m_link_utilized(0),
   m_vc_load(p->vcs_per_vnet * p->virt_nets)
 {
 }

-NetworkLink::~NetworkLink()
-{
-delete linkBuffer;
-}
-
 void
 NetworkLink::setLinkConsumer(Consumer *consumer)
 {
@@ -54,18 +50,19 @@
 }

 void
-NetworkLink::setSourceQueue(flitBuffer *srcQueue)
+NetworkLink::setSourceQueue(flitBuffer* src_queue)
 {
-link_srcQueue = srcQueue;
+link_srcQueue = src_queue;
 }

 void
 NetworkLink::wakeup()
 {
+assert(link_srcQueue != nullptr);
 if (link_srcQueue->isReady(curCycle())) {
 flit *t_flit = link_srcQueue->getTopFlit();
 t_flit->set_time(curCycle() + m_latency);
-linkBuffer->insert(t_flit);
+linkBuffer.insert(t_flit);
 link_consumer->scheduleEventAbsolute(clockEdge(m_latency));
 m_link_utilized++;
 m_vc_load[t_flit->get_vc()]++;
@@ -97,5 +94,5 @@
 uint32_t
 NetworkLink::functionalWrite(Packet *pkt)
 {
-return linkBuffer->functionalWrite(pkt);
+return linkBuffer.functionalWrite(pkt);
 }
diff --git a/src/mem/ruby/network/garnet2.0/NetworkLink.hh  
b/src/mem/ruby/network/garnet2.0/NetworkLink.hh

index 23d15d9..bc3d73a 100644
--- a/src/mem/ruby/network/garnet2.0/NetworkLink.hh
+++ b/src/mem/ruby/network/garnet2.0/NetworkLink.hh
@@ -1,6 +1,7 @@
 /*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
  * Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,10 +48,10 @@
   public:
 typedef NetworkLinkParams Params;
 NetworkLink(const Params *p);
-~NetworkLink();
+~NetworkLink() = default;

 void setLinkConsumer(Consumer *consumer);
-void setSourceQueue(flitBuffer *srcQueue);
+void setSourceQueue(flitBuffer *src_queue);
 void setType(link_type type) { m_type = type; }
 link_type getType() { return m_type; }
 void print(std::ostream& out) const {}
@@ -60,11 +61,10 @@
 unsigned int getLinkUtilization() const { return m_link_utilized; }
 const std::vector & getVcLoad() const { return  
m_vc_load; }


-inline bool isReady(Cycles curTime)
-{ return linkBuffer->isReady(curTime); }
+inline bool isReady(Cycles curTime) { return  
linkBuffer.isReady(curTime); }


-inline flit* peekLink()   { return linkBuffer->peekTopFlit(); }
-inline flit* consumeLink(){ return linkBuffer->getTopFlit(); }
+inline flit* peekLink() { return linkBuffer.peekTopFlit(); }
+inline flit* consumeLink() { return linkBuffer.getTopFlit(); }

 uint32_t functionalWrite(Packet *);
 void resetStats();
@@ -74,7 +74,7 @@
 link_type m_type;
 const Cycles m_latency;

-flitBuffer *linkBuffer;
+flitBuffer linkBuffer;
 Consumer *link_consumer;
 flitBuffer *link_srcQueue;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/24252
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3ab22b1f912f0119448f9013fd0dfff9bf5a6999
Gerrit-Change-Number: 24252
Gerrit-PatchSet: 5
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Revi

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Remove delete of param pointers of SimpleNetwork

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24249 )


Change subject: mem-garnet: Remove delete of param pointers of SimpleNetwork
..

mem-garnet: Remove delete of param pointers of SimpleNetwork

All over gem5 the params pointers are not deleted within the classes
that they were created for. Although this is a potential memory leak
as of now, it is probably safer to follow general convention so that
it can be fixed at once in the future.

Change-Id: If96f04058d51513fa8763610880e5524785ee9cf
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24249
Reviewed-by: Nikos Nikoleris 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/mem/ruby/network/simple/SimpleNetwork.cc
M src/mem/ruby/network/simple/SimpleNetwork.hh
2 files changed, 1 insertion(+), 9 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc  
b/src/mem/ruby/network/simple/SimpleNetwork.cc

index 56f948f..51d4dae 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc
@@ -32,7 +32,6 @@
 #include 

 #include "base/cast.hh"
-#include "base/stl_helpers.hh"
 #include "mem/ruby/common/NetDest.hh"
 #include "mem/ruby/network/MessageBuffer.hh"
 #include "mem/ruby/network/simple/SimpleLink.hh"
@@ -41,7 +40,6 @@
 #include "mem/ruby/profiler/Profiler.hh"

 using namespace std;
-using m5::stl_helpers::deletePointers;

 SimpleNetwork::SimpleNetwork(const Params *p)
 : Network(p), m_buffer_size(p->buffer_size),
@@ -71,12 +69,6 @@
 m_topology_ptr->createLinks(this);
 }

-SimpleNetwork::~SimpleNetwork()
-{
-deletePointers(m_switches);
-deletePointers(m_int_link_buffers);
-}
-
 // From a switch to an endpoint node
 void
 SimpleNetwork::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.hh  
b/src/mem/ruby/network/simple/SimpleNetwork.hh

index 8b870e7..b2e5080 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.hh
+++ b/src/mem/ruby/network/simple/SimpleNetwork.hh
@@ -45,7 +45,7 @@
   public:
 typedef SimpleNetworkParams Params;
 SimpleNetwork(const Params *p);
-~SimpleNetwork();
+~SimpleNetwork() = default;

 void init();


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/24249
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If96f04058d51513fa8763610880e5524785ee9cf
Gerrit-Change-Number: 24249
Gerrit-PatchSet: 5
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: mem-garnet: Use static allocation in Switch

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/24250 )


Change subject: mem-garnet: Use static allocation in Switch
..

mem-garnet: Use static allocation in Switch

Make pointers non pointers when possible.

Change-Id: I272387c2ac1fd77deef06feb637127e232910e30
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24250
Reviewed-by: Nikos Nikoleris 
Maintainer: Nikos Nikoleris 
Tested-by: kokoro 
---
M src/mem/ruby/network/simple/Switch.cc
M src/mem/ruby/network/simple/Switch.hh
2 files changed, 39 insertions(+), 58 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/simple/Switch.cc  
b/src/mem/ruby/network/simple/Switch.cc

index 7cc635d..71b6636 100644
--- a/src/mem/ruby/network/simple/Switch.cc
+++ b/src/mem/ruby/network/simple/Switch.cc
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2020 Inria
  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
  * All rights reserved.
  *
@@ -33,43 +34,32 @@
 #include "base/cast.hh"
 #include "base/stl_helpers.hh"
 #include "mem/ruby/network/MessageBuffer.hh"
-#include "mem/ruby/network/simple/PerfectSwitch.hh"
 #include "mem/ruby/network/simple/SimpleNetwork.hh"
-#include "mem/ruby/network/simple/Throttle.hh"

 using namespace std;
-using m5::stl_helpers::deletePointers;
 using m5::stl_helpers::operator<<;

-Switch::Switch(const Params *p) : BasicRouter(p)
+Switch::Switch(const Params *p)
+  : BasicRouter(p), perfectSwitch(m_id, this, p->virt_nets),
+m_num_connected_buffers(0)
 {
-m_perfect_switch = new PerfectSwitch(m_id, this, p->virt_nets);
-m_port_buffers = p->port_buffers;
-m_num_connected_buffers = 0;
-}
-
-Switch::~Switch()
-{
-delete m_perfect_switch;
-
-// Delete throttles (one per output port)
-deletePointers(m_throttles);
-
-// Delete MessageBuffers
-deletePointers(m_port_buffers);
+m_port_buffers.reserve(p->port_buffers.size());
+for (auto& buffer : p->port_buffers) {
+m_port_buffers.emplace_back(buffer);
+}
 }

 void
 Switch::init()
 {
 BasicRouter::init();
-m_perfect_switch->init(m_network_ptr);
+perfectSwitch.init(m_network_ptr);
 }

 void
 Switch::addInPort(const vector& in)
 {
-m_perfect_switch->addInPort(in);
+perfectSwitch.addInPort(in);
 }

 void
@@ -78,36 +68,26 @@
Cycles link_latency, int bw_multiplier)
 {
 // Create a throttle
-RubySystem *rs = m_network_ptr->params()->ruby_system;
-Throttle* throttle_ptr = new Throttle(m_id, rs, m_throttles.size(),
-  link_latency, bw_multiplier,
-   
m_network_ptr->getEndpointBandwidth(),

-  this);
-
-m_throttles.push_back(throttle_ptr);
+throttles.emplace_back(m_id, m_network_ptr->params()->ruby_system,
+throttles.size(), link_latency, bw_multiplier,
+m_network_ptr->getEndpointBandwidth(), this);

 // Create one buffer per vnet (these are intermediaryQueues)
 vector intermediateBuffers;

 for (int i = 0; i < out.size(); ++i) {
 assert(m_num_connected_buffers < m_port_buffers.size());
-MessageBuffer* buffer_ptr =  
m_port_buffers[m_num_connected_buffers];

+MessageBuffer* buffer_ptr =
+m_port_buffers[m_num_connected_buffers];
 m_num_connected_buffers++;
 intermediateBuffers.push_back(buffer_ptr);
 }

 // Hook the queues to the PerfectSwitch
-m_perfect_switch->addOutPort(intermediateBuffers, routing_table_entry);
+perfectSwitch.addOutPort(intermediateBuffers, routing_table_entry);

 // Hook the queues to the Throttle
-throttle_ptr->addLinks(intermediateBuffers, out);
-}
-
-const Throttle*
-Switch::getThrottle(LinkID link_number) const
-{
-assert(m_throttles[link_number] != NULL);
-return m_throttles[link_number];
+throttles.back().addLinks(intermediateBuffers, out);
 }

 void
@@ -115,15 +95,15 @@
 {
 BasicRouter::regStats();

-for (int link = 0; link < m_throttles.size(); link++) {
-m_throttles[link]->regStats(name());
+for (auto& throttle : throttles) {
+throttle.regStats(name());
 }

 m_avg_utilization.name(name() + ".percent_links_utilized");
-for (unsigned int i = 0; i < m_throttles.size(); i++) {
-m_avg_utilization += m_throttles[i]->getUtilization();
+for (const auto& throttle : throttles) {
+m_avg_utilization += throttle.getUtilization();
 }
-m_avg_utilization /= Stats::constant(m_throttles.size());
+m_avg_utilization /= Stats::constant(throttles.size());

 for (unsigned int type = MessageSizeType_FIRST;
  type < MessageSizeType_NUM; ++type) {
@@ -138,8 +118,8 @@
 .flags(Stats::nozero)

[gem5-dev] Change in gem5/gem5[develop]: base: Add static assert to trie

2020-03-16 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26784 )


Change subject: base: Add static assert to trie
..

base: Add static assert to trie

Trie is based on the condition that they key is an integral. As so,
add a static_assert to guarantee that. Also, added some general info
about tries to the class.

Change-Id: Idc18f6a685db8047cd44b791f427666d3dd2d187
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26784
Reviewed-by: Gabe Black 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/base/trie.hh
1 file changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/trie.hh b/src/base/trie.hh
index a75e9e7..71a14c5 100644
--- a/src/base/trie.hh
+++ b/src/base/trie.hh
@@ -31,16 +31,27 @@

 #include 
 #include 
+#include 

 #include "base/cprintf.hh"
 #include "base/logging.hh"
 #include "base/types.hh"

-// Key has to be an integral type.
+/**
+ * A trie is a tree-based data structure used for data retrieval. It uses
+ * bits masked from the msb of the key to to determine a value's location,
+ * so its lookups have their worst case time dictated by the key's size.
+ *
+ * @tparam Key Type of the key of the tree nodes. Must be an integral type.
+ * @tparam Value Type of the values associated to the keys.
+ */
 template 
 class Trie
 {
   protected:
+static_assert(std::is_integral::value,
+"Key has to be an integral type");
+
 struct Node
 {
 Key key;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26784
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Idc18f6a685db8047cd44b791f427666d3dd2d187
Gerrit-Change-Number: 26784
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: x86: Hook up pread64 in 32/64 bit linux, and pwrite64 in 32 bit.

2020-03-16 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26604 )


Change subject: x86: Hook up pread64 in 32/64 bit linux, and pwrite64 in 32  
bit.

..

x86: Hook up pread64 in 32/64 bit linux, and pwrite64 in 32 bit.

My new computer has a dynamic linker which seems to use the pread64
system call, and since that gets pulled in when running tests, that
needs to be implemented for tests to pass on that machine, making it
possible to detect problems the failure might ohterwise mask.

This is only really necessary for 64 bit linux, but while I'm here I
hooked it up for 32 bit linux as well. I also added pwrite64 for 32 bit
linux since that was only enabled for 64 bit.

Change-Id: I8d2061d30e98a1581c5e30b522b6ba12aea20ecd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26604
Reviewed-by: Matthew Poremba 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/arch/x86/linux/process.cc
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Matthew Poremba: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc
index 36a75d7..5d6e5f5 100644
--- a/src/arch/x86/linux/process.cc
+++ b/src/arch/x86/linux/process.cc
@@ -272,7 +272,7 @@
 /*  14 */ { "rt_sigprocmask", ignoreWarnOnceFunc },
 /*  15 */ { "rt_sigreturn" },
 /*  16 */ { "ioctl", ioctlFunc },
-/*  17 */ { "pread64" },
+/*  17 */ { "pread64", pread64Func },
 /*  18 */ { "pwrite64", pwrite64Func },
 /*  19 */ { "readv", readvFunc },
 /*  20 */ { "writev", writevFunc },
@@ -783,8 +783,8 @@
 /* 177 */ { "rt_sigtimedwait" },
 /* 178 */ { "rt_sigqueueinfo" },
 /* 179 */ { "rt_sigsuspend" },
-/* 180 */ { "pread64" },
-/* 181 */ { "pwrite64" },
+/* 180 */ { "pread64", pread64Func },
+/* 181 */ { "pwrite64", pwrite64Func },
 /* 182 */ { "chown" },
 /* 183 */ { "getcwd", getcwdFunc },
 /* 184 */ { "capget" },

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26604
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8d2061d30e98a1581c5e30b522b6ba12aea20ecd
Gerrit-Change-Number: 26604
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Brandon Potter 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Matthew Poremba 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: sim: Provide an implementation for the pread64 system call.

2020-03-16 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26603 )


Change subject: sim: Provide an implementation for the pread64 system call.
..

sim: Provide an implementation for the pread64 system call.

This implementation is very similar to the pwrite64 system call, just
with data going the other direction as you'd expect.

Change-Id: I4f8ec9d83bf2339f9c84e31f25309c58e6157304
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26603
Reviewed-by: Matthew Poremba 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/sim/syscall_emul.hh
1 file changed, 21 insertions(+), 0 deletions(-)

Approvals:
  Matthew Poremba: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 2503635..f999e45 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1818,6 +1818,27 @@

 template 
 SyscallReturn
+pread64Func(SyscallDesc *desc, int num, ThreadContext *tc,
+int tgt_fd, Addr bufPtr, int nbytes, int offset)
+{
+auto p = tc->getProcessPtr();
+
+auto ffdp = std::dynamic_pointer_cast((*p->fds)[tgt_fd]);
+if (!ffdp)
+return -EBADF;
+int sim_fd = ffdp->getSimFD();
+
+BufferArg bufArg(bufPtr, nbytes);
+
+int bytes_read = pread(sim_fd, bufArg.bufferPtr(), nbytes, offset);
+
+bufArg.copyOut(tc->getVirtProxy());
+
+return (bytes_read == -1) ? -errno : bytes_read;
+}
+
+template 
+SyscallReturn
 pwrite64Func(SyscallDesc *desc, int num, ThreadContext *tc,
  int tgt_fd, Addr bufPtr, int nbytes, int offset)
 {

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26603
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I4f8ec9d83bf2339f9c84e31f25309c58e6157304
Gerrit-Change-Number: 26603
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Bobby Bruce 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Brandon Potter 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Matthew Poremba 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: tests, arch-alpha: Removing ALPHA ISA from testlib config

2020-03-16 Thread Bobby R. Bruce (Gerrit)
Bobby R. Bruce has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26823 )



Change subject: tests,arch-alpha: Removing ALPHA ISA from testlib config
..

tests,arch-alpha: Removing ALPHA ISA from testlib config

Change-Id: Icded5f4aec7bc212a818a97c4de5d7b8f8757121
---
M ext/testlib/config.py
1 file changed, 0 insertions(+), 3 deletions(-)



diff --git a/ext/testlib/config.py b/ext/testlib/config.py
index 643ef68..39d6a24 100644
--- a/ext/testlib/config.py
+++ b/ext/testlib/config.py
@@ -235,7 +235,6 @@
 constants.isa_tag_type = 'isa'
 constants.x86_tag = 'X86'
 constants.sparc_tag = 'SPARC'
-constants.alpha_tag = 'ALPHA'
 constants.riscv_tag = 'RISCV'
 constants.arm_tag = 'ARM'
 constants.mips_tag = 'MIPS'
@@ -260,7 +259,6 @@
 constants.isa_tag_type : (
 constants.x86_tag,
 constants.sparc_tag,
-constants.alpha_tag,
 constants.riscv_tag,
 constants.arm_tag,
 constants.mips_tag,
@@ -289,7 +287,6 @@
 constants.arm_tag   : (constants.host_arm_tag,),
 constants.x86_tag   : (constants.host_x86_64_tag,  
constants.host_i386_tag),
 constants.sparc_tag : (constants.host_x86_64_tag,  
constants.host_i386_tag),
-constants.alpha_tag : (constants.host_x86_64_tag,  
constants.host_i386_tag),
 constants.riscv_tag : (constants.host_x86_64_tag,  
constants.host_i386_tag),
 constants.mips_tag  : (constants.host_x86_64_tag,  
constants.host_i386_tag),
 constants.power_tag : (constants.host_x86_64_tag,  
constants.host_i386_tag),


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26823
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Icded5f4aec7bc212a818a97c4de5d7b8f8757121
Gerrit-Change-Number: 26823
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: cpu: IntrControl, clear all and check helpers

2020-03-16 Thread Giacomo Travaglini (Gerrit)
Giacomo Travaglini has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26809 )



Change subject: cpu: IntrControl, clear all and check helpers
..

cpu: IntrControl, clear all and check helpers

This patch extends the IntrControl to provided additional member
functions for (1) clearing all pending interrupts in a PE and (2)
checking for any pending interrupt in a PE. These are intended to
be used from interrupt management related peripherals.

Change-Id: I06b553872ed469e7449b872a0716865773ace154
---
M src/cpu/intr_control.cc
M src/cpu/intr_control.hh
2 files changed, 22 insertions(+), 6 deletions(-)



diff --git a/src/cpu/intr_control.cc b/src/cpu/intr_control.cc
index 071b9d5..9274b37 100644
--- a/src/cpu/intr_control.cc
+++ b/src/cpu/intr_control.cc
@@ -47,18 +47,32 @@
 IntrControl::post(int cpu_id, int int_num, int index)
 {
 DPRINTF(IntrControl, "post  %d:%d (cpu %d)\n", int_num, index, cpu_id);
-std::vector &tcvec = sys->threadContexts;
-BaseCPU *cpu = tcvec[cpu_id]->getCpuPtr();
-cpu->postInterrupt(tcvec[cpu_id]->threadId(), int_num, index);
+ThreadContext *tc = sys->getThreadContext(cpu_id);
+tc->getCpuPtr()->postInterrupt(tc->threadId(), int_num, index);
 }

 void
 IntrControl::clear(int cpu_id, int int_num, int index)
 {
 DPRINTF(IntrControl, "clear %d:%d (cpu %d)\n", int_num, index, cpu_id);
-std::vector &tcvec = sys->threadContexts;
-BaseCPU *cpu = tcvec[cpu_id]->getCpuPtr();
-cpu->clearInterrupt(tcvec[cpu_id]->threadId(), int_num, index);
+ThreadContext *tc = sys->getThreadContext(cpu_id);
+tc->getCpuPtr()->clearInterrupt(tc->threadId(), int_num, index);
+}
+
+void
+IntrControl::clearAll(int cpu_id)
+{
+DPRINTF(IntrControl, "Clear all pending interrupts for CPU %d\n",  
cpu_id);

+ThreadContext *tc = sys->getThreadContext(cpu_id);
+tc->getCpuPtr()->clearInterrupts(tc->threadId());
+}
+
+bool
+IntrControl::havePosted(int cpu_id) const
+{
+DPRINTF(IntrControl, "Check pending interrupts for CPU %d\n", cpu_id);
+ThreadContext *tc = sys->getThreadContext(cpu_id);
+return tc->getCpuPtr()->checkInterrupts(tc);
 }

 IntrControl *
diff --git a/src/cpu/intr_control.hh b/src/cpu/intr_control.hh
index b7ff2a8..a6f025e 100644
--- a/src/cpu/intr_control.hh
+++ b/src/cpu/intr_control.hh
@@ -45,6 +45,8 @@

 void clear(int cpu_id, int int_num, int index);
 void post(int cpu_id, int int_num, int index);
+void clearAll(int cpu_id);
+bool havePosted(int cpu_id) const;

 void
 clear(int int_num, int index = 0)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26809
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I06b553872ed469e7449b872a0716865773ace154
Gerrit-Change-Number: 26809
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: arch-arm, dev-arm: WakeRequest implementation

2020-03-16 Thread Giacomo Travaglini (Gerrit)
Giacomo Travaglini has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26810 )



Change subject: arch-arm, dev-arm: WakeRequest implementation
..

arch-arm, dev-arm: WakeRequest implementation

This patch provides a GIC WakeRequest implementation based on GICv3 and
FVPBasePwrCtrl models. When GICR_WAKER.ProcessorSleep is set to 1 for a
certain PE, any pending interrupt coming from the Redistributor asserts
a WakeRequest signal; if PwrStatus.WEN is set, this brings up the PE.

Change-Id: I5e8b7f0e9f7706dfcc7d2e0857f4c3b86cdc04ca
---
M src/arch/arm/system.cc
M src/arch/arm/system.hh
M src/dev/arm/fvp_base_pwr_ctrl.cc
M src/dev/arm/fvp_base_pwr_ctrl.hh
M src/dev/arm/gic_v3.cc
M src/dev/arm/gic_v3.hh
M src/dev/arm/gic_v3_cpu_interface.cc
M src/dev/arm/gic_v3_cpu_interface.hh
M src/dev/arm/gic_v3_redistributor.cc
9 files changed, 136 insertions(+), 12 deletions(-)



diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc
index 9053a5c..da6a416 100644
--- a/src/arch/arm/system.cc
+++ b/src/arch/arm/system.cc
@@ -213,6 +213,22 @@
 pwr_ctrl->clearStandByWfi(tc);
 }

+bool
+ArmSystem::callSetWakeRequest(ThreadContext *tc)
+{
+if (FVPBasePwrCtrl *pwr_ctrl = getArmSystem(tc)->getPowerController())
+return pwr_ctrl->setWakeRequest(tc);
+else
+return true;
+}
+
+void
+ArmSystem::callClearWakeRequest(ThreadContext *tc)
+{
+if (FVPBasePwrCtrl *pwr_ctrl = getArmSystem(tc)->getPowerController())
+pwr_ctrl->clearWakeRequest(tc);
+}
+
 ArmSystem *
 ArmSystemParams::create()
 {
diff --git a/src/arch/arm/system.hh b/src/arch/arm/system.hh
index d9268f0..4897fd8 100644
--- a/src/arch/arm/system.hh
+++ b/src/arch/arm/system.hh
@@ -326,6 +326,16 @@

 /** Make a call to notify the power controller of STANDBYWFI  
deassertion */

 static void callClearStandByWfi(ThreadContext *tc);
+
+/**
+ * Notify the power controller of WAKEREQUEST assertion. Returns true
+ * if WAKEREQUEST is enabled as a power-on mechanism, and the core is  
now

+ * powered, false otherwise
+ */
+static bool callSetWakeRequest(ThreadContext *tc);
+
+/** Notify the power controller of WAKEREQUEST deassertion */
+static void callClearWakeRequest(ThreadContext *tc);
 };

 #endif
diff --git a/src/dev/arm/fvp_base_pwr_ctrl.cc  
b/src/dev/arm/fvp_base_pwr_ctrl.cc

index 88708bd..a6650b8 100644
--- a/src/dev/arm/fvp_base_pwr_ctrl.cc
+++ b/src/dev/arm/fvp_base_pwr_ctrl.cc
@@ -91,6 +91,34 @@
 pwrs->pwfi = 0;
 }

+bool
+FVPBasePwrCtrl::setWakeRequest(ThreadContext *const tc)
+{
+PwrStatus *pwrs = getCorePwrStatus(tc);
+
+if (!pwrs->pwk)
+DPRINTF(FVPBasePwrCtrl, "FVPBasePwrCtrl::setWakeRequest:  
WakeRequest "

+"asserted for core %d\n", tc->contextId());
+pwrs->pwk = 1;
+if (!pwrs->l0 && pwrs->wen) {
+pwrs->wk = WK_GICWR;
+powerCoreOn(tc, pwrs);
+return true;
+}
+return false;
+}
+
+void
+FVPBasePwrCtrl::clearWakeRequest(ThreadContext *const tc)
+{
+PwrStatus *pwrs = getCorePwrStatus(tc);
+
+if (pwrs->pwk)
+DPRINTF(FVPBasePwrCtrl, "FVPBasePwrCtrl::clearWakeRequest: "
+"WakeRequest deasserted for core %d\n", tc->contextId());
+pwrs->pwk = 0;
+}
+
 Tick
 FVPBasePwrCtrl::read(PacketPtr pkt)
 {
@@ -276,6 +304,7 @@
 DPRINTF(FVPBasePwrCtrl, "FVPBasePwrCtrl::startCoreUp: Starting  
core %d "

 "from the power controller\n", tc->contextId());
 clearStandByWfi(tc);
+clearWakeRequest(tc);

 // InitCPU
 Reset().invoke(tc);
diff --git a/src/dev/arm/fvp_base_pwr_ctrl.hh  
b/src/dev/arm/fvp_base_pwr_ctrl.hh

index df0b686..aa446a8 100644
--- a/src/dev/arm/fvp_base_pwr_ctrl.hh
+++ b/src/dev/arm/fvp_base_pwr_ctrl.hh
@@ -51,11 +51,6 @@
  * @file
  * This class implements the base power controller for FVP-based
  * platforms. Based on Fast Models version 11.8.
- *
- * Limitations:
- * - Level 2 affinity is not implemented -> PSYSR.L2 is RAZ
- * - WakeRequests are not modelled by GICv3 -> PSYSR.WEN is always 0
- * - PSYSR.WK can only be 0b00 (Cold power-on) and 0b10 (Wake by PPONR)
  */
 class FVPBasePwrCtrl : public BasicPioDevice
 {
@@ -78,6 +73,21 @@
  */
 void clearStandByWfi(ThreadContext *const tc);

+/**
+ * Triggered by the GIC when GICR_WAKER.ProcessorSleep is 1 and there  
are

+ * pending interrupts for the core
+ * @param tc Thread context representing the core
+ * @return true if the core is powered ON when PwrStatus.WEN is  
enabled,

+ * false otherwise
+ */
+bool setWakeRequest(ThreadContext *const tc);
+
+/**
+ * Triggered by the GIC when GICR_WAKER.ProcessorSleep becomes 0
+ * @param tc Thread context representing the core
+ */
+void clearWakeRequest(ThreadContext *const tc);
+
 void init() override;

   protected:
diff --git a/src/dev/arm/gic_v3.cc b/src/d

[gem5-dev] Change in gem5/gem5[develop]: scons: PROTOCOL=MOESI_CMP_directory for NULL

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26806 )



Change subject: scons: PROTOCOL=MOESI_CMP_directory for NULL
..

scons: PROTOCOL=MOESI_CMP_directory for NULL

This will make all NULL regression tests run on MOESI_CMP_directory,
which is a more complex protocol and therefore is more likely to catch
Ruby bugs on the tests that use Ruby.

Change-Id: I6cd34663918700f4329eb1d4057e832e8b55dfea
---
M build_opts/NULL
1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/build_opts/NULL b/build_opts/NULL
index 1242fa9..b1d1532 100644
--- a/build_opts/NULL
+++ b/build_opts/NULL
@@ -1,3 +1,3 @@
 TARGET_ISA = 'null'
 CPU_MODELS = ''
-PROTOCOL='MI_example'
+PROTOCOL = 'MOESI_CMP_directory'

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26806
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I6cd34663918700f4329eb1d4057e832e8b55dfea
Gerrit-Change-Number: 26806
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: mem: make MemTest panic on a packet error

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26804 )



Change subject: mem: make MemTest panic on a packet error
..

mem: make MemTest panic on a packet error

Before this change, running:

./build/NULL/gem5.opt configs/example/ruby_mem_test.py -m 2000 \
  --functional 10

would only print warning for memory errors such as:

warn: Read access failed at 0x107a00

and there was no way to make the simulation fail.

This commit makes those warnings into errors such as:

panic: Read access failed at 0x107a00

unless --suppress-func-errors is given.

This will be used to automate MemTest testing in later commits.

Change-Id: I1840c1ed1853f1a71ec73bd50cadaac095794f91
---
M configs/example/ruby_mem_test.py
M src/cpu/testers/memtest/MemTest.py
M src/cpu/testers/memtest/memtest.cc
M src/cpu/testers/memtest/memtest.hh
M tests/configs/memtest-ruby.py
5 files changed, 12 insertions(+), 13 deletions(-)



diff --git a/configs/example/ruby_mem_test.py  
b/configs/example/ruby_mem_test.py

index 5325c50..b3c8334 100644
--- a/configs/example/ruby_mem_test.py
+++ b/configs/example/ruby_mem_test.py
@@ -55,8 +55,8 @@
 parser.add_option("--num-dmas", type="int", default=0, help="# of dma  
testers")

 parser.add_option("--functional", type="int", default=0,
   help="percentage of accesses that should be functional")
-parser.add_option("--suppress-func-warnings", action="store_true",
-  help="suppress warnings when functional accesses fail")
+parser.add_option("--suppress-func-errors", action="store_true",
+  help="suppress panic when functional accesses fail")

 #
 # Add the ruby specific and protocol specific options
@@ -96,7 +96,7 @@
  percent_functional = options.functional,
  percent_uncacheable = 0,
  progress_interval = options.progress,
- suppress_func_warnings = options.suppress_func_warnings) \
+ suppress_func_errors = options.suppress_func_errors,
  for i in range(options.num_cpus) ]

 system = System(cpu = cpus,
@@ -108,8 +108,8 @@
  percent_functional = 0,
  percent_uncacheable = 0,
  progress_interval = options.progress,
- suppress_func_warnings =
-not  
options.suppress_func_warnings) \

+ suppress_func_errors =
+not options.suppress_func_errors) \
  for i in range(options.num_dmas) ]
 system.dma_devices = dmas
 else:
diff --git a/src/cpu/testers/memtest/MemTest.py  
b/src/cpu/testers/memtest/MemTest.py

index 463c553..36bc929 100644
--- a/src/cpu/testers/memtest/MemTest.py
+++ b/src/cpu/testers/memtest/MemTest.py
@@ -69,5 +69,5 @@

 # Add the ability to supress error responses on functional
 # accesses as Ruby needs this
-suppress_func_warnings = Param.Bool(False, "Suppress warnings when "\
+suppress_func_errors = Param.Bool(False, "Suppress panic when "\
 "functional accesses fail.")
diff --git a/src/cpu/testers/memtest/memtest.cc  
b/src/cpu/testers/memtest/memtest.cc

index 262f1a9..720b273 100644
--- a/src/cpu/testers/memtest/memtest.cc
+++ b/src/cpu/testers/memtest/memtest.cc
@@ -99,7 +99,7 @@
   nextProgressMessage(p->progress_interval),
   maxLoads(p->max_loads),
   atomic(p->system->isAtomicMode()),
-  suppressFuncWarnings(p->suppress_func_warnings)
+  suppressFuncErrors(p->suppress_func_errors)
 {
 id = TESTER_ALLOCATOR++;
 fatal_if(id >= blockSize, "Too many testers, only %d allowed\n",
@@ -146,10 +146,9 @@
 const uint8_t *pkt_data = pkt->getConstPtr();

 if (pkt->isError()) {
-if (!functional || !suppressFuncWarnings) {
-warn("%s access failed at %#x\n",
- pkt->isWrite() ? "Write" : "Read", req->getPaddr());
-}
+if (!functional || !suppressFuncErrors)
+panic( "%s access failed at %#x\n",
+pkt->isWrite() ? "Write" : "Read", req->getPaddr());
 } else {
 if (pkt->isRead()) {
 uint8_t ref_data = referenceData[req->getPaddr()];
diff --git a/src/cpu/testers/memtest/memtest.hh  
b/src/cpu/testers/memtest/memtest.hh

index 86ac6e4..fa13c0a 100644
--- a/src/cpu/testers/memtest/memtest.hh
+++ b/src/cpu/testers/memtest/memtest.hh
@@ -165,7 +165,7 @@

 const bool atomic;

-const bool suppressFuncWarnings;
+const bool suppressFuncErrors;

 Stats::Scalar numReadsStat;
 Stats::Scalar numWritesStat;
diff --git a/tests/configs/memtest-ruby.py b/tests/configs/memtest-ruby.py
index fe02c28..7aca77f 100644
--- a/tests/configs/memtest-ruby.py
+++ b/tests/configs/memtest-ruby.py
@@ -63,7 +63,7 @@

 # ruby does not support atomic, functional, or unc

[gem5-dev] Change in gem5/gem5[develop]: tests: add ruby_mem_test.py to the tests

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26805 )



Change subject: tests: add ruby_mem_test.py to the tests
..

tests: add ruby_mem_test.py to the tests

This catches ruby functional memory errors we have observed, and ensures
that ruby_mem_test.py itself won't be broken.

The test duration is about 10 seconds, and it can be run as:

./main.py run --uid SuiteUID:tests/gem5/test_ruby_mem_test.py:test-ruby\
_mem_test-NULL-x86_64-opt

Change-Id: I39bc559aaea3ebb41217a96cd4e8dae46271ea1f
---
M tests/gem5/memory/test.py
1 file changed, 12 insertions(+), 0 deletions(-)



diff --git a/tests/gem5/memory/test.py b/tests/gem5/memory/test.py
index 95c2903..77946f1 100644
--- a/tests/gem5/memory/test.py
+++ b/tests/gem5/memory/test.py
@@ -65,3 +65,15 @@
 config_args = [],
 valid_isas=(constants.null_tag,),
 )
+
+gem5_verify_config(
+name='test-ruby_mem_test',
+fixtures=(),
+verifiers=(),
+config=joinpath(config.base_dir,
+'configs', 'example', 'ruby_mem_test.py'),
+config_args=['--abs-max-tick', '2000',
+'--functional', '10', '--panic-on-error'],
+valid_isas=('NULL',),
+valid_hosts=constants.supported_hosts,
+)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26805
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I39bc559aaea3ebb41217a96cd4e8dae46271ea1f
Gerrit-Change-Number: 26805
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: tests: create tests for various traffic generators on NULL

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26808 )



Change subject: tests: create tests for various traffic generators on NULL
..

tests: create tests for various traffic generators on NULL

New tests were added for:

- garnet_synth_traffic.py
- ruby_random_test.py
- ruby_direct_test.py

These tests are factored out with the tests for:

- memcheck.py
- ruby_mem_test.py

Each new test was calibrated to last about 5 seconds on a Lenovo ThinkPad
P51.

Change-Id: Ie13d3963e1163cffae5dce329b623fbebbf2b983
---
M tests/gem5/memory/test.py
1 file changed, 19 insertions(+), 17 deletions(-)



diff --git a/tests/gem5/memory/test.py b/tests/gem5/memory/test.py
index 61c2042..5b6294e 100644
--- a/tests/gem5/memory/test.py
+++ b/tests/gem5/memory/test.py
@@ -66,21 +66,23 @@
 valid_isas=(constants.null_tag,),
 )

-gem5_verify_config(
-name='test-ruby_mem_test',
-fixtures=(),
-verifiers=(),
-config=joinpath(config.base_dir,
-'configs', 'example', 'ruby_mem_test.py'),
-config_args=['--abs-max-tick', '2000', '--functional', '10'],
-)
+null_tests = [
+('garnet_synth_traffic', ['--sim-cycles', '500']),
+('memcheck', ['--maxtick', '20', '--prefetchers']),
+('ruby_mem_test', ['--abs-max-tick', '2000',
+'--functional', '10']),
+('ruby_random_test', ['--maxloads', '5000']),
+('ruby_direct_test', ['--requests', '5']),
+]

-gem5_verify_config(
-name='test-memcheck',
-fixtures=(),
-verifiers=(),
-config=joinpath(config.base_dir, 'configs', 'example','memcheck.py'),
-config_args=['--maxtick', '20', '--prefetchers'],
-valid_isas=('NULL',),
-valid_hosts=constants.supported_hosts,
-)
+for basename_noext, args in null_tests:
+gem5_verify_config(
+name=basename_noext,
+fixtures=(),
+verifiers=(),
+config=joinpath(config.base_dir, 'configs',
+'example', basename_noext + '.py'),
+config_args=args,
+valid_isas=('NULL',),
+valid_hosts=constants.supported_hosts,
+)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26808
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie13d3963e1163cffae5dce329b623fbebbf2b983
Gerrit-Change-Number: 26808
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: tests: fix the memcheck test

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26807 )



Change subject: tests: fix the memcheck test
..

tests: fix the memcheck test

The file was raising due to the undefined constant `verifiers`, leading
the test to be ignored.

./main.py list -v

would show this as:

```
Traceback (most recent call last):
  File "/gem5/tests/../ext/testlib/loader.py", line 239, in load_file
execfile(path, newdict, newdict)
  File "/gem5/tests/gem5/memcheck/test_memcheck.py", line 32, in 
verifiers=verifiers,
NameError: name 'verifiers' is not defined

Exception thrown while loading "/gem5/tests/gem5/memcheck/test_memcheck.py"
Ignoring all tests in this file.
```

The test has been modified to have an empty verifiers list, which should
still catch bugs since src/mem/mem_checker.cc has several asserts already
which would be caught by the test system due to the exit status.

Also make the following changes to the test:

-   move it to tests/gem5/memory/test.py with other memory tests.

This makes it easier to see all the tests in the source in one go, and
might make it easier to factor certain memory things out later on.

-   reduce --maxtick to a value that finishes in 7 seconds on a Lenovo
ThinkPad P51.

The previous value would take 50x longer, which feels too long for a
single test.

-   enable --prefetchers to also stress a prefetcher in the test

Change-Id: I58bd598b1142f349d25fa4fa4a8e41529e61a9ee
---
D tests/gem5/memcheck/test_memcheck.py
M tests/gem5/memory/test.py
2 files changed, 9 insertions(+), 39 deletions(-)



diff --git a/tests/gem5/memcheck/test_memcheck.py  
b/tests/gem5/memcheck/test_memcheck.py

deleted file mode 100644
index 9709dd5..000
--- a/tests/gem5/memcheck/test_memcheck.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (c) 2020 The Regents of the University of California
-# All Rights Reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met: redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer;
-# redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution;
-# neither the name of the copyright holders nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-from testlib import *
-
-gem5_verify_config(
-name='test-memcheck',
-fixtures=(),
-verifiers=verifiers,
-config=joinpath(config.base_dir, 'configs', 'example','memcheck.py'),
-config_args=['-m', '1000'],
-valid_isas=('NULL',),
-valid_hosts=constants.supported_hosts,
-)
diff --git a/tests/gem5/memory/test.py b/tests/gem5/memory/test.py
index 77946f1..61c2042 100644
--- a/tests/gem5/memory/test.py
+++ b/tests/gem5/memory/test.py
@@ -72,8 +72,15 @@
 verifiers=(),
 config=joinpath(config.base_dir,
 'configs', 'example', 'ruby_mem_test.py'),
-config_args=['--abs-max-tick', '2000',
-'--functional', '10', '--panic-on-error'],
+config_args=['--abs-max-tick', '2000', '--functional', '10'],
+)
+
+gem5_verify_config(
+name='test-memcheck',
+fixtures=(),
+verifiers=(),
+config=joinpath(config.base_dir, 'configs', 'example','memcheck.py'),
+config_args=['--maxtick', '20', '--prefetchers'],
 valid_isas=('NULL',),
 valid_hosts=constants.supported_hosts,
 )

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26807
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I58bd598b1142f349d25fa4fa4a8e41529e61a9ee
Gerrit-Change-Number: 26807
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli 
Gerrit-MessageType: newchange

[gem5-dev] Change in gem5/gem5[develop]: configs: fix ValueError exception in ruby_mem_test.py

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26803 )



Change subject: configs: fix ValueError exception in ruby_mem_test.py
..

configs: fix ValueError exception in ruby_mem_test.py

Trying to run the script with:

./build/NULL/gem5.opt configs/example/ruby_mem_test.py

was failing with:

Traceback (most recent call last):
  File "", line 1, in 
  File "/gem5/src/python/m5/main.py", line 457, in main
exec(filecode, scope)
  File "/gem5/configs/example/ruby_mem_test.py", line 71, in 
os.path.join(config_root, "common", "Options.py"), 'exec'))
  File "/gem5/configs/common/Options.py", line 48, in 
from .Benchmarks import *
ValueError: Attempted relative import in non-package

The removed exec statement does not appear to be needed however,
since Options is already imported above with:

from common import Options

Change-Id: I934a65d21fa5099a786224a5476d609e4d707205
---
M configs/example/ruby_mem_test.py
1 file changed, 0 insertions(+), 4 deletions(-)



diff --git a/configs/example/ruby_mem_test.py  
b/configs/example/ruby_mem_test.py

index 070cb37..5325c50 100644
--- a/configs/example/ruby_mem_test.py
+++ b/configs/example/ruby_mem_test.py
@@ -63,10 +63,6 @@
 #
 Ruby.define_options(parser)

-exec(compile( \
-open(os.path.join(config_root, "common", "Options.py")).read(), \
-os.path.join(config_root, "common", "Options.py"), 'exec'))
-
 (options, args) = parser.parse_args()

 #

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26803
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I934a65d21fa5099a786224a5476d609e4d707205
Gerrit-Change-Number: 26803
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: configs: fix forwarding of --bootloader to fs.py

2020-03-16 Thread Ciro Santilli (Gerrit)
Ciro Santilli has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26724 )


Change subject: configs: fix forwarding of --bootloader to fs.py
..

configs: fix forwarding of --bootloader to fs.py

Since I02919207d6f175854017ae7b603d811da63d618e the fs.py --bootloader
option can be used to select a bootloader explicitly.

Ia3d863db276a023b6a2c7ee7a656d8142ff75589 forgot to pass that parameter
likely due to a rebase issue and it gets searched in M5_PATH.

Change-Id: Ic4cf3ccf041e1c34eac7753424fe842bd34a77f9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26724
Reviewed-by: Gabe Black 
Maintainer: Giacomo Travaglini 
Tested-by: kokoro 
---
M configs/common/FSConfig.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Giacomo Travaglini: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
index b58c273..3ae00ad 100644
--- a/configs/common/FSConfig.py
+++ b/configs/common/FSConfig.py
@@ -311,7 +311,7 @@

 self.workload = workload

-self.realview.setupBootLoader(self, binary)
+self.realview.setupBootLoader(self, binary, bootloader)

 if external_memory:
 # I/O traffic enters iobus

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26724
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ic4cf3ccf041e1c34eac7753424fe842bd34a77f9
Gerrit-Change-Number: 26724
Gerrit-PatchSet: 2
Gerrit-Owner: Ciro Santilli 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: sim-power: Fix power model to work with stat groups

2020-03-16 Thread Nikos Nikoleris (Gerrit)
Nikos Nikoleris has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26785 )



Change subject: sim-power: Fix power model to work with stat groups
..

sim-power: Fix power model to work with stat groups

The MathExpr framework used by the power model to derive power
estimations requires access to stats from the whole system and
individual SimObjects. Since the introduction of stat groups these
stats can be standalone, in groups or in the default group. This
changeset fixes the power model to look for stats in all possible
locations.

JIRA: https://gem5.atlassian.net/projects/GEM5/issues/GEM5-319

Change-Id: I8365d5c17ddc854a03265b204ce974e5168ad5bc
Signed-off-by: Nikos Nikoleris 
---
M src/sim/power/mathexpr_powermodel.cc
M src/sim/power/mathexpr_powermodel.hh
2 files changed, 17 insertions(+), 4 deletions(-)



diff --git a/src/sim/power/mathexpr_powermodel.cc  
b/src/sim/power/mathexpr_powermodel.cc

index 13af0fd..fb18410 100644
--- a/src/sim/power/mathexpr_powermodel.cc
+++ b/src/sim/power/mathexpr_powermodel.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 ARM Limited
+ * Copyright (c) 2016-2017, 2020 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -72,6 +72,19 @@
 }
 }

+// Also collect stats that might be in groups
+for (auto &g: clocked_object->getStatGroups()) {
+for (auto &i: g.second->getStats()) {
+const std::string rel_path = g.first + "." + i->name;
+stats_map[rel_path] = i;
+}
+}
+
+// Also collect stats that are in the default group
+for (auto &i: clocked_object->getStats()) {
+stats_map[i->name] = i;
+}
+
 tryEval(st_expr);
 const bool st_failed = failed;

diff --git a/src/sim/power/mathexpr_powermodel.hh  
b/src/sim/power/mathexpr_powermodel.hh

index d8bd239..9a65302 100644
--- a/src/sim/power/mathexpr_powermodel.hh
+++ b/src/sim/power/mathexpr_powermodel.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 ARM Limited
+ * Copyright (c) 2016-2017, 2020 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -82,7 +82,7 @@
  */
 double getStatValue(const std::string & name) const;

-void startup();
+void startup() override;

 void regStats();

@@ -112,7 +112,7 @@
 std::string basename;

 // Map that contains relevant stats for this power model
-std::unordered_map stats_map;
+std::unordered_map stats_map;

 // Did the expression fail to evaluate (e.g., because a stat value
 // can't be resolved)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26785
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8365d5c17ddc854a03265b204ce974e5168ad5bc
Gerrit-Change-Number: 26785
Gerrit-PatchSet: 1
Gerrit-Owner: Nikos Nikoleris 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: power: Fix regStats for PowerModel and PowerModelState

2020-03-16 Thread Giacomo Travaglini (Gerrit)
Giacomo Travaglini has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/26643 )


Change subject: power: Fix regStats for PowerModel and PowerModelState
..

power: Fix regStats for PowerModel and PowerModelState

Every Stats::Group need to call the parent regStats to
make sure that the base Stats::Group::regStats() gets
called

JIRA: https://gem5.atlassian.net/projects/GEM5/issues/GEM5-319

Change-Id: I931941d8ec5f375f7e51e719d43ae31af095f661
Signed-off-by: Giacomo Travaglini 
Reviewed-by: Nikos Nikoleris 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26643
Tested-by: kokoro 
---
M src/sim/power/power_model.hh
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Giacomo Travaglini: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/sim/power/power_model.hh b/src/sim/power/power_model.hh
index 36e0a3e..918b2d2 100644
--- a/src/sim/power/power_model.hh
+++ b/src/sim/power/power_model.hh
@@ -84,6 +84,8 @@
 }

 void regStats() {
+SimObject::regStats();
+
 dynamicPower
   .method(this, &PowerModelState::getDynamicPower)
   .name(params()->name + ".dynamic_power")
@@ -135,6 +137,8 @@
 double getStaticPower() const;

 void regStats() {
+SimObject::regStats();
+
 dynamicPower
   .method(this, &PowerModel::getDynamicPower)
   .name(params()->name + ".dynamic_power")

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26643
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I931941d8ec5f375f7e51e719d43ae31af095f661
Gerrit-Change-Number: 26643
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev