gem5  v20.1.0.0
dictionary_compressor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020 Inria
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
43 #ifndef __MEM_CACHE_COMPRESSORS_DICTIONARY_COMPRESSOR_HH__
44 #define __MEM_CACHE_COMPRESSORS_DICTIONARY_COMPRESSOR_HH__
45 
46 #include <array>
47 #include <cstdint>
48 #include <map>
49 #include <memory>
50 #include <string>
51 #include <type_traits>
52 #include <vector>
53 
54 #include "base/statistics.hh"
55 #include "base/types.hh"
57 
58 struct BaseDictionaryCompressorParams;
59 
60 namespace Compressor {
61 
63 {
64  protected:
66  const std::size_t dictionarySize;
67 
69  std::size_t numEntries;
70 
71  struct DictionaryStats : public Stats::Group
72  {
74 
75  DictionaryStats(BaseStats &base_group,
76  BaseDictionaryCompressor& _compressor);
77 
78  void regStats() override;
79 
83 
89  virtual uint64_t getNumPatterns() const = 0;
90 
97  virtual std::string getName(int number) const = 0;
98 
99  public:
100  typedef BaseDictionaryCompressorParams Params;
102  ~BaseDictionaryCompressor() = default;
103 };
104 
111 template <class T>
113 {
114  protected:
116  typedef std::array<uint8_t, sizeof(T)> DictionaryEntry;
117 
122  class CompData;
123 
124  // Forward declaration of a pattern
125  class Pattern;
126  class UncompressedPattern;
127  template <T mask>
129  template <T value, T mask>
131  template <T mask, int location>
133  template <class RepT>
135  template <std::size_t DeltaSizeBits>
137 
143  template <class Head, class... Tail>
144  struct Factory
145  {
146  static std::unique_ptr<Pattern> getPattern(
147  const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
148  const int match_location)
149  {
150  // If match this pattern, instantiate it. If a negative match
151  // location is used, the patterns that use the dictionary bytes
152  // must return false. This is used when there are no dictionary
153  // entries yet
154  if (Head::isPattern(bytes, dict_bytes, match_location)) {
155  return std::unique_ptr<Pattern>(
156  new Head(bytes, match_location));
157  // Otherwise, go for next pattern
158  } else {
159  return Factory<Tail...>::getPattern(bytes, dict_bytes,
160  match_location);
161  }
162  }
163  };
164 
171  template <class Head>
172  struct Factory<Head>
173  {
174  static_assert(std::is_base_of<UncompressedPattern, Head>::value,
175  "The last pattern must always be derived from the uncompressed "
176  "pattern.");
177 
178  static std::unique_ptr<Pattern>
180  const DictionaryEntry& dict_bytes, const int match_location)
181  {
182  return std::unique_ptr<Pattern>(new Head(bytes, match_location));
183  }
184  };
185 
188 
194  virtual std::unique_ptr<Pattern>
195  getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
196  const int match_location) const = 0;
197 
204  std::unique_ptr<Pattern> compressValue(const T data);
205 
212  T decompressValue(const Pattern* pattern);
213 
215  virtual void resetDictionary();
216 
222  virtual void addToDictionary(const DictionaryEntry data) = 0;
223 
229  virtual std::unique_ptr<DictionaryCompressor::CompData>
231 
238  std::unique_ptr<Base::CompressionData> compress(
239  const std::vector<Chunk>& chunks);
240 
242 
249  void decompress(const CompressionData* comp_data, uint64_t* data) override;
250 
257  static DictionaryEntry toDictionaryEntry(T value);
258 
265  static T fromDictionaryEntry(const DictionaryEntry& entry);
266 
267  public:
268  typedef BaseDictionaryCompressorParams Params;
269  DictionaryCompressor(const Params *p);
270  ~DictionaryCompressor() = default;
271 };
272 
279 template <class T>
281 {
282  protected:
284  const int patternNumber;
285 
287  const uint8_t code;
288 
290  const uint8_t length;
291 
293  const uint8_t numUnmatchedBits;
294 
296  const int matchLocation;
297 
299  const bool allocate;
300 
301  public:
311  Pattern(const int number, const uint64_t code,
312  const uint64_t metadata_length, const uint64_t num_unmatched_bits,
313  const int match_location, const bool allocate = true)
314  : patternNumber(number), code(code), length(metadata_length),
315  numUnmatchedBits(num_unmatched_bits),
316  matchLocation(match_location), allocate(allocate)
317  {
318  }
319 
321  virtual ~Pattern() = default;
322 
328  int getPatternNumber() const { return patternNumber; };
329 
335  uint8_t getCode() const { return code; }
336 
342  uint8_t getMatchLocation() const { return matchLocation; }
343 
350  std::size_t
351  getSizeBits() const
352  {
353  return numUnmatchedBits + length;
354  }
355 
361  bool shouldAllocate() const { return allocate; }
362 
368  std::string
369  print() const
370  {
371  return csprintf("pattern %s (encoding %x, size %u bits)",
372  getPatternNumber(), getCode(), getSizeBits());
373  }
374 
382  virtual DictionaryEntry decompress(
383  const DictionaryEntry dict_bytes) const = 0;
384 };
385 
386 template <class T>
388 {
389  public:
392 
393  CompData();
394  ~CompData() = default;
395 
401  virtual void addEntry(std::unique_ptr<Pattern>);
402 };
403 
409 template <class T>
412 {
413  private:
416 
417  public:
418  UncompressedPattern(const int number,
419  const uint64_t code,
420  const uint64_t metadata_length,
421  const int match_location,
422  const DictionaryEntry bytes)
423  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
424  sizeof(T) * 8, match_location, true),
425  data(bytes)
426  {
427  }
428 
429  static bool
430  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
431  const int match_location)
432  {
433  // An entry can always be uncompressed
434  return true;
435  }
436 
438  decompress(const DictionaryEntry dict_bytes) const override
439  {
440  return data;
441  }
442 };
443 
456 template <class T>
457 template <T mask>
458 class DictionaryCompressor<T>::MaskedPattern
459  : public DictionaryCompressor<T>::Pattern
460 {
461  private:
462  static_assert(mask != 0, "The pattern's value mask must not be zero. Use "
463  "the uncompressed pattern instead.");
464 
466  const T bits;
467 
468  public:
469  MaskedPattern(const int number,
470  const uint64_t code,
471  const uint64_t metadata_length,
472  const int match_location,
473  const DictionaryEntry bytes,
474  const bool allocate = true)
475  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
476  popCount(static_cast<T>(~mask)), match_location, allocate),
478  {
479  }
480 
481  static bool
482  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
483  const int match_location)
484  {
485  const T masked_bytes =
487  const T masked_dict_bytes =
489  return (match_location >= 0) && (masked_bytes == masked_dict_bytes);
490  }
491 
493  decompress(const DictionaryEntry dict_bytes) const override
494  {
495  const T masked_dict_bytes =
498  bits | masked_dict_bytes);
499  }
500 };
501 
518 template <class T>
519 template <T value, T mask>
520 class DictionaryCompressor<T>::MaskedValuePattern
521  : public MaskedPattern<mask>
522 {
523  private:
524  static_assert(mask != 0, "The pattern's value mask must not be zero.");
525 
526  public:
527  MaskedValuePattern(const int number,
528  const uint64_t code,
529  const uint64_t metadata_length,
530  const int match_location,
531  const DictionaryEntry bytes,
532  const bool allocate = false)
533  : MaskedPattern<mask>(number, code, metadata_length, match_location,
534  bytes, allocate)
535  {
536  }
537 
538  static bool
539  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
540  const int match_location)
541  {
542  // Compare the masked fixed value to the value being checked for
543  // patterns. Since the dictionary is not being used the match_location
544  // is irrelevant.
545  const T masked_bytes =
547  return ((value & mask) == masked_bytes);
548  }
549 
551  decompress(const DictionaryEntry dict_bytes) const override
552  {
555  }
556 };
557 
565 template <class T>
566 template <T mask, int location>
567 class DictionaryCompressor<T>::LocatedMaskedPattern
568  : public MaskedPattern<mask>
569 {
570  public:
571  LocatedMaskedPattern(const int number,
572  const uint64_t code,
573  const uint64_t metadata_length,
574  const int match_location,
575  const DictionaryEntry bytes,
576  const bool allocate = true)
577  : MaskedPattern<mask>(number, code, metadata_length, match_location,
578  bytes, allocate)
579  {
580  }
581 
582  static bool
583  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
584  const int match_location)
585  {
586  // Besides doing the regular masked pattern matching, the match
587  // location must match perfectly with this instance's
588  return (match_location == location) &&
589  MaskedPattern<mask>::isPattern(bytes, dict_bytes, match_location);
590  }
591 };
592 
603 template <class T>
604 template <class RepT>
605 class DictionaryCompressor<T>::RepeatedValuePattern
606  : public DictionaryCompressor<T>::Pattern
607 {
608  private:
609  static_assert(sizeof(T) > sizeof(RepT), "The repeated value's type must "
610  "be smaller than the dictionary entry's type.");
611 
613  RepT value;
614 
615  public:
616  RepeatedValuePattern(const int number,
617  const uint64_t code,
618  const uint64_t metadata_length,
619  const int match_location,
620  const DictionaryEntry bytes,
621  const bool allocate = true)
622  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
623  8 * sizeof(RepT), match_location, allocate),
624  value(DictionaryCompressor<T>::fromDictionaryEntry(bytes))
625  {
626  }
627 
628  static bool
629  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
630  const int match_location)
631  {
632  // Parse the dictionary entry in a RepT granularity, and if all values
633  // are equal, this is a repeated value pattern. Since the dictionary
634  // is not being used, the match_location is irrelevant
635  T bytes_value = DictionaryCompressor<T>::fromDictionaryEntry(bytes);
636  const RepT rep_value = bytes_value;
637  for (int i = 0; i < (sizeof(T) / sizeof(RepT)); i++) {
638  RepT cur_value = bytes_value;
639  if (cur_value != rep_value) {
640  return false;
641  }
642  bytes_value >>= 8 * sizeof(RepT);
643  }
644  return true;
645  }
646 
648  decompress(const DictionaryEntry dict_bytes) const override
649  {
650  // The decompressed value is just multiple consecutive instances of
651  // the same value
652  T decomp_value = 0;
653  for (int i = 0; i < (sizeof(T) / sizeof(RepT)); i++) {
654  decomp_value <<= 8 * sizeof(RepT);
655  decomp_value |= value;
656  }
657  return DictionaryCompressor<T>::toDictionaryEntry(decomp_value);
658  }
659 };
660 
675 template <class T>
676 template <std::size_t DeltaSizeBits>
677 class DictionaryCompressor<T>::DeltaPattern
678  : public DictionaryCompressor<T>::Pattern
679 {
680  private:
681  static_assert(DeltaSizeBits < (sizeof(T) * 8),
682  "Delta size must be smaller than base size");
683 
689  const DictionaryEntry bytes;
690 
691  public:
692  DeltaPattern(const int number,
693  const uint64_t code,
694  const uint64_t metadata_length,
695  const int match_location,
696  const DictionaryEntry bytes)
697  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
698  DeltaSizeBits, match_location, false),
699  bytes(bytes)
700  {
701  }
702 
711  static bool
713  const DictionaryEntry& base_bytes)
714  {
715  const typename std::make_signed<T>::type limit = DeltaSizeBits ?
716  mask(DeltaSizeBits - 1) : 0;
717  const T value =
719  const T base =
721  const typename std::make_signed<T>::type delta = value - base;
722  return (delta >= -limit) && (delta <= limit);
723  }
724 
725  static bool
727  const DictionaryEntry& dict_bytes, const int match_location)
728  {
729  return (match_location >= 0) && isValidDelta(bytes, dict_bytes);
730  }
731 
733  decompress(const DictionaryEntry dict_bytes) const override
734  {
735  return bytes;
736  }
737 };
738 
739 } // namespace Compressor
740 
741 #endif //__MEM_CACHE_COMPRESSORS_DICTIONARY_COMPRESSOR_HH__
Compressor::BaseDictionaryCompressor
Definition: dictionary_compressor.hh:62
Compressor::BaseDictionaryCompressor::getNumPatterns
virtual uint64_t getNumPatterns() const =0
Trick function to get the number of patterns.
Compressor::DictionaryCompressor::getPattern
virtual std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const =0
Since the factory cannot be instantiated here, classes that inherit from this base class have to impl...
Compressor::DictionaryCompressor::DeltaPattern::DeltaPattern
DeltaPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes)
Definition: dictionary_compressor.hh:692
length
uint8_t length
Definition: inet.hh:422
data
const char data[]
Definition: circlebuf.test.cc:42
Compressor::DictionaryCompressor::MaskedPattern::MaskedPattern
MaskedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes, const bool allocate=true)
Definition: dictionary_compressor.hh:469
Compressor::DictionaryCompressor::DictionaryCompressor
DictionaryCompressor(const Params *p)
Definition: dictionary_compressor_impl.hh:63
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
Compressor::DictionaryCompressor::MaskedPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:482
Compressor::DictionaryCompressor::DeltaPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:726
base.hh
Compressor::DictionaryCompressor::Pattern::getMatchLocation
uint8_t getMatchLocation() const
Get the index of the dictionary match location.
Definition: dictionary_compressor.hh:342
Compressor
Definition: base.cc:46
Compressor::BaseDictionaryCompressor::BaseDictionaryCompressor
BaseDictionaryCompressor(const Params *p)
Definition: base_dictionary_compressor.cc:39
Compressor::DictionaryCompressor::RepeatedValuePattern::RepeatedValuePattern
RepeatedValuePattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes, const bool allocate=true)
Definition: dictionary_compressor.hh:616
Compressor::DictionaryCompressor< uint64_t >::DictionaryEntry
std::array< uint8_t, sizeof(uint64_t)> DictionaryEntry
Convenience typedef for a dictionary entry.
Definition: dictionary_compressor.hh:116
type
uint8_t type
Definition: inet.hh:421
Compressor::DictionaryCompressor::Pattern::print
std::string print() const
Extract pattern's information to a string.
Definition: dictionary_compressor.hh:369
Compressor::BaseDictionaryCompressor::dictionaryStats
Compressor::BaseDictionaryCompressor::DictionaryStats dictionaryStats
Compressor::DictionaryCompressor::addToDictionary
virtual void addToDictionary(const DictionaryEntry data)=0
Add an entry to the dictionary.
Compressor::DictionaryCompressor::Pattern::numUnmatchedBits
const uint8_t numUnmatchedBits
Number of unmatched bits.
Definition: dictionary_compressor.hh:293
Compressor::DictionaryCompressor::resetDictionary
virtual void resetDictionary()
Clear all dictionary entries.
Definition: dictionary_compressor_impl.hh:73
Compressor::DictionaryCompressor::RepeatedValuePattern::value
RepT value
The repeated value.
Definition: dictionary_compressor.hh:610
Compressor::DictionaryCompressor::compress
std::unique_ptr< Base::CompressionData > compress(const std::vector< Chunk > &chunks)
Apply compression.
Definition: dictionary_compressor_impl.hh:126
X86ISA::base
Bitfield< 51, 12 > base
Definition: pagetable.hh:141
Compressor::DictionaryCompressor::UncompressedPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:438
Compressor::DictionaryCompressor::UncompressedPattern::data
const DictionaryEntry data
A copy of the original data.
Definition: dictionary_compressor.hh:415
std::vector< DictionaryEntry >
Compressor::BaseDictionaryCompressor::getName
virtual std::string getName(int number) const =0
Get meta-name assigned to the given pattern.
Compressor::BaseDictionaryCompressor::numEntries
std::size_t numEntries
Number of valid entries in the dictionary.
Definition: dictionary_compressor.hh:69
Compressor::DictionaryCompressor::Factory< Head >::getPattern
static std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:179
Compressor::Base
Base cache compressor interface.
Definition: base.hh:58
Compressor::BaseDictionaryCompressor::~BaseDictionaryCompressor
~BaseDictionaryCompressor()=default
Compressor::Base::BaseStats
Definition: base.hh:98
Stats::Vector
A vector of scalar stats.
Definition: statistics.hh:2575
Compressor::DictionaryCompressor::MaskedValuePattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:551
popCount
int popCount(uint64_t val)
Returns the number of set ones in the provided value.
Definition: bitfield.hh:285
Compressor::Base::compress
virtual std::unique_ptr< CompressionData > compress(const std::vector< Chunk > &chunks, Cycles &comp_lat, Cycles &decomp_lat)=0
Apply the compression process to the cache line.
Compressor::DictionaryCompressor::Pattern::matchLocation
const int matchLocation
Index representing the the match location.
Definition: dictionary_compressor.hh:296
Compressor::DictionaryCompressor::Pattern::getSizeBits
std::size_t getSizeBits() const
Get size, in bits, of the pattern (excluding prefix).
Definition: dictionary_compressor.hh:351
Compressor::DictionaryCompressor::Pattern::Pattern
Pattern(const int number, const uint64_t code, const uint64_t metadata_length, const uint64_t num_unmatched_bits, const int match_location, const bool allocate=true)
Default constructor.
Definition: dictionary_compressor.hh:311
Compressor::Base::CompressionData
Definition: base.hh:209
Compressor::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:112
Compressor::BaseDictionaryCompressor::DictionaryStats
Definition: dictionary_compressor.hh:71
Compressor::DictionaryCompressor::MaskedValuePattern::MaskedValuePattern
MaskedValuePattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes, const bool allocate=false)
Definition: dictionary_compressor.hh:527
Compressor::DictionaryCompressor::Pattern::allocate
const bool allocate
Wether the pattern allocates a dictionary entry or not.
Definition: dictionary_compressor.hh:299
statistics.hh
Compressor::BaseDictionaryCompressor::DictionaryStats::patterns
Stats::Vector patterns
Number of data entries that were compressed to each pattern.
Definition: dictionary_compressor.hh:81
Compressor::DictionaryCompressor::Pattern::patternNumber
const int patternNumber
Pattern enum number.
Definition: dictionary_compressor.hh:284
Compressor::BaseDictionaryCompressor::DictionaryStats::DictionaryStats
DictionaryStats(BaseStats &base_group, BaseDictionaryCompressor &_compressor)
Definition: base_dictionary_compressor.cc:45
Compressor::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:168
Compressor::DictionaryCompressor::MaskedValuePattern
A pattern that compares masked values to a masked portion of a fixed value.
Definition: dictionary_compressor.hh:130
Compressor::DictionaryCompressor::MaskedPattern::bits
const T bits
A copy of the bits that do not belong to the mask.
Definition: dictionary_compressor.hh:463
Compressor::DictionaryCompressor::CompData::entries
std::vector< std::unique_ptr< Pattern > > entries
The patterns matched in the original line.
Definition: dictionary_compressor.hh:391
Compressor::DictionaryCompressor::Pattern::shouldAllocate
bool shouldAllocate() const
Determine if pattern allocates a dictionary entry.
Definition: dictionary_compressor.hh:361
Compressor::DictionaryCompressor::MaskedPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:493
Compressor::DictionaryCompressor::DeltaPattern::bytes
const DictionaryEntry bytes
The original value.
Definition: dictionary_compressor.hh:682
Compressor::DictionaryCompressor::MaskedValuePattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:539
Compressor::DictionaryCompressor::instantiateDictionaryCompData
virtual std::unique_ptr< DictionaryCompressor::CompData > instantiateDictionaryCompData() const
Instantiate a compression data of the sub-class compressor.
Definition: dictionary_compressor_impl.hh:84
Compressor::DictionaryCompressor::Params
BaseDictionaryCompressorParams Params
Definition: dictionary_compressor.hh:268
Compressor::DictionaryCompressor::fromDictionaryEntry
static T fromDictionaryEntry(const DictionaryEntry &entry)
Turn a dictionary entry into a value.
Definition: dictionary_compressor_impl.hh:210
Compressor::DictionaryCompressor::Factory::getPattern
static std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:146
Compressor::DictionaryCompressor::RepeatedValuePattern
A pattern that checks if dictionary entry sized values are solely composed of multiple copies of a si...
Definition: dictionary_compressor.hh:134
Compressor::DictionaryCompressor::toDictionaryEntry
static DictionaryEntry toDictionaryEntry(T value)
Turn a value into a dictionary entry.
Definition: dictionary_compressor_impl.hh:198
Compressor::DictionaryCompressor::DeltaPattern
A pattern that checks whether the difference of the value and the dictionary entries' is below a cert...
Definition: dictionary_compressor.hh:136
types.hh
Compressor::DictionaryCompressor::UncompressedPattern::UncompressedPattern
UncompressedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes)
Definition: dictionary_compressor.hh:418
Compressor::BaseDictionaryCompressor::Params
BaseDictionaryCompressorParams Params
Definition: dictionary_compressor.hh:100
Stats::Group
Statistics container.
Definition: group.hh:83
Compressor::DictionaryCompressor::LocatedMaskedPattern::LocatedMaskedPattern
LocatedMaskedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes, const bool allocate=true)
Definition: dictionary_compressor.hh:571
Compressor::DictionaryCompressor::Factory
Create a factory to determine if input matches a pattern.
Definition: dictionary_compressor.hh:144
Compressor::DictionaryCompressor::dictionary
std::vector< DictionaryEntry > dictionary
The dictionary.
Definition: dictionary_compressor.hh:187
Compressor::DictionaryCompressor::decompressValue
T decompressValue(const Pattern *pattern)
Decompress a pattern into a value that fits in a dictionary entry.
Definition: dictionary_compressor_impl.hh:149
X86ISA::limit
BitfieldType< SegDescriptorLimit > limit
Definition: misc.hh:924
Compressor::DictionaryCompressor::Pattern::getCode
uint8_t getCode() const
Get code of this pattern.
Definition: dictionary_compressor.hh:335
Compressor::DictionaryCompressor::DeltaPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:733
Compressor::BaseDictionaryCompressor::DictionaryStats::compressor
const BaseDictionaryCompressor & compressor
Definition: dictionary_compressor.hh:73
Compressor::DictionaryCompressor::RepeatedValuePattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:629
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Compressor::DictionaryCompressor::~DictionaryCompressor
~DictionaryCompressor()=default
Compressor::DictionaryCompressor::RepeatedValuePattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:648
Compressor::DictionaryCompressor::UncompressedPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:430
Compressor::DictionaryCompressor::LocatedMaskedPattern
A pattern that narrows the MaskedPattern by allowing a only single possible dictionary entry to be ma...
Definition: dictionary_compressor.hh:132
Compressor::DictionaryCompressor::Pattern
The compressed data is composed of multiple pattern entries.
Definition: dictionary_compressor.hh:280
Compressor::DictionaryCompressor::DeltaPattern::isValidDelta
static bool isValidDelta(const DictionaryEntry &bytes, const DictionaryEntry &base_bytes)
Compares a given value against a base to calculate their delta, and then determines whether it fits a...
Definition: dictionary_compressor.hh:712
Compressor::DictionaryCompressor::Pattern::length
const uint8_t length
Length, in bits, of the code and match location.
Definition: dictionary_compressor.hh:290
Compressor::BaseDictionaryCompressor::dictionarySize
const std::size_t dictionarySize
Dictionary size.
Definition: dictionary_compressor.hh:66
Compressor::DictionaryCompressor::decompress
void decompress(const CompressionData *comp_data, uint64_t *data) override
Decompress data.
Definition: dictionary_compressor_impl.hh:168
Compressor::DictionaryCompressor::compressValue
std::unique_ptr< Pattern > compressValue(const T data)
Compress data.
Definition: dictionary_compressor_impl.hh:91
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
Compressor::DictionaryCompressor::Pattern::code
const uint8_t code
Code associated to the pattern.
Definition: dictionary_compressor.hh:287
Compressor::DictionaryCompressor::MaskedPattern
A pattern that compares masked values against dictionary entries.
Definition: dictionary_compressor.hh:128
Compressor::DictionaryCompressor::LocatedMaskedPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:583
Compressor::DictionaryCompressor::UncompressedPattern
A pattern containing the original uncompressed data.
Definition: dictionary_compressor.hh:410
ArmISA::mask
Bitfield< 28, 24 > mask
Definition: miscregs_types.hh:711
Compressor::DictionaryCompressor::CompData
Definition: dictionary_compressor.hh:387
Compressor::DictionaryCompressor::Pattern::getPatternNumber
int getPatternNumber() const
Get enum number associated to this pattern.
Definition: dictionary_compressor.hh:328
Compressor::BaseDictionaryCompressor::DictionaryStats::regStats
void regStats() override
Callback to set stat parameters.
Definition: base_dictionary_compressor.cc:54
bits
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:75

Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17