diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh --- a/src/mem/ruby/network/MessageBuffer.hh +++ b/src/mem/ruby/network/MessageBuffer.hh @@ -1,5 +1,6 @@ /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood + * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,7 +133,7 @@ m_ordering_set = true; } - void resize(unsigned int size) { m_max_size = size; } + void resize(unsigned int size); unsigned int getSize(); void setRandomization(bool random_flag) { m_randomization = random_flag; } # Node ID 15f1c291f866c42b7e86d88d016f76f93893cc66 # Parent f62f8ef219c9716c543987056cee9294732f6ec9 diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc --- a/src/mem/ruby/network/MessageBuffer.cc +++ b/src/mem/ruby/network/MessageBuffer.cc @@ -1,5 +1,6 @@ /* * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood + * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,6 +65,24 @@ m_vnet_id = 0; } +void +MessageBuffer::resize(unsigned int size) +{ + if (g_system_ptr->useInfiniteBuffers()) { + if (size != 0) { + warn("%s: Finite buffer size ignored " + "-- m_infinite_buffers in RubySystem is true", m_name); + } + assert(m_max_size == 0); + } else { + if (size == 0) { + warn("%s: Setting an infinite buffer while m_infinite_buffers " + "in RubySystem is false", m_name); + } + m_max_size = size; + } +} + unsigned int MessageBuffer::getSize() { diff --git a/src/mem/ruby/system/RubySystem.py b/src/mem/ruby/system/RubySystem.py --- a/src/mem/ruby/system/RubySystem.py +++ b/src/mem/ruby/system/RubySystem.py @@ -41,6 +41,8 @@ "default cache block size; must be a power of two"); memory_size_bits = Param.UInt32(64, "number of bits that a memory address requires"); + infinite_buffers = Param.Bool(True, + "Use infinite buffers (ignore attempts to change buffer size)"); # Profiler related configuration variables hot_lines = Param.Bool(False, "") diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh --- a/src/mem/ruby/system/System.hh +++ b/src/mem/ruby/system/System.hh @@ -1,5 +1,6 @@ /* * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood + * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,6 +75,7 @@ static uint32_t getBlockSizeBytes() { return m_block_size_bytes; } static uint32_t getBlockSizeBits() { return m_block_size_bits; } static uint32_t getMemorySizeBits() { return m_memory_size_bits; } + static int useInfiniteBuffers() { return m_infinite_buffers; } SimpleMemory *getPhysMem() { return m_phys_mem; } const bool getAccessBackingStore() { return m_access_backing_store; } @@ -125,6 +127,7 @@ static uint32_t m_block_size_bytes; static uint32_t m_block_size_bits; static uint32_t m_memory_size_bits; + static bool m_infinite_buffers; SimpleMemory *m_phys_mem; const bool m_access_backing_store; diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -1,5 +1,6 @@ /* * Copyright (c) 1999-2011 Mark D. Hill and David A. Wood + * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,6 +50,7 @@ uint32_t RubySystem::m_block_size_bytes; uint32_t RubySystem::m_block_size_bits; uint32_t RubySystem::m_memory_size_bits; +bool RubySystem::m_infinite_buffers; RubySystem::RubySystem(const Params *p) : ClockedObject(p), m_access_backing_store(p->access_backing_store) @@ -78,6 +80,7 @@ Stats::registerDumpCallback(new RubyStatsCallback(this)); // Create the profiler m_profiler = new Profiler(p); + m_infinite_buffers = p->infinite_buffers; m_phys_mem = p->phys_mem; } diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -623,7 +623,28 @@ code('$vid->setPriority(${{var["rank"]}})') # Set buffer size - code('$vid->resize(m_buffer_size);') + if "buffer_size" in var: + size = var["buffer_size"] + c = '' + if isinstance(size, str): + try: + # see if this is an integer + size = int(size) + c = "%s" % size + except ValueError: + # if not, it should be a member + c = "m_%s" % size + elif isinstance(size, int): + c = "%s" % size + else: + assert(isinstance(size, AST)) + func_code = code_formatter() + ret_type = size.generate(func_code) + assert(ret_type.isPrimitive) + c = str(func_code) + code('$vid->resize(${{c}});') + else: + code('$vid->resize(m_buffer_size);') if "recycle_latency" in var: code('$vid->setRecycleLatency( ' \