[gem5-dev] Change in gem5/gem5[develop]: ext-testlib: Import MutableSet properly.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56849 )


Change subject: ext-testlib: Import MutableSet properly.
..

ext-testlib: Import MutableSet properly.

The MutableSet class used to be part of the collections module directly,
but in 3.3 was moved to collections.abc. Apparently there was still a
version in collections, since we had been importing it from that old
location and it had been working up until now. After a recent update,
this stopped working for me, and may be tied to an update to the local
version of python on my machine.

This change imports MutableSet from collections.abc instead of
collections directly. I found only one place that this class was used in
src or ext, so I don't think it needs to be fixed anywhere else.

Change-Id: I8b2e82160fd433d57af4a7008ec282ee8ad8a422
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56849
Maintainer: Bobby Bruce 
Tested-by: kokoro 
Reviewed-by: Gabe Black 
---
M ext/testlib/helper.py
1 file changed, 26 insertions(+), 1 deletion(-)

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




diff --git a/ext/testlib/helper.py b/ext/testlib/helper.py
index 1cb13f0..ed6e325 100644
--- a/ext/testlib/helper.py
+++ b/ext/testlib/helper.py
@@ -41,7 +41,8 @@
 '''
 Helper classes for writing tests with this test library.
 '''
-from collections import MutableSet, namedtuple
+from collections import namedtuple
+from collections.abc import MutableSet

 import difflib
 import errno

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56849
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: I8b2e82160fd433d57af4a7008ec282ee8ad8a422
Gerrit-Change-Number: 56849
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby Bruce 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Hoa Nguyen 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Fix stats in src/mem/cache/base.cc

2022-02-18 Thread Hoa Nguyen (Gerrit) via gem5-dev
Hoa Nguyen has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56989 )



Change subject: mem-cache: Fix stats in src/mem/cache/base.cc
..

mem-cache: Fix stats in src/mem/cache/base.cc

Most latency stats are described to have a unit of Tick.

However, the unit should be cycles.

Change-Id: Ib1b9b7c6fa4404cecb3982b3799753df19774623
Signed-off-by: Hoa Nguyen 
---
M src/mem/cache/base.cc
1 file changed, 39 insertions(+), 25 deletions(-)



diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index 435684a..bfdce0c 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -2028,16 +2028,16 @@
("number of " + name + " hits").c_str()),
   ADD_STAT(misses, statistics::units::Count::get(),
("number of " + name + " misses").c_str()),
-  ADD_STAT(hitLatency, statistics::units::Tick::get(),
-   ("number of " + name + " hit ticks").c_str()),
-  ADD_STAT(missLatency, statistics::units::Tick::get(),
-   ("number of " + name + " miss ticks").c_str()),
+  ADD_STAT(hitLatency, statistics::units::Cycle::get(),
+   ("number of " + name + " hit cycles").c_str()),
+  ADD_STAT(missLatency, statistics::units::Cycle::get(),
+   ("number of " + name + " miss cycles").c_str()),
   ADD_STAT(accesses, statistics::units::Count::get(),
("number of " + name + " accesses(hits+misses)").c_str()),
   ADD_STAT(missRate, statistics::units::Ratio::get(),
("miss rate for " + name + " accesses").c_str()),
   ADD_STAT(avgMissLatency, statistics::units::Rate<
-statistics::units::Tick,  
statistics::units::Count>::get(),
+statistics::units::Cycle,  
statistics::units::Count>::get(),

("average " + name + " miss latency").c_str()),
   ADD_STAT(mshrHits, statistics::units::Count::get(),
("number of " + name + " MSHR hits").c_str()),
@@ -2045,17 +2045,17 @@
("number of " + name + " MSHR misses").c_str()),
   ADD_STAT(mshrUncacheable, statistics::units::Count::get(),
("number of " + name + " MSHR uncacheable").c_str()),
-  ADD_STAT(mshrMissLatency, statistics::units::Tick::get(),
-   ("number of " + name + " MSHR miss ticks").c_str()),
-  ADD_STAT(mshrUncacheableLatency, statistics::units::Tick::get(),
-   ("number of " + name + " MSHR uncacheable ticks").c_str()),
+  ADD_STAT(mshrMissLatency, statistics::units::Cycle::get(),
+   ("number of " + name + " MSHR miss cycles").c_str()),
+  ADD_STAT(mshrUncacheableLatency, statistics::units::Cycle::get(),
+   ("number of " + name + " MSHR uncacheable cycles").c_str()),
   ADD_STAT(mshrMissRate, statistics::units::Ratio::get(),
("mshr miss rate for " + name + " accesses").c_str()),
   ADD_STAT(avgMshrMissLatency, statistics::units::Rate<
-statistics::units::Tick,  
statistics::units::Count>::get(),
+statistics::units::Cycle,  
statistics::units::Count>::get(),

("average " + name + " mshr miss latency").c_str()),
   ADD_STAT(avgMshrUncacheableLatency, statistics::units::Rate<
-statistics::units::Tick,  
statistics::units::Count>::get(),
+statistics::units::Cycle,  
statistics::units::Count>::get(),

("average " + name + " mshr uncacheable latency").c_str())
 {
 }
@@ -2201,18 +2201,18 @@
  "number of demand (read+write) hits"),
 ADD_STAT(overallHits, statistics::units::Count::get(),
  "number of overall hits"),
-ADD_STAT(demandHitLatency, statistics::units::Tick::get(),
- "number of demand (read+write) hit ticks"),
-ADD_STAT(overallHitLatency, statistics::units::Tick::get(),
-"number of overall hit ticks"),
+ADD_STAT(demandHitLatency, statistics::units::Cycle::get(),
+ "number of demand (read+write) hit cycles"),
+ADD_STAT(overallHitLatency, statistics::units::Cycle::get(),
+"number of overall hit cycles"),
 ADD_STAT(demandMisses, statistics::units::Count::get(),
  "number of demand (read+write) misses"),
 ADD_STAT(overallMisses, statistics::units::Count::get(),
  "number of overall misses"),
-ADD_STAT(demandMissLatency, statistics::units::Tick::get(),
- "number of demand (read+write) miss ticks"),
-ADD_STAT(overallMissLatency, statistics::units::Tick::get(),
- "number of overall miss ticks"),
+ADD_STAT(demandMissLatency, statistics::units::Cycle::get(),
+ "number of demand (read+write) miss cycles"),
+ADD_STAT(overallMissLatency, statistics::units::Cycle::get(),
+ "number of overall miss cycles"),
 ADD_STAT(demandAccesses, 

[gem5-dev] Change in gem5/gem5[develop]: gpu-compute: Fix register checking and allocation in dyn manager

2022-02-18 Thread Matt Sinclair (Gerrit) via gem5-dev
Matt Sinclair has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56909 )


Change subject: gpu-compute: Fix register checking and allocation in dyn  
manager

..

gpu-compute: Fix register checking and allocation in dyn manager

This patch updates the canAllocate function to account both for
the number of regions of registers that need to be allocated,
and for the fact that the registers aren't one continuous chunk.

The patch also consolidates the registers as much as possible when
a register chunk is freed. This prevents fragmentation from making
it impossible to allocate enough registers

Change-Id: Ic95cfe614d247add475f7139d3703991042f8149
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56909
Reviewed-by: Matt Sinclair 
Maintainer: Matt Sinclair 
Tested-by: kokoro 
Reviewed-by: Matthew Poremba 
---
M src/gpu-compute/dyn_pool_manager.cc
1 file changed, 69 insertions(+), 6 deletions(-)

Approvals:
  Matthew Poremba: Looks good to me, approved
  Matt Sinclair: Looks good to me, but someone else must approve; Looks  
good to me, approved

  kokoro: Regressions pass




diff --git a/src/gpu-compute/dyn_pool_manager.cc  
b/src/gpu-compute/dyn_pool_manager.cc

index 62a39a9..3db5e7f 100644
--- a/src/gpu-compute/dyn_pool_manager.cc
+++ b/src/gpu-compute/dyn_pool_manager.cc
@@ -93,8 +93,24 @@
 DynPoolManager::canAllocate(uint32_t numRegions, uint32_t size)
 {
 uint32_t actualSize = minAllocatedElements(size);
-DPRINTF(GPUVRF,"Can Allocate %d\n",actualSize);
-return (_totRegSpaceAvailable >= actualSize);
+uint32_t numAvailChunks = 0;
+DPRINTF(GPUVRF, "Checking if we can allocate %d regions of size %d "
+"registers\n", numRegions, actualSize);
+for (auto it : freeSpaceRecord) {
+numAvailChunks += (it.second - it.first)/actualSize;
+}
+
+if (numAvailChunks >= numRegions) {
+DPRINTF(GPUVRF, "Able to allocate %d regions of size %d; "
+"number of available regions: %d\n",
+numRegions, actualSize, numAvailChunks);
+return true;
+} else {
+DPRINTF(GPUVRF, "Unable to allocate %d regions of size %d; "
+"number of available regions: %d\n",
+numRegions, actualSize, numAvailChunks);
+return false;
+}
 }

 uint32_t
@@ -105,7 +121,8 @@
 uint32_t actualSize = minAllocatedElements(size);
 auto it = freeSpaceRecord.begin();
 while (it != freeSpaceRecord.end()) {
-if (it->second >= actualSize) {
+uint32_t curChunkSize = it->second - it->first;
+if (curChunkSize >= actualSize) {
 // assign the next block starting from here
 startIdx = it->first;
 _regionSize = actualSize;
@@ -115,14 +132,13 @@
 // This case sees if this chunk size is exactly equal to
 // the size of the requested chunk. If yes, then this can't
 // contribute to future requests and hence, should be removed
-if (it->second == actualSize) {
+if (curChunkSize == actualSize) {
 it = freeSpaceRecord.erase(it);
 // once entire freeSpaceRecord allocated, increment
 // reservedSpaceRecord count
 ++reservedSpaceRecord;
 } else {
 it->first += actualSize;
-it->second -= actualSize;
 }
 break;
 }
@@ -144,7 +160,32 @@
 // Current dynamic register allocation does not handle wraparound
 assert(firstIdx < lastIdx);
 _totRegSpaceAvailable += lastIdx-firstIdx;
-freeSpaceRecord.push_back(std::make_pair(firstIdx,lastIdx-firstIdx));
+
+// Consolidate with other regions. Need to check if firstIdx or lastIdx
+// already exist
+auto firstIt = std::find_if(
+freeSpaceRecord.begin(),
+freeSpaceRecord.end(),
+[&](const std::pair& element){
+return element.second == firstIdx;} );
+
+auto lastIt = std::find_if(
+freeSpaceRecord.begin(),
+freeSpaceRecord.end(),
+[&](const std::pair& element){
+return element.first == lastIdx;} );
+
+if (firstIt != freeSpaceRecord.end() && lastIt !=  
freeSpaceRecord.end()) {

+firstIt->second = lastIt->second;
+freeSpaceRecord.erase(lastIt);
+} else if (firstIt != freeSpaceRecord.end()) {
+firstIt->second = lastIdx;
+} else if (lastIt != freeSpaceRecord.end()) {
+lastIt->first = firstIdx;
+} else {
+freeSpaceRecord.push_back(std::make_pair(firstIdx, lastIdx));
+}
+
 // remove corresponding entry from reservedSpaceRecord too
 --reservedSpaceRecord;
 }

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

[gem5-dev] Change in gem5/gem5[develop]: sim: Fix Mempool overrides during checkpoint

2022-02-18 Thread Jordi Vaquero (Gerrit) via gem5-dev
Jordi Vaquero has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56969 )



Change subject: sim: Fix Mempool overrides during checkpoint
..

sim: Fix Mempool overrides during checkpoint

This patch fixes the problem during checkpoing where the mempool is not
restored, but using only the one specified in the config file as a new
execution.
In order to fix that this changes modifyies the serialize/unserialize
functions for mempools and create new funcionts on se_workload to make
sure mempools ends up in the m5.cpt.
We change as well the unserialize mempool function to update the values for
and already createt pool, so the execution picks up right in the same place
for the checkpoint.

JIRA: https://gem5.atlassian.net/browse/GEM5-1191

Change-Id: I289bf91eb4f01d9c01a31a39b968e30f8b8d2bdc
---
M src/sim/mem_pool.cc
M src/sim/mem_pool.hh
M src/sim/process.cc
M src/sim/se_workload.hh
4 files changed, 78 insertions(+), 4 deletions(-)



diff --git a/src/sim/mem_pool.cc b/src/sim/mem_pool.cc
index 20b6eda..26190a6 100644
--- a/src/sim/mem_pool.cc
+++ b/src/sim/mem_pool.cc
@@ -123,6 +123,26 @@
 return return_addr;
 }

+bool
+MemPool::overlaps(MemPool& other)
+{
+Addr end_page_num = startPageNum + totalPages();
+if (startPageNum <= other.startPageNum &&
+end_page_num > other.startPageNum)
+return true;
+else
+return false;
+}
+
+void
+MemPool::update(MemPool & other)
+{
+pageShift = other.pageShift;
+startPageNum = other.startPageNum;
+freePageNum = other.freePageNum;
+_totalPages = other._totalPages;
+}
+
 void
 MemPool::serialize(CheckpointOut ) const
 {
@@ -166,26 +186,42 @@
 return pools[pool_id].freeBytes();
 }

+bool
+MemPools::checkDuplicate(MemPool& pool)
+{
+for (auto : pools) {
+if (p.overlaps(pool)) {
+p.update(pool);
+return true;
+}
+}
+return false;
+}
+
 void
 MemPools::serialize(CheckpointOut ) const
 {
+ScopedCheckpointSection sec(cp, "mempools");
 int num_pools = pools.size();
 SERIALIZE_SCALAR(num_pools);

 for (int i = 0; i < num_pools; i++)
-pools[i].serializeSection(cp, csprintf("pool%d", i));
+pools[i].serializeSection(cp, csprintf("mempools.pool%d", i));
 }

 void
 MemPools::unserialize(CheckpointIn )
 {
+ScopedCheckpointSection sec(cp, "mempools");
 int num_pools = 0;
 UNSERIALIZE_SCALAR(num_pools);

 for (int i = 0; i < num_pools; i++) {
 MemPool pool;
-pool.unserializeSection(cp, csprintf("pool%d", i));
-pools.push_back(pool);
+pool.unserializeSection(cp, csprintf("mempools.pool%d", i));
+if (!checkDuplicate(pool)) {
+pools.push_back(pool);
+}
 }
 }

diff --git a/src/sim/mem_pool.hh b/src/sim/mem_pool.hh
index f35fdbc..452507a 100644
--- a/src/sim/mem_pool.hh
+++ b/src/sim/mem_pool.hh
@@ -79,6 +79,9 @@

 Addr allocate(Addr npages);

+bool overlaps(MemPool& other);
+void update(MemPool& other);
+
 void serialize(CheckpointOut ) const override;
 void unserialize(CheckpointIn ) override;
 };
@@ -105,6 +108,8 @@
 /** Amount of physical memory that is still free in a pool. */
 Addr freeMemSize(int pool_id=0) const;

+bool checkDuplicate(MemPool& pool);
+
 void serialize(CheckpointOut ) const override;
 void unserialize(CheckpointIn ) override;
 };
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 3a631a5..64fdca4 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -373,7 +373,7 @@
 memState->serialize(cp);
 pTable->serialize(cp);
 fds->serialize(cp);
-
+seWorkload->serialize(cp);
 /**
  * Checkpoints for pipes, device drivers or sockets currently
  * do not work. Need to come back and fix them at a later date.
@@ -388,6 +388,7 @@
 memState->unserialize(cp);
 pTable->unserialize(cp);
 fds->unserialize(cp);
+seWorkload->unserialize(cp);
 /**
  * Checkpoints for pipes, device drivers or sockets currently
  * do not work. Need to come back and fix them at a later date.
diff --git a/src/sim/se_workload.hh b/src/sim/se_workload.hh
index 5bc597f..117fbe0 100644
--- a/src/sim/se_workload.hh
+++ b/src/sim/se_workload.hh
@@ -81,6 +81,17 @@
 panic("No workload symbol table for syscall emulation mode.");
 }

+void
+serialize(CheckpointOut ) const override
+{
+memPools.serialize(cp);
+}
+void
+unserialize(CheckpointIn ) override
+{
+memPools.unserialize(cp);
+}
+
 void syscall(ThreadContext *tc) override;

 // For now, assume the only type of events are system calls.

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


Gerrit-Project: public/gem5
Gerrit-Branch: develop

[gem5-dev] Change in gem5/gem5[develop]: scons: Hook in the kconfig setconfig utility.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56950 )



Change subject: scons: Hook in the kconfig setconfig utility.
..

scons: Hook in the kconfig setconfig utility.

This little utility lets you set particular values in an existing config
without having to open up the whole menuconfig interface.

Also reorganize things in kconfig.py a little to help share code between
wrappers.

Change-Id: I7cba0c0ef8d318d6c39e49c779ebb2bbdc3d94c8
---
M SConstruct
M site_scons/gem5_scons/kconfig.py
2 files changed, 63 insertions(+), 16 deletions(-)



diff --git a/SConstruct b/SConstruct
index 8ccddee..207d92b 100755
--- a/SConstruct
+++ b/SConstruct
@@ -210,8 +210,9 @@
 BUILD_TARGETS[:] = makePathListAbsolute(BUILD_TARGETS)

 kconfig_actions = (
-'menuconfig',
 'defconfig',
+'menuconfig',
+'setconfig',
 )

 # From itertools-recipes:
@@ -632,16 +633,19 @@

 # Handle any requested kconfig action, then exit.
 if kconfig_action:
-if kconfig_action == 'menuconfig':
-kconfig.menuconfig(env, kconfig_file.abspath,  
config_file.abspath,

-variant_path)
-elif kconfig_action == 'defconfig':
+if kconfig_action == 'defconfig':
 defconfig_key = 'DEFCONFIG'
 defconfig_path = ARGUMENTS.get(defconfig_key, None)
 if not defconfig_path:
 error(f'Tried to defconfig, but {defconfig_key} not set.')
 kconfig.defconfig(env, kconfig_file.abspath,
 defconfig_path, config_file.abspath)
+elif kconfig_action == 'menuconfig':
+kconfig.menuconfig(env, kconfig_file.abspath,  
config_file.abspath,

+variant_path)
+elif kconfig_action == 'setconfig':
+kconfig.setconfig(env, kconfig_file.abspath,  
config_file.abspath,

+ARGUMENTS)
 else:
 error(f'Unrecognized kconfig action {kconfig_action}')
 Exit(0)
diff --git a/site_scons/gem5_scons/kconfig.py  
b/site_scons/gem5_scons/kconfig.py

index 1ccb1d2..c1fe5ba 100644
--- a/site_scons/gem5_scons/kconfig.py
+++ b/site_scons/gem5_scons/kconfig.py
@@ -28,6 +28,12 @@
 from . import error
 import kconfiglib

+_kconfig_helpers = {
+'DEFCONFIG_PY': 'defconfig.py',
+'MENUCONFIG_PY': 'menuconfig.py',
+'SETCONFIG_PY': 'setconfig.py',
+}
+
 def _prep_env(env, base_kconfig, config_path=None):
 kconfig_env = env.Clone()
 for key, val in kconfig_env['CONF'].items():
@@ -38,16 +44,24 @@
 if config_path:
 kconfig_env['ENV']['KCONFIG_CONFIG'] = config_path

+kconfig_env['BASE_KCONFIG'] = base_kconfig
+
 ext = env.Dir('#ext')
 kconfiglib_dir = ext.Dir('Kconfiglib')
-defconfig_py = kconfiglib_dir.File('defconfig.py')
-menuconfig_py = kconfiglib_dir.File('menuconfig.py')
-
-kconfig_env['DEFCONFIG_PY'] = defconfig_py
-kconfig_env['MENUCONFIG_PY'] = menuconfig_py
-kconfig_env['BASE_KCONFIG'] = base_kconfig
+for key, name in _kconfig_helpers.items():
+kconfig_env[key] = kconfiglib_dir.File(name)
 return kconfig_env

+def _process_kconfig(env, base_kconfig):
+saved_env = os.environ
+try:
+os.environ.update({key: str(val) for key, val in  
env['ENV'].items()})

+kconfig = kconfiglib.Kconfig(filename=base_kconfig)
+finally:
+os.environ = saved_env
+return kconfig
+
+
 def defconfig(env, base_kconfig, config_in, config_out):
 kconfig_env = _prep_env(env, base_kconfig, config_out)
 kconfig_env['CONFIG_IN'] = config_in
@@ -63,14 +77,28 @@
 if kconfig_env.Execute('"${MENUCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
 error("Failed to run menuconfig")

+def setconfig(env, base_kconfig, config_path, assignments):
+kconfig_env = _prep_env(env, base_kconfig, config_path)
+
+kconfig = _process_kconfig(kconfig_env, base_kconfig)
+sym_names = list((sym.name for sym in kconfig.unique_defined_syms))
+
+filtered = dict({key: val for key, val in
+assignments.items() if key in sym_names})
+
+setconfig_cmd_parts = ['"${SETCONFIG_PY}" --kconfig "${BASE_KCONFIG}"']
+for key, val in filtered.items():
+if isinstance(val, bool):
+val = 'y' if val else 'n'
+setconfig_cmd_parts.append(f'{key}={val}')
+setconfig_cmd = ' '.join(setconfig_cmd_parts)
+if kconfig_env.Execute(setconfig_cmd) != 0:
+error("Failed to run setconfig")
+
 def update_env(env, base_kconfig, config_path):
 kconfig_env = _prep_env(env, base_kconfig, config_path)

-saved_env = os.environ
-os.environ.update({key: str(val) for key, val in
-kconfig_env['ENV'].items()})
-kconfig = kconfiglib.Kconfig(filename=base_kconfig)
-os.environ = saved_env
+kconfig = _process_kconfig(kconfig_env, base_kconfig)

 kconfig.load_config(config_path)
 for sym in 

[gem5-dev] Change in gem5/gem5[develop]: scons: Hook in the listnewconfig kconfig helper.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56951 )



Change subject: scons: Hook in the listnewconfig kconfig helper.
..

scons: Hook in the listnewconfig kconfig helper.

This helper lists config options which are new in the Kconfig and which
are not currently set in the config file.

Change-Id: I0c426d85c0cf0d2bdbac599845669165285a82a0
---
M SConstruct
M site_scons/gem5_scons/kconfig.py
2 files changed, 25 insertions(+), 0 deletions(-)



diff --git a/SConstruct b/SConstruct
index 207d92b..3f6cfae 100755
--- a/SConstruct
+++ b/SConstruct
@@ -211,6 +211,7 @@

 kconfig_actions = (
 'defconfig',
+'listnewconfig',
 'menuconfig',
 'setconfig',
 )
@@ -640,6 +641,9 @@
 error(f'Tried to defconfig, but {defconfig_key} not set.')
 kconfig.defconfig(env, kconfig_file.abspath,
 defconfig_path, config_file.abspath)
+elif kconfig_action == 'listnewconfig':
+kconfig.listnewconfig(env, kconfig_file.abspath,
+config_file.abspath)
 elif kconfig_action == 'menuconfig':
 kconfig.menuconfig(env, kconfig_file.abspath,  
config_file.abspath,

 variant_path)
diff --git a/site_scons/gem5_scons/kconfig.py  
b/site_scons/gem5_scons/kconfig.py

index c1fe5ba..0bad546 100644
--- a/site_scons/gem5_scons/kconfig.py
+++ b/site_scons/gem5_scons/kconfig.py
@@ -30,6 +30,7 @@

 _kconfig_helpers = {
 'DEFCONFIG_PY': 'defconfig.py',
+'LISTNEWCONFIG_PY': 'listnewconfig.py',
 'MENUCONFIG_PY': 'menuconfig.py',
 'SETCONFIG_PY': 'setconfig.py',
 }
@@ -69,6 +70,14 @@
 '"${CONFIG_IN}"') != 0:
 error("Failed to run defconfig")

+def listnewconfig(env, base_kconfig, config_path):
+kconfig_env = _prep_env(env, base_kconfig, config_path)
+# Provide a little visual separation between SCons output and
+# listnewconfig output.
+print()
+if kconfig_env.Execute('"${LISTNEWCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
+error("Failed to run listnewconfig")
+
 def menuconfig(env, base_kconfig, config_path, main_menu_text,
 style='aquatic'):
 kconfig_env = _prep_env(env, base_kconfig, config_path)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56951
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: I0c426d85c0cf0d2bdbac599845669165285a82a0
Gerrit-Change-Number: 56951
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Hook up the savedefconfig kconfig helper.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56954 )



Change subject: scons: Hook up the savedefconfig kconfig helper.
..

scons: Hook up the savedefconfig kconfig helper.

This helper utility lets you save the defconfig which would give rise to
a given config. For instance, you could use menuconfig to set up a
config how you want it with the options you cared about configured, and
then use savedefconfig to save a defconfig of that somewhere to the
side, in the gem5 defconfig directory, etc. Then later, you could use
that defconfig to set up a new build directory with that same config,
even if the kconfig options have changed a little bit since then.

A saved defconfig like that can also be a good way to visually see what
options have been set to something interesting, and an easier way to
pass a config to someone else to use, to put in bug reports, etc.

Change-Id: Ifd344278638c59b48c261b36058832034c009c78
---
M SConstruct
M site_scons/gem5_scons/kconfig.py
2 files changed, 37 insertions(+), 0 deletions(-)



diff --git a/SConstruct b/SConstruct
index 09dfbf8..cc823e0 100755
--- a/SConstruct
+++ b/SConstruct
@@ -214,6 +214,7 @@
 'guiconfig',
 'listnewconfig',
 'menuconfig',
+'savedefconfig',
 'setconfig',
 )

@@ -651,6 +652,13 @@
 elif kconfig_action == 'menuconfig':
 kconfig.menuconfig(env, kconfig_file.abspath,  
config_file.abspath,

 variant_path)
+elif kconfig_action == 'savedefconfig':
+defconfig_key = 'DEFCONFIG'
+defconfig_path = ARGUMENTS.get(defconfig_key, None)
+if not defconfig_path:
+error(f'Tried to savedefconfig, but {defconfig_key} not  
set.')

+kconfig.savedefconfig(env, kconfig_file.abspath,
+config_file.abspath, defconfig_path)
 elif kconfig_action == 'setconfig':
 kconfig.setconfig(env, kconfig_file.abspath,  
config_file.abspath,

 ARGUMENTS)
diff --git a/site_scons/gem5_scons/kconfig.py  
b/site_scons/gem5_scons/kconfig.py

index 920101e..da7141b 100644
--- a/site_scons/gem5_scons/kconfig.py
+++ b/site_scons/gem5_scons/kconfig.py
@@ -33,6 +33,7 @@
 'GUICONFIG_PY': 'guiconfig.py',
 'LISTNEWCONFIG_PY': 'listnewconfig.py',
 'MENUCONFIG_PY': 'menuconfig.py',
+'SAVEDEFCONFIG_PY': 'savedefconfig.py',
 'SETCONFIG_PY': 'setconfig.py',
 }

@@ -93,6 +94,13 @@
 if kconfig_env.Execute('"${MENUCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
 error("Failed to run menuconfig")

+def savedefconfig(env, base_kconfig, config_in, config_out):
+kconfig_env = _prep_env(env, base_kconfig, config_in)
+kconfig_env['CONFIG_OUT'] = config_out
+if kconfig_env.Execute('"${SAVEDEFCONFIG_PY}" '
+'--kconfig "${BASE_KCONFIG}" --out "${CONFIG_OUT}"') != 0:
+error("Failed to run savedefconfig")
+
 def setconfig(env, base_kconfig, config_path, assignments):
 kconfig_env = _prep_env(env, base_kconfig, config_path)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56954
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: Ifd344278638c59b48c261b36058832034c009c78
Gerrit-Change-Number: 56954
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Hook up oldconfig and olddefconfig.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56955 )



Change subject: scons: Hook up oldconfig and olddefconfig.
..

scons: Hook up oldconfig and olddefconfig.

These two utilities help update an old config to add settings for new
config options. The difference between them is that oldconfig asks what
new settings you want to use, while olddefconfig automatically picks the
defaults.

Change-Id: Icd3e57f834684e620705beb884faa5b6e2cc7baa
---
M SConstruct
M site_scons/gem5_scons/kconfig.py
2 files changed, 33 insertions(+), 0 deletions(-)



diff --git a/SConstruct b/SConstruct
index cc823e0..92d69dd 100755
--- a/SConstruct
+++ b/SConstruct
@@ -214,6 +214,8 @@
 'guiconfig',
 'listnewconfig',
 'menuconfig',
+'oldconfig',
+'olddefconfig',
 'savedefconfig',
 'setconfig',
 )
@@ -652,6 +654,11 @@
 elif kconfig_action == 'menuconfig':
 kconfig.menuconfig(env, kconfig_file.abspath,  
config_file.abspath,

 variant_path)
+elif kconfig_action == 'oldconfig':
+kconfig.oldconfig(env, kconfig_file.abspath,  
config_file.abspath)

+elif kconfig_action == 'olddefconfig':
+kconfig.olddefconfig(env, kconfig_file.abspath,
+config_file.abspath)
 elif kconfig_action == 'savedefconfig':
 defconfig_key = 'DEFCONFIG'
 defconfig_path = ARGUMENTS.get(defconfig_key, None)
diff --git a/site_scons/gem5_scons/kconfig.py  
b/site_scons/gem5_scons/kconfig.py

index da7141b..ed113fc 100644
--- a/site_scons/gem5_scons/kconfig.py
+++ b/site_scons/gem5_scons/kconfig.py
@@ -33,6 +33,8 @@
 'GUICONFIG_PY': 'guiconfig.py',
 'LISTNEWCONFIG_PY': 'listnewconfig.py',
 'MENUCONFIG_PY': 'menuconfig.py',
+'OLDCONFIG_PY': 'oldconfig.py',
+'OLDDEFCONFIG_PY': 'olddefconfig.py',
 'SAVEDEFCONFIG_PY': 'savedefconfig.py',
 'SETCONFIG_PY': 'setconfig.py',
 }
@@ -86,6 +88,16 @@
 if kconfig_env.Execute('"${LISTNEWCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
 error("Failed to run listnewconfig")

+def oldconfig(env, base_kconfig, config_path):
+kconfig_env = _prep_env(env, base_kconfig, config_path)
+if kconfig_env.Execute('"${OLDCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
+error("Failed to run oldconfig")
+
+def olddefconfig(env, base_kconfig, config_path):
+kconfig_env = _prep_env(env, base_kconfig, config_path)
+if kconfig_env.Execute('"${OLDDEFCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
+error("Failed to run oldconfig")
+
 def menuconfig(env, base_kconfig, config_path, main_menu_text,
 style='aquatic'):
 kconfig_env = _prep_env(env, base_kconfig, config_path)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56955
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: Icd3e57f834684e620705beb884faa5b6e2cc7baa
Gerrit-Change-Number: 56955
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Hook up the kconfig guiconfig program.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56953 )



Change subject: scons: Hook up the kconfig guiconfig program.
..

scons: Hook up the kconfig guiconfig program.

Change-Id: I0563a2fb2d79cea5974aeaf65a400be5ee51dc63
---
M SConstruct
M site_scons/gem5_scons/kconfig.py
2 files changed, 20 insertions(+), 0 deletions(-)



diff --git a/SConstruct b/SConstruct
index 3f6cfae..09dfbf8 100755
--- a/SConstruct
+++ b/SConstruct
@@ -211,6 +211,7 @@

 kconfig_actions = (
 'defconfig',
+'guiconfig',
 'listnewconfig',
 'menuconfig',
 'setconfig',
@@ -641,6 +642,9 @@
 error(f'Tried to defconfig, but {defconfig_key} not set.')
 kconfig.defconfig(env, kconfig_file.abspath,
 defconfig_path, config_file.abspath)
+elif kconfig_action == 'guiconfig':
+kconfig.guiconfig(env, kconfig_file.abspath,  
config_file.abspath,

+variant_path)
 elif kconfig_action == 'listnewconfig':
 kconfig.listnewconfig(env, kconfig_file.abspath,
 config_file.abspath)
diff --git a/site_scons/gem5_scons/kconfig.py  
b/site_scons/gem5_scons/kconfig.py

index 0bad546..920101e 100644
--- a/site_scons/gem5_scons/kconfig.py
+++ b/site_scons/gem5_scons/kconfig.py
@@ -30,6 +30,7 @@

 _kconfig_helpers = {
 'DEFCONFIG_PY': 'defconfig.py',
+'GUICONFIG_PY': 'guiconfig.py',
 'LISTNEWCONFIG_PY': 'listnewconfig.py',
 'MENUCONFIG_PY': 'menuconfig.py',
 'SETCONFIG_PY': 'setconfig.py',
@@ -70,6 +71,12 @@
 '"${CONFIG_IN}"') != 0:
 error("Failed to run defconfig")

+def guiconfig(env, base_kconfig, config_path, main_menu_text):
+kconfig_env = _prep_env(env, base_kconfig, config_path)
+kconfig_env['ENV']['MAIN_MENU_TEXT'] = main_menu_text
+if kconfig_env.Execute('"${GUICONFIG_PY}" "${BASE_KCONFIG}"') != 0:
+error("Failed to run guiconfig")
+
 def listnewconfig(env, base_kconfig, config_path):
 kconfig_env = _prep_env(env, base_kconfig, config_path)
 # Provide a little visual separation between SCons output and

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56953
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: I0563a2fb2d79cea5974aeaf65a400be5ee51dc63
Gerrit-Change-Number: 56953
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Pass the DISPLAY environment variable through to SCons.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56952 )



Change subject: scons: Pass the DISPLAY environment variable through to  
SCons.

..

scons: Pass the DISPLAY environment variable through to SCons.

This lets gui programs run correctly within SCons, specifically the
kconfig "guiconfig" helper utility.

Change-Id: Iec51df3db89ac7e7411e6c08fe8201afb69dc63e
---
M site_scons/gem5_scons/defaults.py
1 file changed, 14 insertions(+), 1 deletion(-)



diff --git a/site_scons/gem5_scons/defaults.py  
b/site_scons/gem5_scons/defaults.py

index 4382937..9307b0b 100644
--- a/site_scons/gem5_scons/defaults.py
+++ b/site_scons/gem5_scons/defaults.py
@@ -48,7 +48,8 @@
  'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
  'PYTHONPATH', 'RANLIB', 'TERM', 'PYTHON_CONFIG',
  'CCFLAGS_EXTRA', 'GEM5PY_CCFLAGS_EXTRA',
- 'GEM5PY_LINKFLAGS_EXTRA', 'LINKFLAGS_EXTRA'])
+ 'GEM5PY_LINKFLAGS_EXTRA', 'LINKFLAGS_EXTRA',
+ 'DISPLAY'])

 use_prefixes = [
 "ASAN_",   # address sanitizer symbolizer path and settings

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56952
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: Iec51df3db89ac7e7411e6c08fe8201afb69dc63e
Gerrit-Change-Number: 56952
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Add a mechanism to manually defconfig a build dir.

2022-02-18 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/56949 )



Change subject: scons: Add a mechanism to manually defconfig a build dir.
..

scons: Add a mechanism to manually defconfig a build dir.

This will let you specify *any* defconfig file, instead of implicitly
selecting one from the defconfig directory based on the variant name.

Change-Id: I74c981b206849f08e60c2df702c06534c670cc7c
---
M SConstruct
1 file changed, 23 insertions(+), 1 deletion(-)



diff --git a/SConstruct b/SConstruct
index 14586ce..8ccddee 100755
--- a/SConstruct
+++ b/SConstruct
@@ -209,7 +209,10 @@
 # doesn't work (obviously!).
 BUILD_TARGETS[:] = makePathListAbsolute(BUILD_TARGETS)

-kconfig_actions = ('menuconfig',)
+kconfig_actions = (
+'menuconfig',
+'defconfig',
+)

 # From itertools-recipes:
 # docs.python.org/dev/library/itertools.html#itertools-recipes
@@ -632,6 +635,13 @@
 if kconfig_action == 'menuconfig':
 kconfig.menuconfig(env, kconfig_file.abspath,  
config_file.abspath,

 variant_path)
+elif kconfig_action == 'defconfig':
+defconfig_key = 'DEFCONFIG'
+defconfig_path = ARGUMENTS.get(defconfig_key, None)
+if not defconfig_path:
+error(f'Tried to defconfig, but {defconfig_key} not set.')
+kconfig.defconfig(env, kconfig_file.abspath,
+defconfig_path, config_file.abspath)
 else:
 error(f'Unrecognized kconfig action {kconfig_action}')
 Exit(0)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56949
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: I74c981b206849f08e60c2df702c06534c670cc7c
Gerrit-Change-Number: 56949
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s