mem-cache: Make compression size threshold a percentage
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Tue, 17 Mar 2020 16:35:35 +0000 (17:35 +0100)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Mon, 31 Aug 2020 17:45:43 +0000 (17:45 +0000)
By changing the parameter into a percentage, changing the block
size will automatically reconfigure the size threshold. Also,
change the default percentage to 50% to avoid storing blocks
unlikely to co-allocate in compressed format.

Change-Id: I1458f19db39becc2d40c00269132fea01770016f
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33385
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/cache/compressors/Compressors.py
src/mem/cache/compressors/base.cc

index 01cb619752e703c1710abef95a77fec596bdf576..9fa06f210a73058eb716ef6f73fcdf5b87e161df 100644 (file)
@@ -37,9 +37,9 @@ class BaseCacheCompressor(SimObject):
     block_size = Param.Int(Parent.cache_line_size, "Block size in bytes")
     chunk_size_bits = Param.Unsigned(32,
         "Size of a parsing data chunk (in bits)")
-    size_threshold = Param.Unsigned(Parent.cache_line_size, "Minimum size, "
-        "in bytes, in which a block must be compressed to. Otherwise it is "
-        "stored in its uncompressed state")
+    size_threshold_percentage = Param.Percent(50,
+        "Minimum percentage of the block size, a compressed block must "
+        "achieve to be stored in compressed format")
 
 class BaseDictionaryCompressor(BaseCacheCompressor):
     type = 'BaseDictionaryCompressor'
index 5b96e97b6fe6caa9561c04639228da167b5b60a3..e12e36e182d641b0925a6bc6122605b07daafcb4 100644 (file)
@@ -77,7 +77,7 @@ Base::CompressionData::getSize() const
 
 Base::Base(const Params *p)
   : SimObject(p), blkSize(p->block_size), chunkSizeBits(p->chunk_size_bits),
-    sizeThreshold(p->size_threshold),
+    sizeThreshold((blkSize * p->size_threshold_percentage) / 100),
     stats(*this)
 {
     fatal_if(64 % chunkSizeBits,