From 7edab47448b1036952fe5c5ac3cdbf01bec3c048 Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Sun, 6 Feb 2011 22:14:19 -0800 Subject: [PATCH] ruby: numa bit fix for sparse memory --- configs/ruby/MOESI_hammer.py | 4 +++- configs/ruby/Ruby.py | 2 +- src/mem/ruby/system/DirectoryMemory.cc | 4 +--- src/mem/ruby/system/DirectoryMemory.py | 4 +++- src/mem/ruby/system/SparseMemory.cc | 7 +++++-- src/mem/ruby/system/SparseMemory.hh | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/configs/ruby/MOESI_hammer.py b/configs/ruby/MOESI_hammer.py index df1c1d3e7..d0552263e 100644 --- a/configs/ruby/MOESI_hammer.py +++ b/configs/ruby/MOESI_hammer.py @@ -164,7 +164,9 @@ def create_system(options, system, piobus, dma_devices): size = dir_size, use_map = options.use_map, map_levels = \ - options.map_levels), + options.map_levels, + numa_high_bit = \ + options.numa_high_bit), probeFilter = pf, memBuffer = mem_cntrl, probe_filter_enabled = options.pf_on, diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py index 398a18844..e5d3c4a7c 100644 --- a/configs/ruby/Ruby.py +++ b/configs/ruby/Ruby.py @@ -42,7 +42,7 @@ def define_options(parser): help="'fixed'|'flexible'") # ruby mapping options - parser.add_option("--numa-high-bit", type="int", default=None, + parser.add_option("--numa-high-bit", type="int", default=0, help="high order address bit to use for numa mapping. " \ "0 = highest bit, not specified = lowest bit") diff --git a/src/mem/ruby/system/DirectoryMemory.cc b/src/mem/ruby/system/DirectoryMemory.cc index 4a72dce33..c9d072c38 100644 --- a/src/mem/ruby/system/DirectoryMemory.cc +++ b/src/mem/ruby/system/DirectoryMemory.cc @@ -56,9 +56,7 @@ DirectoryMemory::init() m_num_entries = m_size_bytes / RubySystem::getBlockSizeBytes(); if (m_use_map) { - int entry_bits = floorLog2(m_num_entries); - assert(entry_bits >= m_map_levels); - m_sparseMemory = new SparseMemory(entry_bits, m_map_levels); + m_sparseMemory = new SparseMemory(m_map_levels); } else { m_entries = new Directory_Entry*[m_num_entries]; for (int i = 0; i < m_num_entries; i++) diff --git a/src/mem/ruby/system/DirectoryMemory.py b/src/mem/ruby/system/DirectoryMemory.py index 784ed628f..d3b6bc591 100644 --- a/src/mem/ruby/system/DirectoryMemory.py +++ b/src/mem/ruby/system/DirectoryMemory.py @@ -38,4 +38,6 @@ class RubyDirectoryMemory(SimObject): size = Param.MemorySize("1GB", "capacity in bytes") use_map = Param.Bool(False, "enable sparse memory") map_levels = Param.Int(4, "sparse memory map levels") - numa_high_bit = Param.Int(0, "numa high bit") + # the default value of the numa high bit is specified in the command line + # option and must be passed into the directory memory sim object + numa_high_bit = Param.Int("numa high bit") diff --git a/src/mem/ruby/system/SparseMemory.cc b/src/mem/ruby/system/SparseMemory.cc index 376852826..51d33798d 100644 --- a/src/mem/ruby/system/SparseMemory.cc +++ b/src/mem/ruby/system/SparseMemory.cc @@ -27,14 +27,17 @@ */ #include "mem/ruby/system/SparseMemory.hh" +#include "mem/ruby/system/System.hh" using namespace std; -SparseMemory::SparseMemory(int number_of_bits, int number_of_levels) +SparseMemory::SparseMemory(int number_of_levels) { int even_level_bits; int extra; - m_total_number_of_bits = number_of_bits; + m_total_number_of_bits = RubySystem::getMemorySizeBits() + - RubySystem::getBlockSizeBits();; + m_number_of_levels = number_of_levels; // diff --git a/src/mem/ruby/system/SparseMemory.hh b/src/mem/ruby/system/SparseMemory.hh index 0601a8ca5..78a3080a1 100644 --- a/src/mem/ruby/system/SparseMemory.hh +++ b/src/mem/ruby/system/SparseMemory.hh @@ -54,7 +54,7 @@ struct CurNextInfo class SparseMemory { public: - SparseMemory(int number_of_bits, int number_of_levels); + SparseMemory(int number_of_levels); ~SparseMemory(); void printConfig(std::ostream& out) { } -- 2.30.2