From 09ac21cd71f51fac692001ce782032b0b45f4d96 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Thu, 6 May 2021 10:23:21 -0700 Subject: [PATCH 01/19] util,arch-gcn3: Fixing gcn-gpu Dockerfile to v21-0 bucket Was previously pointing towards the "develop" bucket which is subject to change over time. Change-Id: I769d8ac5dc2348e5a6477d75d883cc2a3add7bd3 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45146 Maintainer: Bobby R. Bruce Reviewed-by: Matt Sinclair Tested-by: kokoro --- util/dockerfiles/gcn-gpu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/dockerfiles/gcn-gpu/Dockerfile b/util/dockerfiles/gcn-gpu/Dockerfile index e5683ab183..2f5d1b4900 100644 --- a/util/dockerfiles/gcn-gpu/Dockerfile +++ b/util/dockerfiles/gcn-gpu/Dockerfile @@ -52,7 +52,7 @@ RUN wget https://bootstrap.pypa.io/get-pip.py -qO get-pip.py RUN python3 get-pip.py RUN pip install -U setuptools scons==3.1.2 six -ARG gem5_dist=http://dist.gem5.org/dist/develop +ARG gem5_dist=http://dist.gem5.org/dist/v21-0 # Install ROCm 1.6 binaries RUN wget -qO- ${gem5_dist}/apt_1.6.4.tar.bz2 \ From a912482862c712e62a7c78370689f12e862dcbed Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 20 Apr 2021 22:16:17 -0700 Subject: [PATCH 02/19] python,misc: Fix develop resources URL to v21-0 This was incorrectly kept as `http://dist.gem5.org/dist/develop` in the v21.0.0 release of gem5. The `dist/develop` directory is used by the develop branch, not by gem5 releases. This change updates the URL to point towards the currect v21-0 branch, which will remain stable and contain resoruces always compatible with the v21-0 release. Change-Id: I5d9a9497cebffa91f08be253f1637e11e0d5e62c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44725 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- ext/testlib/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/testlib/configuration.py b/ext/testlib/configuration.py index 1fffab46ff..18bebdd946 100644 --- a/ext/testlib/configuration.py +++ b/ext/testlib/configuration.py @@ -213,7 +213,7 @@ def define_defaults(defaults): os.pardir, os.pardir)) defaults.result_path = os.path.join(os.getcwd(), 'testing-results') - defaults.resource_url = 'http://dist.gem5.org/dist/develop' + defaults.resource_url = 'http://dist.gem5.org/dist/v21-0' defaults.resource_path = os.path.abspath(os.path.join(defaults.base_dir, 'tests', 'gem5', From c284c025ddac12e559e20e86986955416372e1c0 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Wed, 7 Apr 2021 11:36:38 +0100 Subject: [PATCH 03/19] sim: Fix Temperature class * Adding __str__ method: To fix its printing on config.ini (Replacing with the Temperature value) * Replacing "fromKelvin" with from_kelvin (that's how pybind exports it) * Fixing config_value to allow JSON serialization (JIRA: https://gem5.atlassian.net/browse/GEM5-951) Change-Id: I1aaea9c9df6466a5cbed0a29c5937243796948d2 Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44167 Reviewed-by: Andreas Sandberg Reviewed-by: Jason Lowe-Power Maintainer: Andreas Sandberg Tested-by: kokoro (cherry picked from commit 6cb9c3e87fa8034122310613079ae4f058f93233) Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44745 Maintainer: Jason Lowe-Power --- src/python/m5/params.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/python/m5/params.py b/src/python/m5/params.py index d2366f66b2..78be6f683f 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -1705,12 +1705,15 @@ class Temperature(ParamValue): self.__init__(value) return value + def __str__(self): + return str(self.value) + def getValue(self): from _m5.core import Temperature - return Temperature.fromKelvin(self.value) + return Temperature.from_kelvin(self.value) def config_value(self): - return self + return self.value @classmethod def cxx_predecls(cls, code): From 419ebd724eeb4335e8e9be1a7e6f9e9d502a8f9a Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Thu, 27 May 2021 12:13:17 -0700 Subject: [PATCH 04/19] mem-ruby: replace desks, add desc where required Events in *.sm are required to have "desc" defined. JIRA: https://gem5.atlassian.net/browse/GEM5-999 Change-Id: I95f59c422bdd264a9e1077b75bf7a0e9f39685aa Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46119 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro (cherry picked from commit 5c34457a3839466367e6ccfd1abde2fa01062fe0) Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46179 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce --- .../ruby/protocol/MOESI_CMP_directory-dir.sm | 2 +- src/mem/ruby/protocol/chi/CHI-cache.sm | 196 +++++++++--------- src/mem/ruby/protocol/chi/CHI-mem.sm | 30 +-- 3 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/mem/ruby/protocol/MOESI_CMP_directory-dir.sm b/src/mem/ruby/protocol/MOESI_CMP_directory-dir.sm index 03010d53ac..3b4a8012c5 100644 --- a/src/mem/ruby/protocol/MOESI_CMP_directory-dir.sm +++ b/src/mem/ruby/protocol/MOESI_CMP_directory-dir.sm @@ -114,7 +114,7 @@ machine(MachineType:Directory, "Directory protocol") DMA_WRITE_PARTIAL, desc="DMA Write partial line"; DMA_ACK, desc="DMA Ack"; Data, desc="Data to directory"; - All_Acks, desk="All pending acks, unblocks, etc have been received"; + All_Acks, desc="All pending acks, unblocks, etc have been received"; } // TYPES diff --git a/src/mem/ruby/protocol/chi/CHI-cache.sm b/src/mem/ruby/protocol/chi/CHI-cache.sm index 160f674078..a0d188803f 100644 --- a/src/mem/ruby/protocol/chi/CHI-cache.sm +++ b/src/mem/ruby/protocol/chi/CHI-cache.sm @@ -206,7 +206,7 @@ machine(MachineType:Cache, "Cache coherency protocol") : state_declaration(State, default="Cache_State_null") { // Stable states - I, AccessPermission:Invalid, desk="Invalid / not present locally or upstream"; + I, AccessPermission:Invalid, desc="Invalid / not present locally or upstream"; // States when block is present in local cache only SC, AccessPermission:Read_Only, desc="Shared Clean"; @@ -216,21 +216,21 @@ machine(MachineType:Cache, "Cache coherency protocol") : UD_T, AccessPermission:Read_Write, desc="UD with use timeout"; // Invalid in local cache but present in upstream caches - RU, AccessPermission:Invalid, desk="Upstream requester has line in UD/UC"; - RSC, AccessPermission:Invalid, desk="Upstream requester has line in SC"; - RSD, AccessPermission:Invalid, desk="Upstream requester has line in SD and maybe SC"; - RUSC, AccessPermission:Invalid, desk="RSC + this node stills has exclusive access"; - RUSD, AccessPermission:Invalid, desk="RSD + this node stills has exclusive access"; + RU, AccessPermission:Invalid, desc="Upstream requester has line in UD/UC"; + RSC, AccessPermission:Invalid, desc="Upstream requester has line in SC"; + RSD, AccessPermission:Invalid, desc="Upstream requester has line in SD and maybe SC"; + RUSC, AccessPermission:Invalid, desc="RSC + this node stills has exclusive access"; + RUSD, AccessPermission:Invalid, desc="RSD + this node stills has exclusive access"; // Both in local and upstream caches. In some cases local maybe stale - SC_RSC, AccessPermission:Read_Only, desk="SC + RSC"; - SD_RSC, AccessPermission:Read_Only, desk="SD + RSC"; - SD_RSD, AccessPermission:Read_Only, desk="SD + RSD"; - UC_RSC, AccessPermission:Read_Write, desk="UC + RSC"; - UC_RU, AccessPermission:Invalid, desk="UC + RU"; - UD_RU, AccessPermission:Invalid, desk="UD + RU"; - UD_RSD, AccessPermission:Read_Write, desk="UD + RSD"; - UD_RSC, AccessPermission:Read_Write, desk="UD + RSC"; + SC_RSC, AccessPermission:Read_Only, desc="SC + RSC"; + SD_RSC, AccessPermission:Read_Only, desc="SD + RSC"; + SD_RSD, AccessPermission:Read_Only, desc="SD + RSD"; + UC_RSC, AccessPermission:Read_Write, desc="UC + RSC"; + UC_RU, AccessPermission:Invalid, desc="UC + RU"; + UD_RU, AccessPermission:Invalid, desc="UD + RU"; + UD_RSD, AccessPermission:Read_Write, desc="UD + RSD"; + UD_RSC, AccessPermission:Read_Write, desc="UD + RSC"; // Generic transient state // There is only a transient "BUSY" state. The actions taken at this state @@ -261,90 +261,90 @@ machine(MachineType:Cache, "Cache coherency protocol") : // Events triggered by sequencer requests or snoops in the rdy queue // See CHIRequestType in CHi-msg.sm for descriptions - Load; - Store; - Prefetch; - ReadShared; - ReadNotSharedDirty; - ReadUnique; - ReadUnique_PoC; - ReadOnce; - CleanUnique; - Evict; - WriteBackFull; - WriteEvictFull; - WriteCleanFull; - WriteUnique; - WriteUniquePtl_PoC; - WriteUniqueFull_PoC; - WriteUniqueFull_PoC_Alloc; - SnpCleanInvalid; - SnpShared; - SnpSharedFwd; - SnpNotSharedDirtyFwd; - SnpUnique; - SnpUniqueFwd; - SnpOnce; - SnpOnceFwd; - SnpStalled; // A snoop stall triggered from the inport + Load, desc=""; + Store, desc=""; + Prefetch, desc=""; + ReadShared, desc=""; + ReadNotSharedDirty, desc=""; + ReadUnique, desc=""; + ReadUnique_PoC, desc=""; + ReadOnce, desc=""; + CleanUnique, desc=""; + Evict, desc=""; + WriteBackFull, desc=""; + WriteEvictFull, desc=""; + WriteCleanFull, desc=""; + WriteUnique, desc=""; + WriteUniquePtl_PoC, desc=""; + WriteUniqueFull_PoC, desc=""; + WriteUniqueFull_PoC_Alloc, desc=""; + SnpCleanInvalid, desc=""; + SnpShared, desc=""; + SnpSharedFwd, desc=""; + SnpNotSharedDirtyFwd, desc=""; + SnpUnique, desc=""; + SnpUniqueFwd, desc=""; + SnpOnce, desc=""; + SnpOnceFwd, desc=""; + SnpStalled, desc=""; // A snoop stall triggered from the inport // Events triggered by incoming response messages // See CHIResponseType in CHi-msg.sm for descriptions - CompAck; - Comp_I; - Comp_UC; - Comp_SC; - CompDBIDResp; - DBIDResp; - Comp; - ReadReceipt; - RespSepData; - SnpResp_I; - SnpResp_I_Fwded_UC; - SnpResp_I_Fwded_UD_PD; - SnpResp_SC; - SnpResp_SC_Fwded_SC; - SnpResp_SC_Fwded_SD_PD; - SnpResp_UC_Fwded_I; - SnpResp_UD_Fwded_I; - SnpResp_SC_Fwded_I; - SnpResp_SD_Fwded_I; - RetryAck; - RetryAck_PoC; - PCrdGrant; - PCrdGrant_PoC; - RetryAck_Hazard; - RetryAck_PoC_Hazard; - PCrdGrant_Hazard; - PCrdGrant_PoC_Hazard; + CompAck, desc=""; + Comp_I, desc=""; + Comp_UC, desc=""; + Comp_SC, desc=""; + CompDBIDResp, desc=""; + DBIDResp, desc=""; + Comp, desc=""; + ReadReceipt, desc=""; + RespSepData, desc=""; + SnpResp_I, desc=""; + SnpResp_I_Fwded_UC, desc=""; + SnpResp_I_Fwded_UD_PD, desc=""; + SnpResp_SC, desc=""; + SnpResp_SC_Fwded_SC, desc=""; + SnpResp_SC_Fwded_SD_PD, desc=""; + SnpResp_UC_Fwded_I, desc=""; + SnpResp_UD_Fwded_I, desc=""; + SnpResp_SC_Fwded_I, desc=""; + SnpResp_SD_Fwded_I, desc=""; + RetryAck, desc=""; + RetryAck_PoC, desc=""; + PCrdGrant, desc=""; + PCrdGrant_PoC, desc=""; + RetryAck_Hazard, desc=""; + RetryAck_PoC_Hazard, desc=""; + PCrdGrant_Hazard, desc=""; + PCrdGrant_PoC_Hazard, desc=""; // Events triggered by incoming data response messages // See CHIDataType in CHi-msg.sm for descriptions - CompData_I; - CompData_UC; - CompData_SC; - CompData_UD_PD; - CompData_SD_PD; - DataSepResp_UC; - CBWrData_I; - CBWrData_UC; - CBWrData_SC; - CBWrData_UD_PD; - CBWrData_SD_PD; - NCBWrData; - SnpRespData_I; - SnpRespData_I_PD; - SnpRespData_SC; - SnpRespData_SC_PD; - SnpRespData_SD; - SnpRespData_UC; - SnpRespData_UD; - SnpRespData_SC_Fwded_SC; - SnpRespData_SC_Fwded_SD_PD; - SnpRespData_SC_PD_Fwded_SC; - SnpRespData_I_Fwded_SD_PD; - SnpRespData_I_PD_Fwded_SC; - SnpRespData_I_Fwded_SC; + CompData_I, desc=""; + CompData_UC, desc=""; + CompData_SC, desc=""; + CompData_UD_PD, desc=""; + CompData_SD_PD, desc=""; + DataSepResp_UC, desc=""; + CBWrData_I, desc=""; + CBWrData_UC, desc=""; + CBWrData_SC, desc=""; + CBWrData_UD_PD, desc=""; + CBWrData_SD_PD, desc=""; + NCBWrData, desc=""; + SnpRespData_I, desc=""; + SnpRespData_I_PD, desc=""; + SnpRespData_SC, desc=""; + SnpRespData_SC_PD, desc=""; + SnpRespData_SD, desc=""; + SnpRespData_UC, desc=""; + SnpRespData_UD, desc=""; + SnpRespData_SC_Fwded_SC, desc=""; + SnpRespData_SC_Fwded_SD_PD, desc=""; + SnpRespData_SC_PD_Fwded_SC, desc=""; + SnpRespData_I_Fwded_SD_PD, desc=""; + SnpRespData_I_PD_Fwded_SC, desc=""; + SnpRespData_I_Fwded_SC, desc=""; // We use special events for requests that we detect to be stale. This is // done for debugging only. We sent a stale response so the requester can @@ -352,10 +352,10 @@ machine(MachineType:Cache, "Cache coherency protocol") : // A Write or Evict becomes stale when the requester receives a snoop that // changes the state of the data while the request was pending. // Actual CHI implementations don't have this check. - Evict_Stale; - WriteBackFull_Stale; - WriteEvictFull_Stale; - WriteCleanFull_Stale; + Evict_Stale, desc=""; + WriteBackFull_Stale, desc=""; + WriteEvictFull_Stale, desc=""; + WriteCleanFull_Stale, desc=""; // Cache fill handling CheckCacheFill, desc="Check if need to write or update the cache and trigger any necessary allocation and evictions"; @@ -474,9 +474,9 @@ machine(MachineType:Cache, "Cache coherency protocol") : // any queued action and is not expecting responses/data. The transaction // is finalized and the next stable state is stored in the cache/directory // See the processNextState and makeFinalState functions - Final; + Final, desc=""; - null; + null, desc=""; } //////////////////////////////////////////////////////////////////////////// diff --git a/src/mem/ruby/protocol/chi/CHI-mem.sm b/src/mem/ruby/protocol/chi/CHI-mem.sm index 954a449517..355027ad07 100644 --- a/src/mem/ruby/protocol/chi/CHI-mem.sm +++ b/src/mem/ruby/protocol/chi/CHI-mem.sm @@ -80,7 +80,7 @@ machine(MachineType:Memory, "Memory controller interface") : state_declaration(State, desc="Transaction states", default="Memory_State_READY") { // We don't know if the line is cached, so the memory copy is maybe stable - READY, AccessPermission:Backing_Store, desk="Ready to transfer the line"; + READY, AccessPermission:Backing_Store, desc="Ready to transfer the line"; WAITING_NET_DATA, AccessPermission:Backing_Store_Busy, desc="Waiting data from the network"; SENDING_NET_DATA, AccessPermission:Backing_Store_Busy, desc="Sending data to the network"; @@ -97,28 +97,28 @@ machine(MachineType:Memory, "Memory controller interface") : enumeration(Event, desc="Memory events") { // Checks if a request can allocate a TBE be moved to reqRdy - CheckAllocTBE; - CheckAllocTBE_WithCredit; + CheckAllocTBE, desc=""; + CheckAllocTBE_WithCredit, desc=""; // Requests - WriteNoSnpPtl; - WriteNoSnp; - ReadNoSnp; - ReadNoSnpSep; + WriteNoSnpPtl, desc=""; + WriteNoSnp, desc=""; + ReadNoSnp, desc=""; + ReadNoSnpSep, desc=""; // Data - WriteData; + WriteData, desc=""; // Memory side - MemoryData; - MemoryAck; + MemoryData, desc=""; + MemoryAck, desc=""; // Internal event triggers - Trigger_Send; - Trigger_SendDone; - Trigger_ReceiveDone; - Trigger_SendRetry; - Trigger_SendPCrdGrant; + Trigger_Send, desc=""; + Trigger_SendDone, desc=""; + Trigger_ReceiveDone, desc=""; + Trigger_SendRetry, desc=""; + Trigger_SendPCrdGrant, desc=""; } From 356b4dc476adfe2b33ed0a88a98705b7855aa596 Mon Sep 17 00:00:00 2001 From: Jason Lowe-Power Date: Fri, 11 Jun 2021 09:55:03 -0700 Subject: [PATCH 05/19] scons,python: revert Always generate default create() methods. This reverts commit 7bb690c1ee70b1c82b23eeb68dcda3dc6e5c97f7. Change-Id: If1b44162b24409fb44daec0159852fa44937184d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46879 Maintainer: Bobby R. Bruce Tested-by: kokoro Reviewed-by: Bobby R. Bruce --- src/SConscript | 21 +----- src/python/m5/SimObject.py | 145 ++++++++++++++++++------------------- 2 files changed, 72 insertions(+), 94 deletions(-) diff --git a/src/SConscript b/src/SConscript index 31fce0c6bf..5fe0ab2c25 100644 --- a/src/SConscript +++ b/src/SConscript @@ -917,7 +917,7 @@ PySource('m5', 'python/m5/info.py') # Create all of the SimObject param headers and enum headers # -def createSimObjectParamDecl(target, source, env): +def createSimObjectParamStruct(target, source, env): assert len(target) == 1 and len(source) == 1 name = source[0].get_text_contents() @@ -927,16 +927,6 @@ def createSimObjectParamDecl(target, source, env): obj.cxx_param_decl(code) code.write(target[0].abspath) -def createSimObjectParamDef(target, source, env): - assert len(target) == 1 and len(source) == 1 - - name = source[0].get_text_contents() - obj = sim_objects[name] - - code = code_formatter() - obj.cxx_param_def(code) - code.write(target[0].abspath) - def createSimObjectCxxConfig(is_header): def body(target, source, env): assert len(target) == 1 and len(source) == 1 @@ -997,16 +987,9 @@ for name,simobj in sorted(sim_objects.items()): hh_file = File('params/%s.hh' % name) params_hh_files.append(hh_file) env.Command(hh_file, Value(name), - MakeAction(createSimObjectParamDecl, Transform("SOPARMHH"))) + MakeAction(createSimObjectParamStruct, Transform("SO PARAM"))) env.Depends(hh_file, depends + extra_deps) - if not getattr(simobj, 'abstract', False) and hasattr(simobj, 'type'): - cc_file = File('params/%s.cc' % name) - env.Command(cc_file, Value(name), - MakeAction(createSimObjectParamDef, Transform("SOPARMCC"))) - env.Depends(cc_file, depends + extra_deps) - Source(cc_file) - # C++ parameter description files if GetOption('with_cxx_config'): for name,simobj in sorted(sim_objects.items()): diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index bdce718172..71b39d0a1f 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -368,7 +368,7 @@ def createCxxConfigDirectoryEntryFile(code, name, simobj, is_header): if not is_header: code('{') - if getattr(simobj, 'abstract', False): + if hasattr(simobj, 'abstract') and simobj.abstract: code(' return NULL;') else: code(' return this->create();') @@ -700,80 +700,6 @@ class MetaSimObject(type): def pybind_predecls(cls, code): code('#include "${{cls.cxx_header}}"') - def cxx_param_def(cls, code): - code(''' -#include - -#include "base/compiler.hh" - -#include "${{cls.cxx_header}}" -#include "params/${cls}.hh" - -''') - code() - code('namespace') - code('{') - code() - # If we can't define a default create() method for this params struct - # because the SimObject doesn't have the right constructor, use - # template magic to make it so we're actually defining a create method - # for this class instead. - code('class Dummy${cls}ParamsClass') - code('{') - code(' public:') - code(' ${{cls.cxx_class}} *create() const;') - code('};') - code() - code('template ') - code('class Dummy${cls}Shunt;') - code() - # This version directs to the real Params struct and the default - # behavior of create if there's an appropriate constructor. - code('template ') - code('class Dummy${cls}Shunt::value>>') - code('{') - code(' public:') - code(' using Params = ${cls}Params;') - code(' static ${{cls.cxx_class}} *') - code(' create(const Params &p)') - code(' {') - code(' return new CxxClass(p);') - code(' }') - code('};') - code() - # This version diverts to the DummyParamsClass and a dummy - # implementation of create if the appropriate constructor does not - # exist. - code('template ') - code('class Dummy${cls}Shunt::value>>') - code('{') - code(' public:') - code(' using Params = Dummy${cls}ParamsClass;') - code(' static ${{cls.cxx_class}} *') - code(' create(const Params &p)') - code(' {') - code(' return nullptr;') - code(' }') - code('};') - code() - code('} // anonymous namespace') - code() - # An implementation of either the real Params struct's create - # method, or the Dummy one. Either an implementation is - # mandantory since this was shunted off to the dummy class, or - # one is optional which will override this weak version. - code('M5_VAR_USED ${{cls.cxx_class}} *') - code('Dummy${cls}Shunt<${{cls.cxx_class}}>::Params::create() const') - code('{') - code(' return Dummy${cls}Shunt<${{cls.cxx_class}}>::') - code(' create(*this);') - code('}') - - def pybind_decl(cls, code): py_class_name = cls.pybind_class @@ -787,6 +713,9 @@ class MetaSimObject(type): code('''#include "pybind11/pybind11.h" #include "pybind11/stl.h" +#include + +#include "base/compiler.hh" #include "params/$cls.hh" #include "python/pybind11/core.hh" #include "sim/init.hh" @@ -868,6 +797,72 @@ module_init(py::module_ &m_internal) code() code('static EmbeddedPyBind embed_obj("${0}", module_init, "${1}");', cls, cls._base.type if cls._base else "") + if not hasattr(cls, 'abstract') or not cls.abstract: + if 'type' in cls.__dict__: + code() + code('namespace') + code('{') + code() + # If we can't define a default create() method for this params + # struct because the SimObject doesn't have the right + # constructor, use template magic to make it so we're actually + # defining a create method for this class instead. + code('class Dummy${cls}ParamsClass') + code('{') + code(' public:') + code(' ${{cls.cxx_class}} *create() const;') + code('};') + code() + code('template ') + code('class Dummy${cls}Shunt;') + code() + # This version directs to the real Params struct and the + # default behavior of create if there's an appropriate + # constructor. + code('template ') + code('class Dummy${cls}Shunt::value>>') + code('{') + code(' public:') + code(' using Params = ${cls}Params;') + code(' static ${{cls.cxx_class}} *') + code(' create(const Params &p)') + code(' {') + code(' return new CxxClass(p);') + code(' }') + code('};') + code() + # This version diverts to the DummyParamsClass and a dummy + # implementation of create if the appropriate constructor does + # not exist. + code('template ') + code('class Dummy${cls}Shunt::value>>') + code('{') + code(' public:') + code(' using Params = Dummy${cls}ParamsClass;') + code(' static ${{cls.cxx_class}} *') + code(' create(const Params &p)') + code(' {') + code(' return nullptr;') + code(' }') + code('};') + code() + code('} // anonymous namespace') + code() + # An implementation of either the real Params struct's create + # method, or the Dummy one. Either an implementation is + # mandantory since this was shunted off to the dummy class, or + # one is optional which will override this weak version. + code('M5_VAR_USED ${{cls.cxx_class}} *') + code('Dummy${cls}Shunt<${{cls.cxx_class}}>::Params::create() ' + 'const') + code('{') + code(' return Dummy${cls}Shunt<${{cls.cxx_class}}>::') + code(' create(*this);') + code('}') _warned_about_nested_templates = False From 935819c37bd7ffe99a10671ab4a14174ebd1c487 Mon Sep 17 00:00:00 2001 From: Jason Lowe-Power Date: Fri, 11 Jun 2021 09:44:15 -0700 Subject: [PATCH 06/19] python,scons: Only generate pybind if using python This reimplements the previously reverted change: Always generate default create() methods. The pybind code should only be generated when python is enabled. This change passes whether python is enabled into the SimObject code creation method. Then, the params code is optionally included. Note: Due to some problems in GCC's linker (or something else...) we need to have a single file with all of the generated code for the SimObject. Change-Id: I0f93b3d787d47f26db2de6c4447730f7df87a0dc Issue-on: https://gem5.atlassian.net/browse/GEM5-1003 Signed-off-by: Jason Lowe-Power Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46880 Maintainer: Bobby R. Bruce Tested-by: kokoro Reviewed-by: Bobby R. Bruce --- src/SConscript | 29 ++++---- src/python/m5/SimObject.py | 144 +++++++++++++++++++++---------------- 2 files changed, 97 insertions(+), 76 deletions(-) diff --git a/src/SConscript b/src/SConscript index 5fe0ab2c25..1ff6a0791f 100644 --- a/src/SConscript +++ b/src/SConscript @@ -962,12 +962,16 @@ def createEnumDecls(target, source, env): obj.cxx_decl(code) code.write(target[0].abspath) -def createSimObjectPyBindWrapper(target, source, env): +def createSimObjectWrappers(target, source, env): name = source[0].get_text_contents() obj = sim_objects[name] code = code_formatter() - obj.pybind_decl(code) + # We want to generate a single .cc file which contains most of the + # SimObject autogenerated code to reduce the number of files to compile and + # link. We need to pass in whether python is enabled so that the pybind + # wrappers are only generated when python is enabled + obj.params_create_decl(code, env['USE_PYTHON']) code.write(target[0].abspath) # Generate all of the SimObject param C++ struct header files @@ -1061,17 +1065,16 @@ for name,enum in sorted(all_enums.items()): MakeAction(createEnumDecls, Transform("ENUMDECL"))) env.Depends(hh_file, depends + extra_deps) -# Generate SimObject Python bindings wrapper files -if env['USE_PYTHON']: - for name,simobj in sorted(sim_objects.items()): - py_source = PySource.modules[simobj.__module__] - extra_deps = [ py_source.tnode ] - cc_file = File('python/_m5/param_%s.cc' % name) - env.Command(cc_file, Value(name), - MakeAction(createSimObjectPyBindWrapper, - Transform("SO PyBind"))) - env.Depends(cc_file, depends + extra_deps) - Source(cc_file) +# Generate SimObject Python bindings and create method wrapper files +for name,simobj in sorted(sim_objects.items()): + py_source = PySource.modules[simobj.__module__] + extra_deps = [ py_source.tnode ] + cc_file = File('python/_m5/param_%s.cc' % name) + env.Command(cc_file, Value(name), + MakeAction(createSimObjectWrappers, + Transform("SO PyB/C"))) + env.Depends(cc_file, depends + extra_deps) + Source(cc_file) # # Handle debug flags diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index 71b39d0a1f..e2f5d5856f 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -700,17 +700,21 @@ class MetaSimObject(type): def pybind_predecls(cls, code): code('#include "${{cls.cxx_header}}"') - def pybind_decl(cls, code): + def params_create_decl(cls, code, python_enabled): py_class_name = cls.pybind_class # The 'local' attribute restricts us to the params declared in # the object itself, not including inherited params (which # will also be inherited from the base class's param struct # here). Sort the params based on their key - params = list(map(lambda k_v: k_v[1], sorted(cls._params.local.items()))) + params = list(map(lambda k_v: k_v[1], + sorted(cls._params.local.items()))) ports = cls._ports.local - code('''#include "pybind11/pybind11.h" + # only include pybind if python is enabled in the build + if python_enabled: + + code('''#include "pybind11/pybind11.h" #include "pybind11/stl.h" #include @@ -724,79 +728,93 @@ class MetaSimObject(type): #include "${{cls.cxx_header}}" ''') + else: + code(''' +#include - for param in params: - param.pybind_predecls(code) +#include "base/compiler.hh" +#include "params/$cls.hh" - code('''namespace py = pybind11; +#include "${{cls.cxx_header}}" + +''') + # only include the python params code if python is enabled. + if python_enabled: + for param in params: + param.pybind_predecls(code) + + code('''namespace py = pybind11; static void module_init(py::module_ &m_internal) { py::module_ m = m_internal.def_submodule("param_${cls}"); ''') - code.indent() - if cls._base: - code('py::class_<${cls}Params, ${{cls._base.type}}Params, ' \ - 'std::unique_ptr<${{cls}}Params, py::nodelete>>(' \ - 'm, "${cls}Params")') - else: - code('py::class_<${cls}Params, ' \ - 'std::unique_ptr<${cls}Params, py::nodelete>>(' \ - 'm, "${cls}Params")') + code.indent() + if cls._base: + code('py::class_<${cls}Params, ${{cls._base.type}}Params, ' \ + 'std::unique_ptr<${{cls}}Params, py::nodelete>>(' \ + 'm, "${cls}Params")') + else: + code('py::class_<${cls}Params, ' \ + 'std::unique_ptr<${cls}Params, py::nodelete>>(' \ + 'm, "${cls}Params")') - code.indent() - if not hasattr(cls, 'abstract') or not cls.abstract: - code('.def(py::init<>())') - code('.def("create", &${cls}Params::create)') + code.indent() + if not hasattr(cls, 'abstract') or not cls.abstract: + code('.def(py::init<>())') + code('.def("create", &${cls}Params::create)') - param_exports = cls.cxx_param_exports + [ - PyBindProperty(k) - for k, v in sorted(cls._params.local.items()) - ] + [ - PyBindProperty("port_%s_connection_count" % port.name) - for port in ports.values() - ] - for exp in param_exports: - exp.export(code, "%sParams" % cls) + param_exports = cls.cxx_param_exports + [ + PyBindProperty(k) + for k, v in sorted(cls._params.local.items()) + ] + [ + PyBindProperty("port_%s_connection_count" % port.name) + for port in ports.values() + ] + for exp in param_exports: + exp.export(code, "%sParams" % cls) - code(';') - code() - code.dedent() + code(';') + code() + code.dedent() - bases = [] - if 'cxx_base' in cls._value_dict: - # If the c++ base class implied by python inheritance was - # overridden, use that value. - if cls.cxx_base: - bases.append(cls.cxx_base) - elif cls._base: - # If not and if there was a SimObject base, use its c++ class - # as this class' base. - bases.append(cls._base.cxx_class) - # Add in any extra bases that were requested. - bases.extend(cls.cxx_extra_bases) + bases = [] + if 'cxx_base' in cls._value_dict: + # If the c++ base class implied by python inheritance was + # overridden, use that value. + if cls.cxx_base: + bases.append(cls.cxx_base) + elif cls._base: + # If not and if there was a SimObject base, use its c++ class + # as this class' base. + bases.append(cls._base.cxx_class) + # Add in any extra bases that were requested. + bases.extend(cls.cxx_extra_bases) - if bases: - base_str = ", ".join(bases) - code('py::class_<${{cls.cxx_class}}, ${base_str}, ' \ - 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ - 'm, "${py_class_name}")') - else: - code('py::class_<${{cls.cxx_class}}, ' \ - 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ - 'm, "${py_class_name}")') - code.indent() - for exp in cls.cxx_exports: - exp.export(code, cls.cxx_class) - code(';') - code.dedent() - code() - code.dedent() - code('}') - code() - code('static EmbeddedPyBind embed_obj("${0}", module_init, "${1}");', - cls, cls._base.type if cls._base else "") + if bases: + base_str = ", ".join(bases) + code('py::class_<${{cls.cxx_class}}, ${base_str}, ' \ + 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ + 'm, "${py_class_name}")') + else: + code('py::class_<${{cls.cxx_class}}, ' \ + 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ + 'm, "${py_class_name}")') + code.indent() + for exp in cls.cxx_exports: + exp.export(code, cls.cxx_class) + code(';') + code.dedent() + code() + code.dedent() + code('}') + code() + code('static EmbeddedPyBind ' + 'embed_obj("${0}", module_init, "${1}");', + cls, cls._base.type if cls._base else "") + + # include the create() methods whether or not python is enabled. if not hasattr(cls, 'abstract') or not cls.abstract: if 'type' in cls.__dict__: code() From 5b07a0787b0e62c0efe9a9d60cfd47fb47dbc188 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 27 Apr 2021 11:51:27 -0700 Subject: [PATCH 07/19] scons: Reverts LTO for opt, perf and prof builds. This reverts https://gem5-review.googlesource.com/c/public/gem5/+/40815 and adds the `--with-lto` to enable LTO; and removes `--no-lto`. Change-Id: I7dbd2b555570c90c98f38c7c02eb052571f7b6bd Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44886 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45839 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce --- SConstruct | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index bcfd58f2ae..da74803403 100755 --- a/SConstruct +++ b/SConstruct @@ -108,8 +108,8 @@ AddOption('--ignore-style', action='store_true', AddOption('--gold-linker', action='store_true', help='Use the gold linker') AddOption('--no-compress-debug', action='store_true', help="Don't compress debug info in build files") -AddOption('--no-lto', action='store_true', - help='Disable Link-Time Optimization for fast') +AddOption('--with-lto', action='store_true', + help='Enable Link-Time Optimization') AddOption('--verbose', action='store_true', help='Print full tool command lines') AddOption('--without-python', action='store_true', @@ -341,9 +341,9 @@ if main['GCC']: error('gcc version 5 or newer required.\n' 'Installed version:', main['CXXVERSION']) - # Add the appropriate Link-Time Optimization (LTO) flags - # unless LTO is explicitly turned off. - if not GetOption('no_lto'): + # Add the appropriate Link-Time Optimization (LTO) flags if `--with-lto` is + # set. + if GetOption('with_lto'): # g++ uses "make" to parallelize LTO. The program can be overriden with # the environment variable "MAKE", but we currently make no attempt to # plumb that variable through. @@ -371,6 +371,11 @@ elif main['CLANG']: error('clang version 3.9 or newer required.\n' 'Installed version:', main['CXXVERSION']) + # Set the Link-Time Optimization (LTO) flags if enabled. + if GetOption('with_lto'): + for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS': + main[var] = ['-flto'] + # clang has a few additional warnings that we disable, extraneous # parantheses are allowed due to Ruby's printing of the AST, # finally self assignments are allowed as the generated CPU code From 53da68d6611f16b73619cdeec2a4f6903cc43bb3 Mon Sep 17 00:00:00 2001 From: Yu-hsin Wang Date: Mon, 12 Apr 2021 15:01:35 +0800 Subject: [PATCH 08/19] systemc: Eliminate ClockTick duplicated name warning In systemc, a module name is consist of hierarchy names with dot separated. The basename is the last part of the module name. Because lack of hierarchy information, it's a chance that the basename is duplicated. Although, ClockTick is using sc_gen_unique_name to solve this, the warning from sc_gen_unique_name is annoying. To solve this completely, we should use the full module name to construct the name of ClockTick. Change-Id: Ie664fe4757a05f72860be49c3a9d1172f824eb2e Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44425 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45821 --- src/systemc/channel/sc_clock.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/channel/sc_clock.cc b/src/systemc/channel/sc_clock.cc index 137a7a11ec..bf48b828ce 100644 --- a/src/systemc/channel/sc_clock.cc +++ b/src/systemc/channel/sc_clock.cc @@ -54,7 +54,7 @@ class ClockTick : public ScEvent ClockTick(::sc_core::sc_clock *clock, bool to, ::sc_core::sc_time _period) : ScEvent([this]() { tick(); }), - _period(_period), name(clock->basename()), p(nullptr), + _period(_period), name(clock->name()), p(nullptr), funcWrapper(clock, to ? &::sc_core::sc_clock::tickUp : &::sc_core::sc_clock::tickDown) { From 20e2c8da22a0eeea69bcb39c050bfeaa320d428f Mon Sep 17 00:00:00 2001 From: Yu-hsin Wang Date: Mon, 12 Apr 2021 16:32:02 +0800 Subject: [PATCH 09/19] systemc: Fix verify.py and make it python 3 compatible 1. The logger behavior change breaks verify.py. commit 8deb205ea10d6cee0b58c46e097be46c784ed345 Author: Daniel Carvalho Date: Wed Mar 3 16:49:05 2021 -0300 base: Add LOC to Loggers Printing the line and the file that triggered a log is useful for debugging. Change-Id: I74e0637b2943049134bd3e9a4bc6cab3766591a9 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42141 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro 2. Use bytes diff in LogChecker. In Python3, string is required to be in a certain encoding, while in Python2, it is not. In the testcase, misc/cae_test/general/bitwise/or/datatypes, it contains some invalid codepoint of utf-8, we need diff the log with bytes in Pyhton3. 3. Python3 compatible. * dict.iteritems -> dict.items * remove object base class * use `except as` when catching exceptions * handle map and filter behavior change Test with src/systemc/tests/verify.py --update-json build/ARM -j `nproc` \ --filter-file src/systemc/tests/working.filt src/systemc/tests/verify.py --update-json build/ARM -j `nproc` \ --filter-file src/systemc/tests/working.filt --phase verify --result-file Change-Id: Ibf5b99d08a948387cf6162c476c294c49a7dac0f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44465 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45822 --- src/systemc/tests/verify.py | 77 ++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 6b4cf5ce70..95812f48a4 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # # Copyright 2018 Google, Inc. # @@ -58,14 +58,14 @@ def scons(*args): -class Test(object): +class Test(): def __init__(self, target, suffix, build_dir, props): self.target = target self.suffix = suffix self.build_dir = build_dir self.props = {} - for key, val in props.iteritems(): + for key, val in props.items(): self.set_prop(key, val) def set_prop(self, key, val): @@ -107,7 +107,7 @@ class TestPhaseMeta(type): super(TestPhaseMeta, cls).__init__(name, bases, d) -class TestPhaseBase(object, metaclass=TestPhaseMeta): +class TestPhaseBase(metaclass=TestPhaseMeta): abstract = True def __init__(self, main_args, *args): @@ -169,7 +169,7 @@ class RunPhase(TestPhaseBase): os.makedirs(test.m5out_dir()) try: subprocess.check_call(cmd, cwd=os.path.dirname(test.dir())) - except subprocess.CalledProcessError, error: + except subprocess.CalledProcessError as error: returncode = error.returncode else: returncode = 0 @@ -180,14 +180,14 @@ class RunPhase(TestPhaseBase): runnable = filter(lambda t: not t.compile_only, tests) if j == 1: - map(run_test, runnable) + list(map(run_test, runnable)) else: tp = multiprocessing.pool.ThreadPool(j) - map(lambda t: tp.apply_async(run_test, (t,)), runnable) + list(map(lambda t: tp.apply_async(run_test, (t,)), runnable)) tp.close() tp.join() -class Checker(object): +class Checker(): def __init__(self, ref, test, tag): self.ref = ref self.test = test @@ -215,6 +215,13 @@ class DiffingChecker(Checker): super(DiffingChecker, self).__init__(ref, test, tag) self.out_dir = out_dir + def is_bytes_mode(self): + return False + + def do_diff(self, ref_lines, test_lines, ref_file, test_file): + return difflib.unified_diff(ref_lines, test_lines, + fromfile=ref_file, tofile=test_file) + def diffing_check(self, ref_lines, test_lines): test_file = os.path.basename(self.test) ref_file = os.path.basename(self.ref) @@ -222,11 +229,10 @@ class DiffingChecker(Checker): diff_file = '.'.join([ref_file, 'diff']) diff_path = os.path.join(self.out_dir, diff_file) if test_lines != ref_lines: - with open(diff_path, 'w') as diff_f: - for line in difflib.unified_diff( - ref_lines, test_lines, - fromfile=ref_file, - tofile=test_file): + flag = 'wb' if self.is_bytes_mode() else 'w' + with open(diff_file, flag) as diff_f: + for line in self.do_diff(ref_lines, test_lines, + ref_file, test_file): diff_f.write(line) return False else: @@ -238,7 +244,17 @@ class LogChecker(DiffingChecker): def merge_filts(*filts): filts = map(lambda f: '(' + f + ')', filts) filts = '|'.join(filts) - return re.compile(filts, flags=re.MULTILINE) + return re.compile(filts.encode('utf-8'), flags=re.MULTILINE) + + def is_bytes_mode(self): + return True + + def do_diff(self, ref_lines, test_lines, ref_file, test_file): + return difflib.diff_bytes( + difflib.unified_diff, + ref_lines, test_lines, + fromfile=ref_file.encode('utf-8'), + tofile=test_file.encode('utf-8')) # The reporting mechanism will print the actual filename when running in # gem5, and the "golden" output will say "". We want @@ -259,8 +275,9 @@ class LogChecker(DiffingChecker): in_file_filt, ) test_filt = merge_filts( + r'^/.*:\d+: ', r'^Global frequency set at \d* ticks per second\n', - r'^info: Entering event queue @ \d*\. Starting simulation\.\.\.\n', + r'info: Entering event queue @ \d*\. Starting simulation\.\.\.\n', r'warn: Ignoring request to set stack size\.\n', r'^warn: No dot file generated. Please install pydot ' + r'to generate the dot file and pdf.\n', @@ -269,12 +286,12 @@ class LogChecker(DiffingChecker): ) def apply_filters(self, data, filts): - re.sub(filt, '', data) + re.sub(filt, b'', data) def check(self): - with open(self.test) as test_f, open(self.ref) as ref_f: - test = re.sub(self.test_filt, '', test_f.read()) - ref = re.sub(self.ref_filt, '', ref_f.read()) + with open(self.test, 'rb') as test_f, open(self.ref, 'rb') as ref_f: + test = re.sub(self.test_filt, b'', test_f.read()) + ref = re.sub(self.ref_filt, b'', ref_f.read()) return self.diffing_check(ref.splitlines(True), test.splitlines(True)) @@ -289,7 +306,7 @@ class VcdChecker(DiffingChecker): return self.diffing_check(ref, test) -class GoldenDir(object): +class GoldenDir(): def __init__(self, path, platform): self.path = path self.platform = platform @@ -301,7 +318,7 @@ class GoldenDir(object): common = filter(lambda t: not t.startswith(tuple(bases)), contents) self.entries = {} - class Entry(object): + class Entry(): def __init__(self, e_path): self.used = False self.path = os.path.join(path, e_path) @@ -330,7 +347,7 @@ class GoldenDir(object): def unused(self): items = self.entries.items() - items = filter(lambda i: not i[1].used, items) + items = list(filter(lambda i: not i[1].used, items)) items.sort() sources = [] @@ -367,10 +384,10 @@ class VerifyPhase(TestPhaseBase): def write_result_file(self, path): results = { - 'passed': map(lambda t: t.props, self._passed), + 'passed': list(map(lambda t: t.props, self._passed)), 'failed': { - cause: map(lambda t: t.props, tests) for - cause, tests in self._failed.iteritems() + cause: list(map(lambda t: t.props, tests)) + for cause, tests in self._failed.items() } } with open(path, 'w') as rf: @@ -472,7 +489,7 @@ class VerifyPhase(TestPhaseBase): self.failed(test, 'missing output', ' '.join(missing)) continue - failed_diffs = filter(lambda d: not d.check(), diffs) + failed_diffs = list(filter(lambda d: not d.check(), diffs)) if failed_diffs: tags = map(lambda d: d.tag, failed_diffs) self.failed(test, 'failed diffs', ' '.join(tags)) @@ -568,7 +585,7 @@ with open(json_path) as f: filtered_tests = { target: props for (target, props) in - test_data.iteritems() if eval(filt, dict(props)) + test_data.items() if eval(filt, dict(props)) } if len(filtered_tests) == 0: @@ -576,15 +593,15 @@ with open(json_path) as f: exit() if main_args.list: - for target, props in sorted(filtered_tests.iteritems()): + for target, props in sorted(filtered_tests.items()): print('%s.%s' % (target, main_args.flavor)) - for key, val in props.iteritems(): + for key, val in props.items(): print(' %s: %s' % (key, val)) print('Total tests: %d' % len(filtered_tests)) else: tests_to_run = list([ Test(target, main_args.flavor, main_args.build_dir, props) for - target, props in sorted(filtered_tests.iteritems()) + target, props in sorted(filtered_tests.items()) ]) for phase in phases: From 7be718a6ef4e9201990e813b5a7fa7965be295a1 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Wed, 14 Apr 2021 10:06:23 +0100 Subject: [PATCH 10/19] dev: Fix GCN3_X86 builds on aarch64 host Signed-off-by: Giacomo Travaglini Change-Id: Ic826f0cb46e07b9b5135eee1e518bc13f3d978a1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44485 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45823 --- src/dev/hsa/hsa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dev/hsa/hsa.h b/src/dev/hsa/hsa.h index f7d15ba7e5..1c1f34083e 100644 --- a/src/dev/hsa/hsa.h +++ b/src/dev/hsa/hsa.h @@ -80,7 +80,7 @@ // Try to detect CPU endianness #if !defined(LITTLEENDIAN_CPU) && !defined(BIGENDIAN_CPU) #if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \ - defined(_M_X64) + defined(_M_X64) || defined(__aarch64__) #define LITTLEENDIAN_CPU #endif #endif From 33cb1d833b04921a4afba476c4239bb565aa4fa1 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Fri, 16 Apr 2021 00:15:01 +0100 Subject: [PATCH 11/19] util: Fix cpt_upgrader format string Change-Id: I9d15316f199b20976420c35d2c79dd13cc9db9ee Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44510 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45824 Reviewed-by: Daniel Carvalho Maintainer: Gabe Black --- util/cpt_upgrader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/cpt_upgrader.py b/util/cpt_upgrader.py index 15dc2ab97f..5331c49ac4 100755 --- a/util/cpt_upgrader.py +++ b/util/cpt_upgrader.py @@ -126,7 +126,7 @@ class Upgrader: sys.exit(1) Upgrader.untag_set.add(self.tag) else: - print("Error: no upgrader or downgrader method for".format( + print("Error: no upgrader or downgrader method for {}".format( self.tag)) sys.exit(1) From e6ebda374add5d8bc1b851f66e6a340f543e9dc9 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Wed, 21 Apr 2021 11:44:40 +0100 Subject: [PATCH 12/19] configs: restore_simpoint_checkpoint should be a boolean The --restore_simpoint_checkpoint option is a boolean; however if no default value is supplied, optparse sets the default value to None This is not valid for argparse. Argparse recognizes the store_true action and it is automatically treating the option as a boolean, hence providing a default=False instead of default=None Change-Id: I6b09edf6911be71a06001730be1232a1b5c8482c Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44765 Reviewed-by: Daniel Carvalho Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45825 --- configs/common/Options.py | 1 + configs/common/Simulation.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/common/Options.py b/configs/common/Options.py index c48bfe64e6..b833531f4e 100644 --- a/configs/common/Options.py +++ b/configs/common/Options.py @@ -305,6 +305,7 @@ def addCommonOptions(parser): parser.add_option("--take-simpoint-checkpoints", action="store", type="string", help="") parser.add_option("--restore-simpoint-checkpoint", action="store_true", + default=False, help="restore from a simpoint checkpoint taken with " + "--take-simpoint-checkpoints") diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py index 067bc01da0..3b9efc0c93 100644 --- a/configs/common/Simulation.py +++ b/configs/common/Simulation.py @@ -710,7 +710,7 @@ def run(options, root, testsys, cpu_class): takeSimpointCheckpoints(simpoints, interval_length, cptdir) # Restore from SimPoint checkpoints - elif options.restore_simpoint_checkpoint != None: + elif options.restore_simpoint_checkpoint: restoreSimpointCheckpoint() else: From 89dea636c982de9f8589a295d935f80b10d97eff Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Wed, 5 May 2021 15:36:17 -0700 Subject: [PATCH 13/19] util-docker: Use python3 by default for Ubuntu 18.04 docker images gem5 dropped the support for python2. This change sets python3 to have a higher priority than python2 in the Ubuntu 18.04 docker images. This is done so that gem5 will be compiled and tested in the python3 environment by default. JIRA: https://gem5.atlassian.net/browse/GEM5-958 Signed-off-by: Hoa Nguyen Change-Id: I11ffb06697ecf4cebf9f98b611641faa42805547 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45125 Maintainer: Bobby R. Bruce Maintainer: Jason Lowe-Power Reviewed-by: Jason Lowe-Power Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45826 Reviewed-by: Gabe Black Maintainer: Gabe Black --- util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile | 3 +++ util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile b/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile index 2403a5002b..775e54927e 100644 --- a/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile +++ b/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile @@ -32,3 +32,6 @@ RUN apt -y install build-essential git m4 scons zlib1g zlib1g-dev \ libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \ python3-dev python3 python3-six doxygen libboost-all-dev \ libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config + +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1 diff --git a/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile b/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile index 5ec6784e3a..53a7d928ab 100644 --- a/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile +++ b/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile @@ -30,3 +30,6 @@ RUN apt -y update RUN apt -y upgrade RUN apt -y install build-essential scons zlib1g-dev m4 python3-dev python3 \ python3-six + +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1 From 09b71163be83d49f2d67915b0887e791e4336f94 Mon Sep 17 00:00:00 2001 From: Philip Metzler Date: Mon, 17 May 2021 22:49:38 -0700 Subject: [PATCH 14/19] fastmodel: Fix scx_get_parameter_list for ARM fastmodels. The first non-critical piece of this CL removes the unused self from the Python function signature. Then also includes "stl.h" from pybind11 to allow the implicit conversion from std::map to a Python dict (otherwise there will be a runtime (not compile time) error when calling the function. As the current implementation always throws an error because of the missing stl.h I don't believe anyone is using this function, and as such it should be safe to just change the signature of scx_get_parameter_list. Change-Id: Ib3202b2d4d1b8418a4adf54739fe389d4ee07743 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45622 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45827 --- src/arch/arm/fastmodel/arm_fast_model.py | 2 +- src/python/pybind11/pybind.hh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arch/arm/fastmodel/arm_fast_model.py b/src/arch/arm/fastmodel/arm_fast_model.py index 3b9c7cb5e2..c9d11135d3 100644 --- a/src/arch/arm/fastmodel/arm_fast_model.py +++ b/src/arch/arm/fastmodel/arm_fast_model.py @@ -77,7 +77,7 @@ def scx_get_parameter(name): _m5.arm_fast_model.scx_get_parameter(name, value) return value -def scx_get_parameter_list(self): +def scx_get_parameter_list(): return _m5.arm_fast_model.scx_get_parameter_list() def scx_set_cpi_file(cpi_file_path): diff --git a/src/python/pybind11/pybind.hh b/src/python/pybind11/pybind.hh index cdf18bc5c0..256120e706 100644 --- a/src/python/pybind11/pybind.hh +++ b/src/python/pybind11/pybind.hh @@ -39,6 +39,7 @@ #define __PYTHON_PYBIND11_PYBIND_HH__ #include "pybind11/pybind11.h" +#include "pybind11/stl.h" void pybind_init_core(pybind11::module_ &m_native); void pybind_init_debug(pybind11::module_ &m_native); From dd57e9216ac723d0cff2c211cb323385c685c86c Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Thu, 20 May 2021 10:32:42 -0700 Subject: [PATCH 15/19] mem-ruby: Fix nonsensical check in MOESI_CMP_token-L1cache This check always equated to False. It should be an 'or' not an 'and' comparison. The Clang 11 compiler threw an "overlapping comparisons always evaluate to false" error for the code generaed from this. Change-Id: I299dc6fa8206d5e85d59ba8353bf16102b8e5e1b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45799 Reviewed-by: Jason Lowe-Power Reviewed-by: Matt Sinclair Maintainer: Jason Lowe-Power Maintainer: Matt Sinclair Tested-by: kokoro Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45829 Maintainer: Bobby R. Bruce --- src/mem/ruby/protocol/MOESI_CMP_token-L1cache.sm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mem/ruby/protocol/MOESI_CMP_token-L1cache.sm b/src/mem/ruby/protocol/MOESI_CMP_token-L1cache.sm index 5c3d5f79d1..c9fe135ae7 100644 --- a/src/mem/ruby/protocol/MOESI_CMP_token-L1cache.sm +++ b/src/mem/ruby/protocol/MOESI_CMP_token-L1cache.sm @@ -358,7 +358,7 @@ machine(MachineType:L1Cache, "Token protocol") } // You have at least half the token in O-like states - if (state == State:O && state == State:OM) { + if (state == State:O || state == State:OM) { assert(cache_entry.Tokens > (max_tokens() / 2)); } From 95f3d6899b70385efda5f379475e2efb68ca97ee Mon Sep 17 00:00:00 2001 From: Yu-hsin Wang Date: Tue, 25 May 2021 18:07:13 +0800 Subject: [PATCH 16/19] systemc: Set verify.py shebang to python3 Change-Id: Id33658c19f6ccfe5d1552599ad7928bae99784d4 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45980 Reviewed-by: Bobby R. Bruce Reviewed-by: Andreas Sandberg Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/systemc/tests/verify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 95812f48a4..076d1d51cb 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 Google, Inc. # From 522ffdbb87b0da122ebb3b811444fc322924615e Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Fri, 11 Jun 2021 09:43:02 -0300 Subject: [PATCH 17/19] util: Fix typo in cpt upgrader The module is errno, not ennro. Change-Id: I3f17bdc12a7acd680ac407042a75d5099f5f7339 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46799 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro (cherry picked from commit 697745620782a4f8182ba819ff85e01b00dad68b) Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47099 Reviewed-by: Bobby R. Bruce Reviewed-by: Jason Lowe-Power Maintainer: Bobby R. Bruce --- util/cpt_upgrader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/cpt_upgrader.py b/util/cpt_upgrader.py index 5331c49ac4..47cd24771a 100755 --- a/util/cpt_upgrader.py +++ b/util/cpt_upgrader.py @@ -185,7 +185,7 @@ class Upgrader: def process_file(path, **kwargs): if not osp.isfile(path): import errno - raise IOError(ennro.ENOENT, "No such file", path) + raise IOError(errno.ENOENT, "No such file", path) verboseprint("Processing file %s...." % path) From bb4166c93517cb54a03b29b457327bac9c2ca625 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 22 Jun 2021 12:08:46 -0700 Subject: [PATCH 18/19] base: Update the version to v21.0.1.0 Change-Id: Ieffc677d2daf0aadf82ede94d989e4b9a5bd17be Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47079 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/Doxyfile | 2 +- src/base/version.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Doxyfile b/src/Doxyfile index b83a8b1f18..f8b481ec1a 100644 --- a/src/Doxyfile +++ b/src/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = gem5 # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = v21.0.0.0 +PROJECT_NUMBER = v21.0.1.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/src/base/version.cc b/src/base/version.cc index b46ca39a47..51ccfb44d7 100644 --- a/src/base/version.cc +++ b/src/base/version.cc @@ -29,4 +29,4 @@ /** * @ingroup api_base_utils */ -const char *gem5Version = "21.0.0.0"; +const char *gem5Version = "21.0.1.0"; From a85e48ceb7e8235d68292a65211b614f0c5343f9 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 22 Jun 2021 12:19:26 -0700 Subject: [PATCH 19/19] misc: Update the RELEASE-NOTES.md for v21.0.1.0 Change-Id: Id0c30e79100dfb83e53a16ae6a32bf9af3dac705 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47080 Reviewed-by: Bobby R. Bruce Reviewed-by: Daniel Carvalho Maintainer: Bobby R. Bruce Tested-by: kokoro --- RELEASE-NOTES.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6428267ab3..b3ad530b3d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,26 @@ +# Version 21.0.1.0 + +Version 21.0.1 is a minor gem5 release consisting of bug fixes. The 21.0.1 release: + +* Fixes the [GCN-GPU Dockerfile](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/util/dockerfiles/gcn-gpu/Dockerfile) to pull from the v21-0 bucket. +* Fixes the tests to download from the v21-0 bucket instead of the develop bucket. +* Fixes the Temperature class: + * Fixes [fs_power.py](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/configs/example/arm/fs_power.py), which was producing a ["Temperature is not JSON serializable" error](https://gem5.atlassian.net/browse/GEM5-951). + * Fixes temperature printing in `config.ini`. + * Fixes the pybind export for the `from_kelvin` function. +* Eliminates a duplicated name warning in [ClockTick](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/src/systemc/channel/sc_clock.cc). +* Fixes the [Ubuntu 18.04 Dockerfile](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/util/dockerfiles/ubuntu-20.04_all-dependencies/Dockerfile) to use Python3 instead of Python2. +* Makes [verify.py](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/src/systemc/tests/verify.py) compatible with Python3. +* Fixes GCN3_X86 builds for aarch64 hosts. +* Fixes building with `SLICC_HTML=True`. +* Fixes the [cpt_upgrader.py](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/util/cpt_upgrader.py) string formatter. +* Fixes typo in [cpy_upgrader.py](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/util/cpt_upgrader.py) where module `errno` was incorrectly put as `ennro`. +* Sets the `--restore-simpoint-checkpoint` flag default to "False" instead of the ambiguous "None". +* Fixes a nonsensical check in [MOESI_CMP_token-L1cache](https://gem5.googlesource.com/public/gem5/+/refs/tags/v21.0.1.0/src/mem/ruby/protocol/MOESI_CMP_token-L1cache.sm) which caused compilation bugs in Clang-11. +* Fixes the `scx_get_parameter_list` for ARM fast models. +* Fixes [bloated object binaries, known to cause issues during linking](https://gem5.atlassian.net/browse/GEM5-1003). +* Due to LTO causing unacceptably long link times for some users, and stripping debug symbols in some setups, it is no longer enabled by default. It may be enabled with the `--with-lto` flag. The `--no-lto` flag has been removed. + # Version 21.0.0.0 Version 21.0 marks *one full year* of gem5 releases, and on this anniversary, I think we have some of the biggest new features yet!