From 6aa9db28f1968676b5be165d06ac1d418490dc6e Mon Sep 17 00:00:00 2001 From: Vishnu Ramadas Date: Fri, 6 Dec 2024 18:41:03 -0600 Subject: [PATCH] mem-ruby: Fix segfault in pa_performAtomics in GPU_VIPER-TCC.sm When the cache is performing an atomics and receives data, it performs. pa_performAtomic. This action peeks into the coreRequest queue to check the messaage type. This queue, however, is already dequeued in the transition that precedes the one that contains pa_performAtomic. When pa_performAtomic is called, the simulation crashes. This commit fixes the crash by using the TBE entry information instead of peeking when TBE entry exists, and peeking when it doesn't --- src/mem/ruby/protocol/GPU_VIPER-TCC.sm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/mem/ruby/protocol/GPU_VIPER-TCC.sm b/src/mem/ruby/protocol/GPU_VIPER-TCC.sm index 602c3c0a97..590c7c6055 100644 --- a/src/mem/ruby/protocol/GPU_VIPER-TCC.sm +++ b/src/mem/ruby/protocol/GPU_VIPER-TCC.sm @@ -933,14 +933,18 @@ machine(MachineType:TCC, "TCC Cache") } action(pa_performAtomic, "pa", desc="Perform atomic") { - peek(coreRequestNetwork_in, CPURequestMsg) { - if ((is_valid(tbe) && tbe.atomicDataReturn) || in_msg.Type == CoherenceRequestType:AtomicReturn) { - cache_entry.DataBlk.atomicPartial(cache_entry.DataBlk, cache_entry.writeMask, false); - } else { - // Set the isAtomicNoReturn flag to ensure that logs are not - // generated erroneously - assert((is_valid(tbe) && tbe.atomicDataNoReturn) || in_msg.Type == CoherenceRequestType:AtomicNoReturn); - cache_entry.DataBlk.atomicPartial(cache_entry.DataBlk, cache_entry.writeMask, true); + if (is_valid(tbe) && tbe.atomicDataReturn) { + cache_entry.DataBlk.atomicPartial(cache_entry.DataBlk, cache_entry.writeMask, false); + } else if (is_valid(tbe) && tbe.atomicDataNoReturn) { + cache_entry.DataBlk.atomicPartial(cache_entry.DataBlk, cache_entry.writeMask, true); + } else { + peek(coreRequestNetwork_in, CPURequestMsg) { + if (in_msg.Type == CoherenceRequestType:AtomicReturn) { + cache_entry.DataBlk.atomicPartial(cache_entry.DataBlk, cache_entry.writeMask, false); + } else { + assert(in_msg.Type == CoherenceRequestType:AtomicNoReturn); + cache_entry.DataBlk.atomicPartial(cache_entry.DataBlk, cache_entry.writeMask, true); + } } } }