BaseTags *tags;
/** Compression method being used. */
- BaseCacheCompressor* compressor;
+ Compressor::Base* compressor;
/** Prefetcher */
Prefetcher::Base *prefetcher;
-# Copyright (c) 2018 Inria
+# Copyright (c) 2018-2020 Inria
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
class BaseCacheCompressor(SimObject):
type = 'BaseCacheCompressor'
abstract = True
+ cxx_class = 'Compressor::Base'
cxx_header = "mem/cache/compressors/base.hh"
block_size = Param.Int(Parent.cache_line_size, "Block size in bytes")
class BaseDictionaryCompressor(BaseCacheCompressor):
type = 'BaseDictionaryCompressor'
abstract = True
+ cxx_class = 'Compressor::BaseDictionaryCompressor'
cxx_header = "mem/cache/compressors/dictionary_compressor.hh"
dictionary_size = Param.Int(Parent.cache_line_size,
class Base64Delta8(BaseDictionaryCompressor):
type = 'Base64Delta8'
- cxx_class = 'Base64Delta8'
+ cxx_class = 'Compressor::Base64Delta8'
cxx_header = "mem/cache/compressors/base_delta.hh"
class Base64Delta16(BaseDictionaryCompressor):
type = 'Base64Delta16'
- cxx_class = 'Base64Delta16'
+ cxx_class = 'Compressor::Base64Delta16'
cxx_header = "mem/cache/compressors/base_delta.hh"
class Base64Delta32(BaseDictionaryCompressor):
type = 'Base64Delta32'
- cxx_class = 'Base64Delta32'
+ cxx_class = 'Compressor::Base64Delta32'
cxx_header = "mem/cache/compressors/base_delta.hh"
class Base32Delta8(BaseDictionaryCompressor):
type = 'Base32Delta8'
- cxx_class = 'Base32Delta8'
+ cxx_class = 'Compressor::Base32Delta8'
cxx_header = "mem/cache/compressors/base_delta.hh"
class Base32Delta16(BaseDictionaryCompressor):
type = 'Base32Delta16'
- cxx_class = 'Base32Delta16'
+ cxx_class = 'Compressor::Base32Delta16'
cxx_header = "mem/cache/compressors/base_delta.hh"
class Base16Delta8(BaseDictionaryCompressor):
type = 'Base16Delta8'
- cxx_class = 'Base16Delta8'
+ cxx_class = 'Compressor::Base16Delta8'
cxx_header = "mem/cache/compressors/base_delta.hh"
class CPack(BaseDictionaryCompressor):
type = 'CPack'
- cxx_class = 'CPack'
+ cxx_class = 'Compressor::CPack'
cxx_header = "mem/cache/compressors/cpack.hh"
class FPCD(BaseDictionaryCompressor):
type = 'FPCD'
- cxx_class = 'FPCD'
+ cxx_class = 'Compressor::FPCD'
cxx_header = "mem/cache/compressors/fpcd.hh"
dictionary_size = 2
class MultiCompressor(BaseCacheCompressor):
type = 'MultiCompressor'
- cxx_class = 'MultiCompressor'
+ cxx_class = 'Compressor::Multi'
cxx_header = "mem/cache/compressors/multi.hh"
# Dummy default compressor list. This might not be an optimal choice,
class PerfectCompressor(BaseCacheCompressor):
type = 'PerfectCompressor'
- cxx_class = 'PerfectCompressor'
+ cxx_class = 'Compressor::Perfect'
cxx_header = "mem/cache/compressors/perfect.hh"
max_compression_ratio = Param.Int(2,
class RepeatedQwordsCompressor(BaseDictionaryCompressor):
type = 'RepeatedQwordsCompressor'
- cxx_class = 'RepeatedQwordsCompressor'
+ cxx_class = 'Compressor::RepeatedQwords'
cxx_header = "mem/cache/compressors/repeated_qwords.hh"
class ZeroCompressor(BaseDictionaryCompressor):
type = 'ZeroCompressor'
- cxx_class = 'ZeroCompressor'
+ cxx_class = 'Compressor::Zero'
cxx_header = "mem/cache/compressors/zero.hh"
class BDI(MultiCompressor):
/*
- * Copyright (c) 2018 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/tags/super_blk.hh"
#include "params/BaseCacheCompressor.hh"
+namespace Compressor {
+
// Uncomment this line if debugging compression
//#define DEBUG_COMPRESSION
-BaseCacheCompressor::CompressionData::CompressionData()
+Base::CompressionData::CompressionData()
: _size(0)
{
}
-BaseCacheCompressor::CompressionData::~CompressionData()
+Base::CompressionData::~CompressionData()
{
}
void
-BaseCacheCompressor::CompressionData::setSizeBits(std::size_t size)
+Base::CompressionData::setSizeBits(std::size_t size)
{
_size = size;
}
std::size_t
-BaseCacheCompressor::CompressionData::getSizeBits() const
+Base::CompressionData::getSizeBits() const
{
return _size;
}
std::size_t
-BaseCacheCompressor::CompressionData::getSize() const
+Base::CompressionData::getSize() const
{
return std::ceil(_size/8);
}
-BaseCacheCompressor::BaseCacheCompressor(const Params *p)
+Base::Base(const Params *p)
: SimObject(p), blkSize(p->block_size), sizeThreshold(p->size_threshold),
stats(*this)
{
}
void
-BaseCacheCompressor::compress(const uint64_t* data, Cycles& comp_lat,
+Base::compress(const uint64_t* data, Cycles& comp_lat,
Cycles& decomp_lat, std::size_t& comp_size_bits)
{
// Apply compression
}
Cycles
-BaseCacheCompressor::getDecompressionLatency(const CacheBlk* blk)
+Base::getDecompressionLatency(const CacheBlk* blk)
{
const CompressionBlk* comp_blk = static_cast<const CompressionBlk*>(blk);
}
void
-BaseCacheCompressor::setDecompressionLatency(CacheBlk* blk, const Cycles lat)
+Base::setDecompressionLatency(CacheBlk* blk, const Cycles lat)
{
// Sanity check
assert(blk != nullptr);
}
void
-BaseCacheCompressor::setSizeBits(CacheBlk* blk, const std::size_t size_bits)
+Base::setSizeBits(CacheBlk* blk, const std::size_t size_bits)
{
// Sanity check
assert(blk != nullptr);
static_cast<CompressionBlk*>(blk)->setSizeBits(size_bits);
}
-BaseCacheCompressor::BaseCacheCompressorStats::BaseCacheCompressorStats(
- BaseCacheCompressor& _compressor)
+Base::BaseStats::BaseStats(Base& _compressor)
: Stats::Group(&_compressor), compressor(_compressor),
compressions(this, "compressions",
"Total number of compressions"),
}
void
-BaseCacheCompressor::BaseCacheCompressorStats::regStats()
+Base::BaseStats::regStats()
{
Stats::Group::regStats();
avgCompressionSizeBits = compressionSizeBits / compressions;
}
+} // namespace Compressor
/*
- * Copyright (c) 2018 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
class CacheBlk;
struct BaseCacheCompressorParams;
+namespace Compressor {
+
/**
* Base cache compressor interface. Every cache compressor must implement a
* compression and a decompression method.
*/
-class BaseCacheCompressor : public SimObject
+class Base : public SimObject
{
protected:
/**
* This compressor must be able to access the protected functions of
* its sub-compressors.
*/
- friend class MultiCompressor;
+ friend class Multi;
/**
* Forward declaration of compression data. Every new compressor must
*/
const std::size_t sizeThreshold;
- struct BaseCacheCompressorStats : public Stats::Group
+ struct BaseStats : public Stats::Group
{
- const BaseCacheCompressor& compressor;
+ const Base& compressor;
- BaseCacheCompressorStats(BaseCacheCompressor& compressor);
+ BaseStats(Base& compressor);
void regStats() override;
uint64_t* cache_line) = 0;
public:
- /** Convenience typedef. */
- typedef BaseCacheCompressorParams Params;
-
- /**
- * Default constructor.
- */
- BaseCacheCompressor(const Params *p);
-
- /**
- * Default destructor.
- */
- virtual ~BaseCacheCompressor() {};
+ typedef BaseCacheCompressorParams Params;
+ Base(const Params *p);
+ virtual ~Base() = default;
/**
* Apply the compression process to the cache line. Ignores compression
static void setSizeBits(CacheBlk* blk, const std::size_t size_bits);
};
-class BaseCacheCompressor::CompressionData {
+class Base::CompressionData
+{
private:
/**
* Compressed cache line size (in bits).
std::size_t getSize() const;
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_BASE_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "params/Base64Delta32.hh"
#include "params/Base64Delta8.hh"
+namespace Compressor {
+
Base64Delta8::Base64Delta8(const Params *p)
: BaseDelta<uint64_t, 8>(p)
{
{
}
-Base64Delta8*
+} // namespace Compressor
+
+Compressor::Base64Delta8*
Base64Delta8Params::create()
{
- return new Base64Delta8(this);
+ return new Compressor::Base64Delta8(this);
}
-Base64Delta16*
+Compressor::Base64Delta16*
Base64Delta16Params::create()
{
- return new Base64Delta16(this);
+ return new Compressor::Base64Delta16(this);
}
-Base64Delta32*
+Compressor::Base64Delta32*
Base64Delta32Params::create()
{
- return new Base64Delta32(this);
+ return new Compressor::Base64Delta32(this);
}
-Base32Delta8*
+Compressor::Base32Delta8*
Base32Delta8Params::create()
{
- return new Base32Delta8(this);
+ return new Compressor::Base32Delta8(this);
}
-Base32Delta16*
+Compressor::Base32Delta16*
Base32Delta16Params::create()
{
- return new Base32Delta16(this);
+ return new Compressor::Base32Delta16(this);
}
-Base16Delta8*
+Compressor::Base16Delta8*
Base16Delta8Params::create()
{
- return new Base16Delta8(this);
+ return new Compressor::Base16Delta8(this);
}
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct Base32Delta16Params;
struct Base16Delta8Params;
+namespace Compressor {
+
/**
* Base class for all base-delta-immediate compressors. Although not proposed
* like this in the original paper, the sub-compressors of BDI are dictionary
void addToDictionary(DictionaryEntry data) override;
- std::unique_ptr<BaseCacheCompressor::CompressionData>
+ std::unique_ptr<Base::CompressionData>
compress(const uint64_t* data, Cycles& comp_lat,
Cycles& decomp_lat) override;
~Base16Delta8() = default;
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_BASE_DELTA_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/base_delta.hh"
#include "mem/cache/compressors/dictionary_compressor_impl.hh"
+namespace Compressor {
+
template <class BaseType, std::size_t DeltaSizeBits>
BaseDelta<BaseType, DeltaSizeBits>::BaseDelta(const Params *p)
: DictionaryCompressor<BaseType>(p)
}
template <class BaseType, std::size_t DeltaSizeBits>
-std::unique_ptr<BaseCacheCompressor::CompressionData>
+std::unique_ptr<Base::CompressionData>
BaseDelta<BaseType, DeltaSizeBits>::compress(const uint64_t* data,
Cycles& comp_lat, Cycles& decomp_lat)
{
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
+ std::unique_ptr<Base::CompressionData> comp_data =
DictionaryCompressor<BaseType>::compress(data);
// If there are more bases than the maximum, the compressor failed.
return comp_data;
}
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_BASE_DELTA_IMPL_HH__
/*
- * Copyright (c) 2018-2019 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/dictionary_compressor.hh"
#include "params/BaseDictionaryCompressor.hh"
+namespace Compressor {
+
BaseDictionaryCompressor::BaseDictionaryCompressor(const Params *p)
- : BaseCacheCompressor(p), dictionarySize(p->dictionary_size), numEntries(0)
+ : Base(p), dictionarySize(p->dictionary_size), numEntries(0)
{
}
void
BaseDictionaryCompressor::regStats()
{
- BaseCacheCompressor::regStats();
+ Base::regStats();
// We store the frequency of each pattern
patternStats
getName(i));
}
}
+
+} // namespace Compressor
/*
- * Copyright (c) 2018-2019 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/dictionary_compressor_impl.hh"
#include "params/CPack.hh"
+namespace Compressor {
+
CPack::CPack(const Params *p)
: DictionaryCompressor<uint32_t>(p)
{
dictionary[numEntries++] = data;
}
-std::unique_ptr<BaseCacheCompressor::CompressionData>
+std::unique_ptr<Base::CompressionData>
CPack::compress(const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat)
{
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
+ std::unique_ptr<Base::CompressionData> comp_data =
DictionaryCompressor<uint32_t>::compress(data);
// Set compression latency (Accounts for pattern matching, length
return comp_data;
}
-CPack*
+} // namespace Compressor
+
+Compressor::CPack*
CPackParams::create()
{
- return new CPack(this);
+ return new Compressor::CPack(this);
}
/*
- * Copyright (c) 2018-2019 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct CPackParams;
+namespace Compressor {
+
class CPack : public DictionaryCompressor<uint32_t>
{
private:
* @param decomp_lat Decompression latency in number of cycles.
* @return Cache line after compression.
*/
- std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
+ std::unique_ptr<Base::CompressionData> compress(
const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat) override;
public:
}
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_CPACK_HH__
/*
- * Copyright (c) 2018-2019 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct BaseDictionaryCompressorParams;
-class BaseDictionaryCompressor : public BaseCacheCompressor
+namespace Compressor {
+
+class BaseDictionaryCompressor : public Base
{
protected:
/** Dictionary size. */
* @param data The cache line to be compressed.
* @return Cache line after compression.
*/
- std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
- const uint64_t* data);
+ std::unique_ptr<Base::CompressionData> compress(const uint64_t* data);
using BaseDictionaryCompressor::compress;
}
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_DICTIONARY_COMPRESSOR_HH__
/*
- * Copyright (c) 2018-2019 Inria
+ * Copyright (c) 2018-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/dictionary_compressor.hh"
#include "params/BaseDictionaryCompressor.hh"
+namespace Compressor {
+
template <class T>
DictionaryCompressor<T>::CompData::CompData()
: CompressionData()
}
template <class T>
-std::unique_ptr<BaseCacheCompressor::CompressionData>
+std::unique_ptr<Base::CompressionData>
DictionaryCompressor<T>::compress(const uint64_t* data)
{
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
+ std::unique_ptr<Base::CompressionData> comp_data =
std::unique_ptr<CompData>(new CompData());
// Reset dictionary
return value;
}
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_DICTIONARY_COMPRESSOR_IMPL_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/dictionary_compressor_impl.hh"
#include "params/FPCD.hh"
+namespace Compressor {
+
FPCD::FPCD(const Params *p)
: DictionaryCompressor<uint32_t>(p)
{
}
}
-std::unique_ptr<BaseCacheCompressor::CompressionData>
+std::unique_ptr<Base::CompressionData>
FPCD::compress(const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat)
{
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
+ std::unique_ptr<Base::CompressionData> comp_data =
DictionaryCompressor<uint32_t>::compress(data);
// Set compression latency (Accounts for zero checks, ones check, match
return comp_data;
}
-FPCD*
+} // namespace Compressor
+
+Compressor::FPCD*
FPCDParams::create()
{
- return new FPCD(this);
+ return new Compressor::FPCD(this);
}
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct FPCDParams;
+namespace Compressor {
+
class FPCD : public DictionaryCompressor<uint32_t>
{
private:
void addToDictionary(DictionaryEntry data) override;
- std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
+ std::unique_ptr<Base::CompressionData> compress(
const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat) override;
public:
}
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_FPCD_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "debug/CacheComp.hh"
#include "params/MultiCompressor.hh"
-MultiCompressor::MultiCompData::MultiCompData(unsigned index,
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data)
+namespace Compressor {
+
+Multi::MultiCompData::MultiCompData(unsigned index,
+ std::unique_ptr<Base::CompressionData> comp_data)
: CompressionData(), index(index), compData(std::move(comp_data))
{
setSizeBits(compData->getSizeBits());
}
uint8_t
-MultiCompressor::MultiCompData::getIndex() const
+Multi::MultiCompData::getIndex() const
{
return index;
}
-MultiCompressor::MultiCompressor(const Params *p)
- : BaseCacheCompressor(p), compressors(p->compressors)
+Multi::Multi(const Params *p)
+ : Base(p), compressors(p->compressors)
{
fatal_if(compressors.size() == 0, "There must be at least one compressor");
}
-MultiCompressor::~MultiCompressor()
+Multi::~Multi()
{
for (auto& compressor : compressors) {
delete compressor;
}
}
-std::unique_ptr<BaseCacheCompressor::CompressionData>
-MultiCompressor::compress(const uint64_t* cache_line, Cycles& comp_lat,
+std::unique_ptr<Base::CompressionData>
+Multi::compress(const uint64_t* cache_line, Cycles& comp_lat,
Cycles& decomp_lat)
{
struct Results
{
unsigned index;
- std::unique_ptr<BaseCacheCompressor::CompressionData> compData;
+ std::unique_ptr<Base::CompressionData> compData;
Cycles decompLat;
uint8_t compressionFactor;
Results(unsigned index,
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data,
+ std::unique_ptr<Base::CompressionData> comp_data,
Cycles decomp_lat, std::size_t blk_size)
: index(index), compData(std::move(comp_data)),
decompLat(decomp_lat)
}
void
-MultiCompressor::decompress(const CompressionData* comp_data,
+Multi::decompress(const CompressionData* comp_data,
uint64_t* cache_line)
{
const MultiCompData* casted_comp_data =
}
void
-MultiCompressor::regStats()
+Multi::regStats()
{
- BaseCacheCompressor::regStats();
+ Base::regStats();
rankStats
.init(compressors.size(), compressors.size())
}
}
-MultiCompressor*
+} // namespace Compressor
+
+Compressor::Multi*
MultiCompressorParams::create()
{
- return new MultiCompressor(this);
+ return new Compressor::Multi(this);
}
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct MultiCompressorParams;
-class MultiCompressor : public BaseCacheCompressor
+namespace Compressor {
+
+class Multi : public Base
{
protected:
/**
class MultiCompData;
/** List of sub-compressors. */
- std::vector<BaseCacheCompressor*> compressors;
+ std::vector<Base*> compressors;
/**
* @defgroup CompressionStats Compression specific statistics.
*/
public:
- /** Convenience typedef. */
- typedef MultiCompressorParams Params;
-
- /** Default constructor. */
- MultiCompressor(const Params *p);
-
- /** Default destructor. */
- ~MultiCompressor();
+ typedef MultiCompressorParams Params;
+ Multi(const Params *p);
+ ~Multi();
void regStats() override;
- std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
+ std::unique_ptr<Base::CompressionData> compress(
const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat) override;
void decompress(const CompressionData* comp_data, uint64_t* data) override;
};
-class MultiCompressor::MultiCompData : public CompressionData
+class Multi::MultiCompData : public CompressionData
{
private:
/** Index of the compressor that provided these compression results. */
public:
/** Compression data of the best compressor. */
- std::unique_ptr<BaseCacheCompressor::CompressionData> compData;
+ std::unique_ptr<Base::CompressionData> compData;
/**
* Default constructor.
* @param comp_data Compression data of the best compressor.
*/
MultiCompData(unsigned index,
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data);
+ std::unique_ptr<Base::CompressionData> comp_data);
/** Default destructor. */
~MultiCompData() = default;
uint8_t getIndex() const;
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_MULTI_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "debug/CacheComp.hh"
#include "params/PerfectCompressor.hh"
-PerfectCompressor::CompData::CompData(const uint64_t* data,
+namespace Compressor {
+
+Perfect::CompData::CompData(const uint64_t* data,
std::size_t num_entries)
: CompressionData(), entries(data, data + num_entries)
{
}
-PerfectCompressor::PerfectCompressor(const Params *p)
- : BaseCacheCompressor(p),
+Perfect::Perfect(const Params *p)
+ : Base(p),
compressedSize(8 * blkSize / p->max_compression_ratio),
compressionLatency(p->compression_latency),
decompressionLatency(p->decompression_latency)
{
}
-std::unique_ptr<BaseCacheCompressor::CompressionData>
-PerfectCompressor::compress(const uint64_t* cache_line, Cycles& comp_lat,
+std::unique_ptr<Base::CompressionData>
+Perfect::compress(const uint64_t* cache_line, Cycles& comp_lat,
Cycles& decomp_lat)
{
// Compress every word sequentially
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data(
+ std::unique_ptr<Base::CompressionData> comp_data(
new CompData(cache_line, blkSize/8));
// Set relevant metadata
}
void
-PerfectCompressor::decompress(const CompressionData* comp_data,
+Perfect::decompress(const CompressionData* comp_data,
uint64_t* data)
{
// Decompress every entry sequentially
std::copy(entries.begin(), entries.end(), data);
}
-PerfectCompressor*
+} // namespace Compressor
+
+Compressor::Perfect*
PerfectCompressorParams::create()
{
- return new PerfectCompressor(this);
+ return new Compressor::Perfect(this);
}
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct PerfectCompressorParams;
-class PerfectCompressor : public BaseCacheCompressor
+namespace Compressor {
+
+class Perfect : public Base
{
protected:
class CompData;
public:
typedef PerfectCompressorParams Params;
- PerfectCompressor(const Params *p);
- ~PerfectCompressor() {};
+ Perfect(const Params *p);
+ ~Perfect() = default;
};
-class PerfectCompressor::CompData : public CompressionData
+class Perfect::CompData : public CompressionData
{
public:
/** The original data is simply copied over to this vector. */
~CompData() = default;
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_PERFECT_COMPRESSOR_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/dictionary_compressor_impl.hh"
#include "params/RepeatedQwordsCompressor.hh"
-RepeatedQwordsCompressor::RepeatedQwordsCompressor(const Params *p)
+namespace Compressor {
+
+RepeatedQwords::RepeatedQwords(const Params *p)
: DictionaryCompressor<uint64_t>(p)
{
}
void
-RepeatedQwordsCompressor::addToDictionary(DictionaryEntry data)
+RepeatedQwords::addToDictionary(DictionaryEntry data)
{
assert(numEntries < dictionarySize);
dictionary[numEntries++] = data;
}
-std::unique_ptr<BaseCacheCompressor::CompressionData>
-RepeatedQwordsCompressor::compress(const uint64_t* data, Cycles& comp_lat,
+std::unique_ptr<Base::CompressionData>
+RepeatedQwords::compress(const uint64_t* data, Cycles& comp_lat,
Cycles& decomp_lat)
{
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
+ std::unique_ptr<Base::CompressionData> comp_data =
DictionaryCompressor::compress(data);
// Since there is a single value repeated over and over, there should be
return comp_data;
}
-RepeatedQwordsCompressor*
+} // namespace Compressor
+
+Compressor::RepeatedQwords*
RepeatedQwordsCompressorParams::create()
{
- return new RepeatedQwordsCompressor(this);
+ return new Compressor::RepeatedQwords(this);
}
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct RepeatedQwordsCompressorParams;
-class RepeatedQwordsCompressor : public DictionaryCompressor<uint64_t>
+namespace Compressor {
+
+class RepeatedQwords : public DictionaryCompressor<uint64_t>
{
protected:
using DictionaryEntry = DictionaryCompressor<uint64_t>::DictionaryEntry;
void addToDictionary(DictionaryEntry data) override;
- std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
+ std::unique_ptr<Base::CompressionData> compress(
const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat) override;
public:
typedef RepeatedQwordsCompressorParams Params;
- RepeatedQwordsCompressor(const Params *p);
- ~RepeatedQwordsCompressor() = default;
+ RepeatedQwords(const Params *p);
+ ~RepeatedQwords() = default;
};
-class RepeatedQwordsCompressor::PatternX
+class RepeatedQwords::PatternX
: public DictionaryCompressor::UncompressedPattern
{
public:
}
};
-class RepeatedQwordsCompressor::PatternM
+class RepeatedQwords::PatternM
: public DictionaryCompressor::LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>
{
public:
}
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_REPEATED_QWORDS_HH__
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "mem/cache/compressors/dictionary_compressor_impl.hh"
#include "params/ZeroCompressor.hh"
-ZeroCompressor::ZeroCompressor(const Params *p)
+namespace Compressor {
+
+Zero::Zero(const Params *p)
: DictionaryCompressor<uint64_t>(p)
{
}
void
-ZeroCompressor::addToDictionary(DictionaryEntry data)
+Zero::addToDictionary(DictionaryEntry data)
{
assert(numEntries < dictionarySize);
dictionary[numEntries++] = data;
}
-std::unique_ptr<BaseCacheCompressor::CompressionData>
-ZeroCompressor::compress(const uint64_t* data, Cycles& comp_lat,
+std::unique_ptr<Base::CompressionData>
+Zero::compress(const uint64_t* data, Cycles& comp_lat,
Cycles& decomp_lat)
{
- std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
+ std::unique_ptr<Base::CompressionData> comp_data =
DictionaryCompressor::compress(data);
// If there is any non-zero entry, the compressor failed
return comp_data;
}
-ZeroCompressor*
+} // namespace Compressor
+
+Compressor::Zero*
ZeroCompressorParams::create()
{
- return new ZeroCompressor(this);
+ return new Compressor::Zero(this);
}
/*
- * Copyright (c) 2019 Inria
+ * Copyright (c) 2019-2020 Inria
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct ZeroCompressorParams;
-class ZeroCompressor : public DictionaryCompressor<uint64_t>
+namespace Compressor {
+
+class Zero : public DictionaryCompressor<uint64_t>
{
protected:
using DictionaryEntry = DictionaryCompressor<uint64_t>::DictionaryEntry;
void addToDictionary(DictionaryEntry data) override;
- std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
+ std::unique_ptr<Base::CompressionData> compress(
const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat) override;
public:
typedef ZeroCompressorParams Params;
- ZeroCompressor(const Params *p);
- ~ZeroCompressor() = default;
+ Zero(const Params *p);
+ ~Zero() = default;
};
-class ZeroCompressor::PatternX
+class Zero::PatternX
: public DictionaryCompressor::UncompressedPattern
{
public:
}
};
-class ZeroCompressor::PatternZ
+class Zero::PatternZ
: public DictionaryCompressor::MaskedValuePattern<0, 0xFFFFFFFFFFFFFFFF>
{
public:
}
};
+} // namespace Compressor
+
#endif //__MEM_CACHE_COMPRESSORS_ZERO_HH__