mem-ruby: Add BUILD_GPU guard to ruby cooldown and warmup phases
Ruby was recently updated to support flushes and warmup for GPUs. Since this support uses the GPUCoalescer, non-GPU builds face a compile time issue. This is because GPU code is not built for non-GPU builds. This commit addes "#if BUILD_GPU" guards around the GPU-related code in common files like AbstractController.hh, CacheRecorder.*, RubySystem.cc, GPUCoalescer.hh, and VIPERCoalescer.hh. This support allows GPU builds to use flushing while non-GPU builds compile without problems Change-Id: If8ee4ff881fe154553289e8c00881ee1b6e3f113
This commit is contained in:
@@ -70,7 +70,9 @@ namespace ruby
|
||||
{
|
||||
|
||||
class Network;
|
||||
#ifdef BUILD_GPU
|
||||
class GPUCoalescer;
|
||||
#endif
|
||||
class DMASequencer;
|
||||
|
||||
// used to communicate that an in_port peeked the wrong message type
|
||||
|
||||
@@ -57,6 +57,7 @@ CacheRecorder::CacheRecorder()
|
||||
{
|
||||
}
|
||||
|
||||
#if BUILD_GPU
|
||||
CacheRecorder::CacheRecorder(uint8_t* uncompressed_trace,
|
||||
uint64_t uncompressed_trace_size,
|
||||
std::vector<Sequencer*>& seq_map,
|
||||
@@ -67,6 +68,18 @@ CacheRecorder::CacheRecorder(uint8_t* uncompressed_trace,
|
||||
m_seq_map(seq_map), m_coalescer_map(coal_map), m_bytes_read(0),
|
||||
m_records_read(0), m_records_flushed(0),
|
||||
m_block_size_bytes(block_size_bytes)
|
||||
#else
|
||||
CacheRecorder::CacheRecorder(uint8_t* uncompressed_trace,
|
||||
uint64_t uncompressed_trace_size,
|
||||
std::vector<Sequencer*>& seq_map,
|
||||
uint64_t block_size_bytes)
|
||||
: m_uncompressed_trace(uncompressed_trace),
|
||||
m_uncompressed_trace_size(uncompressed_trace_size),
|
||||
m_seq_map(seq_map), m_bytes_read(0),
|
||||
m_records_read(0), m_records_flushed(0),
|
||||
m_block_size_bytes(block_size_bytes)
|
||||
|
||||
#endif
|
||||
{
|
||||
if (m_uncompressed_trace != NULL) {
|
||||
if (m_block_size_bytes < RubySystem::getBlockSizeBytes()) {
|
||||
@@ -86,7 +99,9 @@ CacheRecorder::~CacheRecorder()
|
||||
m_uncompressed_trace = NULL;
|
||||
}
|
||||
m_seq_map.clear();
|
||||
#if BUILD_GPU
|
||||
m_coalescer_map.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -102,14 +117,20 @@ CacheRecorder::enqueueNextFlushRequest()
|
||||
Packet *pkt = new Packet(req, requestType);
|
||||
|
||||
Sequencer* m_sequencer_ptr = m_seq_map[rec->m_cntrl_id];
|
||||
#if BUILD_GPU
|
||||
GPUCoalescer* m_coal_ptr = m_coalescer_map[rec->m_cntrl_id];
|
||||
#endif
|
||||
assert(m_sequencer_ptr != NULL);
|
||||
#if BUILD_GPU
|
||||
if (m_coal_ptr == NULL)
|
||||
m_sequencer_ptr->makeRequest(pkt);
|
||||
else {
|
||||
pkt->req->setReqInstSeqNum(m_records_flushed - 1);
|
||||
m_coal_ptr->makeRequest(pkt);
|
||||
}
|
||||
#else
|
||||
m_sequencer_ptr->makeRequest(pkt);
|
||||
#endif
|
||||
|
||||
DPRINTF(RubyCacheTrace, "Flushing %s\n", *rec);
|
||||
|
||||
@@ -159,15 +180,21 @@ CacheRecorder::enqueueNextFetchRequest()
|
||||
pkt->dataStatic(traceRecord->m_data + rec_bytes_read);
|
||||
|
||||
Sequencer* m_sequencer_ptr = m_seq_map[traceRecord->m_cntrl_id];
|
||||
#if BUILD_GPU
|
||||
GPUCoalescer* m_coal_ptr;
|
||||
m_coal_ptr = m_coalescer_map[traceRecord->m_cntrl_id];
|
||||
#endif
|
||||
assert(m_sequencer_ptr != NULL);
|
||||
#if BUILD_GPU
|
||||
if (m_coal_ptr == NULL)
|
||||
m_sequencer_ptr->makeRequest(pkt);
|
||||
else {
|
||||
pkt->req->setReqInstSeqNum(m_records_read);
|
||||
m_coal_ptr->makeRequest(pkt);
|
||||
}
|
||||
#else
|
||||
m_sequencer_ptr->makeRequest(pkt);
|
||||
#endif
|
||||
}
|
||||
|
||||
m_bytes_read += (sizeof(TraceRecord) + m_block_size_bytes);
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/types.hh"
|
||||
#include "config/build_gpu.hh"
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include "mem/ruby/common/DataBlock.hh"
|
||||
#include "mem/ruby/common/TypeDefines.hh"
|
||||
@@ -50,7 +51,9 @@ namespace ruby
|
||||
{
|
||||
|
||||
class Sequencer;
|
||||
#if BUILD_GPU
|
||||
class GPUCoalescer;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Class for recording cache contents. Note that the last element of the
|
||||
@@ -77,11 +80,18 @@ class CacheRecorder
|
||||
CacheRecorder();
|
||||
~CacheRecorder();
|
||||
|
||||
#if BUILD_GPU
|
||||
CacheRecorder(uint8_t* uncompressed_trace,
|
||||
uint64_t uncompressed_trace_size,
|
||||
std::vector<Sequencer*>& SequencerMap,
|
||||
std::vector<GPUCoalescer*>& CoalescerMap,
|
||||
uint64_t block_size_bytes);
|
||||
#else
|
||||
CacheRecorder(uint8_t* uncompressed_trace,
|
||||
uint64_t uncompressed_trace_size,
|
||||
std::vector<Sequencer*>& SequencerMap,
|
||||
uint64_t block_size_bytes);
|
||||
#endif
|
||||
void addRecord(int cntrl, Addr data_addr, Addr pc_addr,
|
||||
RubyRequestType type, Tick time, DataBlock& data);
|
||||
|
||||
@@ -117,7 +127,9 @@ class CacheRecorder
|
||||
uint8_t* m_uncompressed_trace;
|
||||
uint64_t m_uncompressed_trace_size;
|
||||
std::vector<Sequencer*> m_seq_map;
|
||||
#if BUILD_GPU
|
||||
std::vector<GPUCoalescer*> m_coalescer_map;
|
||||
#endif
|
||||
uint64_t m_bytes_read;
|
||||
uint64_t m_records_read;
|
||||
uint64_t m_records_flushed;
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
#ifndef __MEM_RUBY_SYSTEM_GPU_COALESCER_HH__
|
||||
#define __MEM_RUBY_SYSTEM_GPU_COALESCER_HH__
|
||||
|
||||
#include "config/build_gpu.hh"
|
||||
|
||||
#if BUILD_GPU
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -546,4 +550,5 @@ operator<<(std::ostream& out, const GPUCoalescer& obj)
|
||||
} // namespace ruby
|
||||
} // namespace gem5
|
||||
|
||||
#endif // BUILD_GPU
|
||||
#endif // __MEM_RUBY_SYSTEM_GPU_COALESCER_HH__
|
||||
|
||||
@@ -178,21 +178,27 @@ RubySystem::makeCacheRecorder(uint8_t *uncompressed_trace,
|
||||
uint64_t block_size_bytes)
|
||||
{
|
||||
std::vector<Sequencer*> sequencer_map;
|
||||
#if BUILD_GPU
|
||||
std::vector<GPUCoalescer*> coalescer_map;
|
||||
Sequencer* sequencer_ptr = NULL;
|
||||
GPUCoalescer* coalescer_ptr = NULL;
|
||||
#endif
|
||||
Sequencer* sequencer_ptr = NULL;
|
||||
|
||||
for (int cntrl = 0; cntrl < m_abs_cntrl_vec.size(); cntrl++) {
|
||||
sequencer_map.push_back(m_abs_cntrl_vec[cntrl]->getCPUSequencer());
|
||||
#if BUILD_GPU
|
||||
coalescer_map.push_back(m_abs_cntrl_vec[cntrl]->getGPUCoalescer());
|
||||
#endif
|
||||
|
||||
if (sequencer_ptr == NULL) {
|
||||
sequencer_ptr = sequencer_map[cntrl];
|
||||
}
|
||||
|
||||
#if BUILD_GPU
|
||||
if (coalescer_ptr == NULL) {
|
||||
coalescer_ptr = coalescer_map[cntrl];
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -203,9 +209,11 @@ RubySystem::makeCacheRecorder(uint8_t *uncompressed_trace,
|
||||
sequencer_map[cntrl] = sequencer_ptr;
|
||||
}
|
||||
|
||||
#if BUILD_GPU
|
||||
if (coalescer_map[cntrl] == NULL) {
|
||||
coalescer_map[cntrl] = coalescer_ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -215,9 +223,15 @@ RubySystem::makeCacheRecorder(uint8_t *uncompressed_trace,
|
||||
}
|
||||
|
||||
// Create the CacheRecorder and record the cache trace
|
||||
#if BUILD_GPU
|
||||
m_cache_recorder = new CacheRecorder(uncompressed_trace, cache_trace_size,
|
||||
sequencer_map, coalescer_map,
|
||||
block_size_bytes);
|
||||
#else
|
||||
m_cache_recorder = new CacheRecorder(uncompressed_trace, cache_trace_size,
|
||||
sequencer_map,
|
||||
block_size_bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
#ifndef __MEM_RUBY_SYSTEM_VIPERCOALESCER_HH__
|
||||
#define __MEM_RUBY_SYSTEM_VIPERCOALESCER_HH__
|
||||
|
||||
#include "config/build_gpu.hh"
|
||||
|
||||
#if BUILD_GPU
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
@@ -92,4 +96,5 @@ class VIPERCoalescer : public GPUCoalescer
|
||||
} // namespace ruby
|
||||
} // namespace gem5
|
||||
|
||||
#endif // BUILD_GPU
|
||||
#endif //__MEM_RUBY_SYSTEM_VIPERCOALESCER_HH__
|
||||
|
||||
Reference in New Issue
Block a user