From e496d29171c0dac56432fde3a7bc76bb92350ca2 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Wed, 18 Oct 2023 15:18:43 +0100 Subject: [PATCH 1/3] stdlib: Explicitly set alloc_on_atomic for the CHI example gem5 will otherwise fatal with the error message: fatal: ... alloc_on_atomic without default or user set value See github issue [1] for further details [1]: https://github.com/gem5/gem5/issues/449 Change-Id: I0bb8fccf0ac6d60fc6c1229436a35e91b2fb45cd Signed-off-by: Giacomo Travaglini --- .../gem5/components/cachehierarchies/chi/nodes/directory.py | 1 + .../gem5/components/cachehierarchies/chi/nodes/dma_requestor.py | 1 + .../cachehierarchies/chi/nodes/private_l1_moesi_cache.py | 1 + 3 files changed, 3 insertions(+) diff --git a/src/python/gem5/components/cachehierarchies/chi/nodes/directory.py b/src/python/gem5/components/cachehierarchies/chi/nodes/directory.py index 3488435d56..b93112a620 100644 --- a/src/python/gem5/components/cachehierarchies/chi/nodes/directory.py +++ b/src/python/gem5/components/cachehierarchies/chi/nodes/directory.py @@ -72,6 +72,7 @@ class SimpleDirectory(AbstractNode): self.alloc_on_readunique = False self.alloc_on_readonce = False self.alloc_on_writeback = False + self.alloc_on_atomic = False self.dealloc_on_unique = False self.dealloc_on_shared = False self.dealloc_backinv_unique = False diff --git a/src/python/gem5/components/cachehierarchies/chi/nodes/dma_requestor.py b/src/python/gem5/components/cachehierarchies/chi/nodes/dma_requestor.py index ccac6cae91..f6b63e0649 100644 --- a/src/python/gem5/components/cachehierarchies/chi/nodes/dma_requestor.py +++ b/src/python/gem5/components/cachehierarchies/chi/nodes/dma_requestor.py @@ -56,6 +56,7 @@ class DMARequestor(AbstractNode): self.alloc_on_readunique = False self.alloc_on_readonce = False self.alloc_on_writeback = False + self.alloc_on_atomic = False self.dealloc_on_unique = False self.dealloc_on_shared = False self.dealloc_backinv_unique = True diff --git a/src/python/gem5/components/cachehierarchies/chi/nodes/private_l1_moesi_cache.py b/src/python/gem5/components/cachehierarchies/chi/nodes/private_l1_moesi_cache.py index 3e38c9038f..2f618491ca 100644 --- a/src/python/gem5/components/cachehierarchies/chi/nodes/private_l1_moesi_cache.py +++ b/src/python/gem5/components/cachehierarchies/chi/nodes/private_l1_moesi_cache.py @@ -66,6 +66,7 @@ class PrivateL1MOESICache(AbstractNode): self.alloc_on_readunique = True self.alloc_on_readonce = True self.alloc_on_writeback = False # Should never happen in an L1 + self.alloc_on_atomic = False self.dealloc_on_unique = False self.dealloc_on_shared = False self.dealloc_backinv_unique = True From 1b05c0050bdee2024d89b4a083b793af7ae1fbd9 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Sat, 28 Oct 2023 22:59:51 +0100 Subject: [PATCH 2/3] mem-ruby: Clear the atomic log from the DataBlock in CHI The new far atomics implementation [1] didn't take into consideration it was supposed to manually clear the atomic log. This caused a memory leak where the log queue was getting bigger and bigger as no cleaning was happening [1]: https://github.com/gem5/gem5/pull/177 Change-Id: I4a74fbf15d21e35caec69c29117e2d98cc86d5ff Signed-off-by: Giacomo Travaglini --- src/mem/ruby/protocol/chi/CHI-cache-actions.sm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mem/ruby/protocol/chi/CHI-cache-actions.sm b/src/mem/ruby/protocol/chi/CHI-cache-actions.sm index 4c9498423c..ffa57cb03b 100644 --- a/src/mem/ruby/protocol/chi/CHI-cache-actions.sm +++ b/src/mem/ruby/protocol/chi/CHI-cache-actions.sm @@ -2299,6 +2299,7 @@ action(UpdateDataState_FromADataResp, desc="") { tbe.oldDataBlk := tbe.dataBlk; tbe.dataBlk.atomicPartial(tbe.dataBlk, tbe.atomic_op); + tbe.dataBlk.clearAtomicLogEntries(); tbe.dataDirty := true; DPRINTF(RubySlicc, "Atomic after %s\n", tbe.dataBlk); @@ -3424,6 +3425,7 @@ action(Callback_AtomicHit, desc="") { DataBlock oldDataBlk; oldDataBlk := tbe.dataBlk; tbe.dataBlk.atomicPartial(tbe.dataBlk, tbe.atomic_op); + tbe.dataBlk.clearAtomicLogEntries(); sequencer.atomicCallback(tbe.addr, oldDataBlk, false); DPRINTF(RubySlicc, "Atomic after %s\n", tbe.dataBlk); @@ -3490,6 +3492,7 @@ action(Callback_Miss, desc="") { DataBlock oldDataBlk; oldDataBlk := tbe.dataBlk; tbe.dataBlk.atomicPartial(tbe.dataBlk, tbe.atomic_op); + tbe.dataBlk.clearAtomicLogEntries(); sequencer.atomicCallback(tbe.addr, oldDataBlk, false); DPRINTF(RubySlicc, "Atomic after %s\n", tbe.dataBlk); From 108704169810fa0b444d7eedae070a8621a55760 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Sun, 29 Oct 2023 08:27:19 +0000 Subject: [PATCH 3/3] stdlib: Use near atomics in the CHI component nodes This is a temporary solution to fix daily tests. We could revert to the default (policy_type = 1) once the problem is properly fixed Change-Id: Ia80af9a7d84d5c777ddeb441110a91a1680c1030 Signed-off-by: Giacomo Travaglini --- .../components/cachehierarchies/chi/nodes/abstract_node.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python/gem5/components/cachehierarchies/chi/nodes/abstract_node.py b/src/python/gem5/components/cachehierarchies/chi/nodes/abstract_node.py index 746c66eb01..ed8c3e0d5a 100644 --- a/src/python/gem5/components/cachehierarchies/chi/nodes/abstract_node.py +++ b/src/python/gem5/components/cachehierarchies/chi/nodes/abstract_node.py @@ -85,6 +85,9 @@ class AbstractNode(Cache_Controller): # Use 32-byte channels (two flits per message) self.data_channel_size = 32 + # Use near atomics (see: https://github.com/gem5/gem5/issues/449) + self.policy_type = 0 + self.connectQueues(network) def getBlockSizeBits(self):