From 0479569f6748202f1704d70aad3b03b3d17f6092 Mon Sep 17 00:00:00 2001 From: Joel Hestness Date: Tue, 19 May 2015 10:56:51 -0500 Subject: ruby: Fix RubySystem warm-up and cool-down scope The processes of warming up and cooling down Ruby caches are simulation-wide processes, not just RubySystem instance-specific processes. Thus, the warm-up and cool-down variables should be globally visible to any Ruby components participating in either process. Make these variables static members and track the warm-up and cool-down processes as appropriate. This patch also has two side benefits: 1) It removes references to the RubySystem g_system_ptr, which are problematic for allowing multiple RubySystem instances in a single simulation. Warmup and cooldown variables being static (global) reduces the need for instance-specific dereferences through the RubySystem. 2) From the AbstractController, it removes local RubySystem pointers, which are used inconsistently with other uses of the RubySystem: 11 other uses reference the RubySystem with the g_system_ptr. Only sequencers have local pointers. --- src/mem/ruby/system/System.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/mem/ruby/system/System.cc') diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index b93dacdfc..75ebc8caf 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -49,6 +49,11 @@ bool RubySystem::m_randomization; uint32_t RubySystem::m_block_size_bytes; uint32_t RubySystem::m_block_size_bits; uint32_t RubySystem::m_memory_size_bits; +bool RubySystem::m_warmup_enabled = false; +// To look forward to allowing multiple RubySystem instances, track the number +// of RubySystems that need to be warmed up on checkpoint restore. +unsigned RubySystem::m_systems_to_warmup = 0; +bool RubySystem::m_cooldown_enabled = false; RubySystem::RubySystem(const Params *p) : ClockedObject(p), m_access_backing_store(p->access_backing_store) @@ -65,9 +70,6 @@ RubySystem::RubySystem(const Params *p) m_block_size_bits = floorLog2(m_block_size_bytes); m_memory_size_bits = p->memory_size_bits; - m_warmup_enabled = false; - m_cooldown_enabled = false; - // Setup the global variables used in Ruby g_system_ptr = this; @@ -252,6 +254,7 @@ RubySystem::unserialize(Checkpoint *cp, const string §ion) readCompressedTrace(cache_trace_file, uncompressed_trace, cache_trace_size); m_warmup_enabled = true; + m_systems_to_warmup++; vector sequencer_map; Sequencer* t = NULL; @@ -307,7 +310,10 @@ RubySystem::startup() delete m_cache_recorder; m_cache_recorder = NULL; - m_warmup_enabled = false; + m_systems_to_warmup--; + if (m_systems_to_warmup == 0) { + m_warmup_enabled = false; + } // Restore eventq head eventq_head = eventq->replaceHead(eventq_head); @@ -322,9 +328,9 @@ RubySystem::startup() void RubySystem::RubyEvent::process() { - if (ruby_system->m_warmup_enabled) { + if (RubySystem::getWarmupEnabled()) { ruby_system->m_cache_recorder->enqueueNextFetchRequest(); - } else if (ruby_system->m_cooldown_enabled) { + } else if (RubySystem::getCooldownEnabled()) { ruby_system->m_cache_recorder->enqueueNextFlushRequest(); } } -- cgit v1.2.3