gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: dev-amdgpu: Call simulate() in cache recorder only in SE mode

VR
VISHNU RAMADAS (Gerrit)
Mon, Mar 27, 2023 5:38 PM

VISHNU RAMADAS has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/69301?usp=email )

Change subject: dev-amdgpu: Call simulate() in cache recorder only in SE
mode
......................................................................

dev-amdgpu: Call simulate() in cache recorder only in SE mode

RubySystem::memWriteback() records a cache trace and calls simulate()
after draining the event queue. This leads to errors during checkpointing
because the simulate() function expects the event queue to be non-empty.
This commit adds a check to ensure that simulate() is not called in
FullSystem mode so that any checkpointing operation in GPU-FS does not
end prematurely.

Change-Id: I0e86681993b47d8596351bdb43a3d6a32413428f

M src/mem/ruby/system/RubySystem.cc
M src/mem/ruby/system/RubySystem.hh
2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/mem/ruby/system/RubySystem.cc
b/src/mem/ruby/system/RubySystem.cc
index 91c4bc3..7383a2c 100644
--- a/src/mem/ruby/system/RubySystem.cc
+++ b/src/mem/ruby/system/RubySystem.cc
@@ -240,7 +240,9 @@
// Schedule an event to start cache cooldown
DPRINTF(RubyCacheTrace, "Starting cache flush\n");
enqueueRubyEvent(curTick());

  • simulate();
  • if (!FullSystem) {

  •    simulate();
    
  • }
    DPRINTF(RubyCacheTrace, "Cache flush complete\n");

    // Deschedule any events left on the event queue.
    

@@ -310,23 +312,24 @@
void
RubySystem::serialize(CheckpointOut &cp) const
{

  • // Store the cache-block size, so we are able to restore on systems
    with a
  • // different cache-block size. CacheRecorder depends on the correct
  • // cache-block size upon unserializing.
  • // Store the cache-block size, so we are able to restore on systems
  • // with a different cache-block size. CacheRecorder depends on the
  • // correct cache-block size upon unserializing.
    uint64_t block_size_bytes = getBlockSizeBytes();
    SERIALIZE_SCALAR(block_size_bytes);
  • // Check that there's a valid trace to use.  If not, then memory won't
    be
  • // up-to-date and the simulation will probably fail when restoring
    from the
  • // checkpoint.
  • // Check that there's a valid trace to use.  If not, then memory won't
  • // be up-to-date and the simulation will probably fail when restoring
  • // from the checkpoint.
    if (m_cache_recorder == NULL) {
  •    fatal("Call memWriteback() before serialize() to create ruby  
    

trace");

  •    fatal("Call memWriteback() before serialize() to create"
    
  •            "ruby trace");
    }
    
    // Aggregate the trace entries together into a single array
    uint8_t *raw_data = new uint8_t[4096];
    
  • uint64_t cache_trace_size =
    m_cache_recorder->aggregateRecords(&raw_data,
  •                                                             4096);
    
  • uint64_t cache_trace_size = m_cache_recorder->aggregateRecords(
  •                                                    &raw_data, 4096);
    std::string cache_trace_file = name() + ".cache.gz";
    writeCompressedTrace(raw_data, cache_trace_file, cache_trace_size);
    

diff --git a/src/mem/ruby/system/RubySystem.hh
b/src/mem/ruby/system/RubySystem.hh
index e16d699..264cca1 100644
--- a/src/mem/ruby/system/RubySystem.hh
+++ b/src/mem/ruby/system/RubySystem.hh
@@ -45,6 +45,7 @@
#include "mem/ruby/system/CacheRecorder.hh"
#include "params/RubySystem.hh"
#include "sim/clocked_object.hh"
+#include "sim/full_system.hh"

namespace gem5
{

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69301?usp=email
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: I0e86681993b47d8596351bdb43a3d6a32413428f
Gerrit-Change-Number: 69301
Gerrit-PatchSet: 1
Gerrit-Owner: VISHNU RAMADAS vramadas@wisc.edu
Gerrit-MessageType: newchange

VISHNU RAMADAS has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69301?usp=email ) Change subject: dev-amdgpu: Call simulate() in cache recorder only in SE mode ...................................................................... dev-amdgpu: Call simulate() in cache recorder only in SE mode RubySystem::memWriteback() records a cache trace and calls simulate() after draining the event queue. This leads to errors during checkpointing because the simulate() function expects the event queue to be non-empty. This commit adds a check to ensure that simulate() is not called in FullSystem mode so that any checkpointing operation in GPU-FS does not end prematurely. Change-Id: I0e86681993b47d8596351bdb43a3d6a32413428f --- M src/mem/ruby/system/RubySystem.cc M src/mem/ruby/system/RubySystem.hh 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mem/ruby/system/RubySystem.cc b/src/mem/ruby/system/RubySystem.cc index 91c4bc3..7383a2c 100644 --- a/src/mem/ruby/system/RubySystem.cc +++ b/src/mem/ruby/system/RubySystem.cc @@ -240,7 +240,9 @@ // Schedule an event to start cache cooldown DPRINTF(RubyCacheTrace, "Starting cache flush\n"); enqueueRubyEvent(curTick()); - simulate(); + if (!FullSystem) { + simulate(); + } DPRINTF(RubyCacheTrace, "Cache flush complete\n"); // Deschedule any events left on the event queue. @@ -310,23 +312,24 @@ void RubySystem::serialize(CheckpointOut &cp) const { - // Store the cache-block size, so we are able to restore on systems with a - // different cache-block size. CacheRecorder depends on the correct - // cache-block size upon unserializing. + // Store the cache-block size, so we are able to restore on systems + // with a different cache-block size. CacheRecorder depends on the + // correct cache-block size upon unserializing. uint64_t block_size_bytes = getBlockSizeBytes(); SERIALIZE_SCALAR(block_size_bytes); - // Check that there's a valid trace to use. If not, then memory won't be - // up-to-date and the simulation will probably fail when restoring from the - // checkpoint. + // Check that there's a valid trace to use. If not, then memory won't + // be up-to-date and the simulation will probably fail when restoring + // from the checkpoint. if (m_cache_recorder == NULL) { - fatal("Call memWriteback() before serialize() to create ruby trace"); + fatal("Call memWriteback() before serialize() to create" + "ruby trace"); } // Aggregate the trace entries together into a single array uint8_t *raw_data = new uint8_t[4096]; - uint64_t cache_trace_size = m_cache_recorder->aggregateRecords(&raw_data, - 4096); + uint64_t cache_trace_size = m_cache_recorder->aggregateRecords( + &raw_data, 4096); std::string cache_trace_file = name() + ".cache.gz"; writeCompressedTrace(raw_data, cache_trace_file, cache_trace_size); diff --git a/src/mem/ruby/system/RubySystem.hh b/src/mem/ruby/system/RubySystem.hh index e16d699..264cca1 100644 --- a/src/mem/ruby/system/RubySystem.hh +++ b/src/mem/ruby/system/RubySystem.hh @@ -45,6 +45,7 @@ #include "mem/ruby/system/CacheRecorder.hh" #include "params/RubySystem.hh" #include "sim/clocked_object.hh" +#include "sim/full_system.hh" namespace gem5 { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69301?usp=email 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: I0e86681993b47d8596351bdb43a3d6a32413428f Gerrit-Change-Number: 69301 Gerrit-PatchSet: 1 Gerrit-Owner: VISHNU RAMADAS <vramadas@wisc.edu> Gerrit-MessageType: newchange