gem5  v21.0.1.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/bitfield.hh"
55 #include "base/statistics.hh"
56 #include "base/types.hh"
58 
59 struct BaseDictionaryCompressorParams;
60 
61 namespace Compressor {
62 
64 {
65  protected:
67  const std::size_t dictionarySize;
68 
70  std::size_t numEntries;
71 
72  struct DictionaryStats : public Stats::Group
73  {
75 
76  DictionaryStats(BaseStats &base_group,
77  BaseDictionaryCompressor& _compressor);
78 
79  void regStats() override;
80 
84 
90  virtual uint64_t getNumPatterns() const = 0;
91 
98  virtual std::string getName(int number) const = 0;
99 
100  public:
101  typedef BaseDictionaryCompressorParams Params;
103  ~BaseDictionaryCompressor() = default;
104 };
105 
112 template <class T>
114 {
115  protected:
117  typedef std::array<uint8_t, sizeof(T)> DictionaryEntry;
118 
123  class CompData;
124 
125  // Forward declaration of a pattern
126  class Pattern;
127  class UncompressedPattern;
128  template <T mask>
130  template <T value, T mask>
132  template <T mask, int location>
134  template <class RepT>
136  template <std::size_t DeltaSizeBits>
138  template <unsigned N>
140 
146  template <class Head, class... Tail>
147  struct Factory
148  {
149  static std::unique_ptr<Pattern> getPattern(
150  const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
151  const int match_location)
152  {
153  // If match this pattern, instantiate it. If a negative match
154  // location is used, the patterns that use the dictionary bytes
155  // must return false. This is used when there are no dictionary
156  // entries yet
157  if (Head::isPattern(bytes, dict_bytes, match_location)) {
158  return std::unique_ptr<Pattern>(
159  new Head(bytes, match_location));
160  // Otherwise, go for next pattern
161  } else {
162  return Factory<Tail...>::getPattern(bytes, dict_bytes,
163  match_location);
164  }
165  }
166  };
167 
174  template <class Head>
175  struct Factory<Head>
176  {
177  static_assert(std::is_base_of<UncompressedPattern, Head>::value,
178  "The last pattern must always be derived from the uncompressed "
179  "pattern.");
180 
181  static std::unique_ptr<Pattern>
183  const DictionaryEntry& dict_bytes, const int match_location)
184  {
185  return std::unique_ptr<Pattern>(new Head(bytes, match_location));
186  }
187  };
188 
191 
197  virtual std::unique_ptr<Pattern>
198  getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
199  const int match_location) const = 0;
200 
207  std::unique_ptr<Pattern> compressValue(const T data);
208 
215  T decompressValue(const Pattern* pattern);
216 
218  virtual void resetDictionary();
219 
225  virtual void addToDictionary(const DictionaryEntry data) = 0;
226 
232  virtual std::unique_ptr<DictionaryCompressor::CompData>
234 
241  std::unique_ptr<Base::CompressionData> compress(
242  const std::vector<Chunk>& chunks);
243 
244  std::unique_ptr<Base::CompressionData> compress(
245  const std::vector<Chunk>& chunks,
246  Cycles& comp_lat, Cycles& decomp_lat) override;
247 
249 
250  void decompress(const CompressionData* comp_data, uint64_t* data) override;
251 
258  static DictionaryEntry toDictionaryEntry(T value);
259 
266  static T fromDictionaryEntry(const DictionaryEntry& entry);
267 
268  public:
269  typedef BaseDictionaryCompressorParams Params;
270  DictionaryCompressor(const Params &p);
271  ~DictionaryCompressor() = default;
272 };
273 
280 template <class T>
282 {
283  protected:
285  const int patternNumber;
286 
288  const uint8_t code;
289 
291  const uint8_t length;
292 
294  const uint8_t numUnmatchedBits;
295 
297  const int matchLocation;
298 
300  const bool allocate;
301 
302  public:
312  Pattern(const int number, const uint64_t code,
313  const uint64_t metadata_length, const uint64_t num_unmatched_bits,
314  const int match_location, const bool allocate = true)
315  : patternNumber(number), code(code), length(metadata_length),
316  numUnmatchedBits(num_unmatched_bits),
317  matchLocation(match_location), allocate(allocate)
318  {
319  }
320 
322  virtual ~Pattern() = default;
323 
329  int getPatternNumber() const { return patternNumber; };
330 
336  uint8_t getCode() const { return code; }
337 
343  uint8_t getMatchLocation() const { return matchLocation; }
344 
351  virtual std::size_t
352  getSizeBits() const
353  {
354  return numUnmatchedBits + length;
355  }
356 
362  bool shouldAllocate() const { return allocate; }
363 
369  std::string
370  print() const
371  {
372  return csprintf("pattern %s (encoding %x, size %u bits)",
373  getPatternNumber(), getCode(), getSizeBits());
374  }
375 
383  virtual DictionaryEntry decompress(
384  const DictionaryEntry dict_bytes) const = 0;
385 };
386 
387 template <class T>
389 {
390  public:
393 
394  CompData();
395  ~CompData() = default;
396 
402  virtual void addEntry(std::unique_ptr<Pattern>);
403 };
404 
410 template <class T>
413 {
414  private:
417 
418  public:
419  UncompressedPattern(const int number,
420  const uint64_t code,
421  const uint64_t metadata_length,
422  const int match_location,
423  const DictionaryEntry bytes)
424  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
425  sizeof(T) * 8, match_location, true),
426  data(bytes)
427  {
428  }
429 
430  static bool
431  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
432  const int match_location)
433  {
434  // An entry can always be uncompressed
435  return true;
436  }
437 
439  decompress(const DictionaryEntry dict_bytes) const override
440  {
441  return data;
442  }
443 };
444 
457 template <class T>
458 template <T mask>
459 class DictionaryCompressor<T>::MaskedPattern
460  : public DictionaryCompressor<T>::Pattern
461 {
462  private:
463  static_assert(mask != 0, "The pattern's value mask must not be zero. Use "
464  "the uncompressed pattern instead.");
465 
467  const T bits;
468 
469  public:
470  MaskedPattern(const int number,
471  const uint64_t code,
472  const uint64_t metadata_length,
473  const int match_location,
474  const DictionaryEntry bytes,
475  const bool allocate = true)
476  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
477  popCount(static_cast<T>(~mask)), match_location, allocate),
479  {
480  }
481 
482  static bool
483  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
484  const int match_location)
485  {
486  const T masked_bytes =
488  const T masked_dict_bytes =
490  return (match_location >= 0) && (masked_bytes == masked_dict_bytes);
491  }
492 
494  decompress(const DictionaryEntry dict_bytes) const override
495  {
496  const T masked_dict_bytes =
499  bits | masked_dict_bytes);
500  }
501 };
502 
519 template <class T>
520 template <T value, T mask>
521 class DictionaryCompressor<T>::MaskedValuePattern
522  : public MaskedPattern<mask>
523 {
524  private:
525  static_assert(mask != 0, "The pattern's value mask must not be zero.");
526 
527  public:
528  MaskedValuePattern(const int number,
529  const uint64_t code,
530  const uint64_t metadata_length,
531  const int match_location,
532  const DictionaryEntry bytes,
533  const bool allocate = false)
534  : MaskedPattern<mask>(number, code, metadata_length, match_location,
535  bytes, allocate)
536  {
537  }
538 
539  static bool
540  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
541  const int match_location)
542  {
543  // Compare the masked fixed value to the value being checked for
544  // patterns. Since the dictionary is not being used the match_location
545  // is irrelevant.
546  const T masked_bytes =
548  return ((value & mask) == masked_bytes);
549  }
550 
552  decompress(const DictionaryEntry dict_bytes) const override
553  {
556  }
557 };
558 
566 template <class T>
567 template <T mask, int location>
568 class DictionaryCompressor<T>::LocatedMaskedPattern
569  : public MaskedPattern<mask>
570 {
571  public:
572  LocatedMaskedPattern(const int number,
573  const uint64_t code,
574  const uint64_t metadata_length,
575  const int match_location,
576  const DictionaryEntry bytes,
577  const bool allocate = true)
578  : MaskedPattern<mask>(number, code, metadata_length, match_location,
579  bytes, allocate)
580  {
581  }
582 
583  static bool
584  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
585  const int match_location)
586  {
587  // Besides doing the regular masked pattern matching, the match
588  // location must match perfectly with this instance's
589  return (match_location == location) &&
590  MaskedPattern<mask>::isPattern(bytes, dict_bytes, match_location);
591  }
592 };
593 
604 template <class T>
605 template <class RepT>
606 class DictionaryCompressor<T>::RepeatedValuePattern
607  : public DictionaryCompressor<T>::Pattern
608 {
609  private:
610  static_assert(sizeof(T) > sizeof(RepT), "The repeated value's type must "
611  "be smaller than the dictionary entry's type.");
612 
614  RepT value;
615 
616  public:
617  RepeatedValuePattern(const int number,
618  const uint64_t code,
619  const uint64_t metadata_length,
620  const int match_location,
621  const DictionaryEntry bytes,
622  const bool allocate = true)
623  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
624  8 * sizeof(RepT), match_location, allocate),
625  value(DictionaryCompressor<T>::fromDictionaryEntry(bytes))
626  {
627  }
628 
629  static bool
630  isPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
631  const int match_location)
632  {
633  // Parse the dictionary entry in a RepT granularity, and if all values
634  // are equal, this is a repeated value pattern. Since the dictionary
635  // is not being used, the match_location is irrelevant
636  T bytes_value = DictionaryCompressor<T>::fromDictionaryEntry(bytes);
637  const RepT rep_value = bytes_value;
638  for (int i = 0; i < (sizeof(T) / sizeof(RepT)); i++) {
639  RepT cur_value = bytes_value;
640  if (cur_value != rep_value) {
641  return false;
642  }
643  bytes_value >>= 8 * sizeof(RepT);
644  }
645  return true;
646  }
647 
649  decompress(const DictionaryEntry dict_bytes) const override
650  {
651  // The decompressed value is just multiple consecutive instances of
652  // the same value
653  T decomp_value = 0;
654  for (int i = 0; i < (sizeof(T) / sizeof(RepT)); i++) {
655  decomp_value <<= 8 * sizeof(RepT);
656  decomp_value |= value;
657  }
658  return DictionaryCompressor<T>::toDictionaryEntry(decomp_value);
659  }
660 };
661 
676 template <class T>
677 template <std::size_t DeltaSizeBits>
678 class DictionaryCompressor<T>::DeltaPattern
679  : public DictionaryCompressor<T>::Pattern
680 {
681  private:
682  static_assert(DeltaSizeBits < (sizeof(T) * 8),
683  "Delta size must be smaller than base size");
684 
690  const DictionaryEntry bytes;
691 
692  public:
693  DeltaPattern(const int number,
694  const uint64_t code,
695  const uint64_t metadata_length,
696  const int match_location,
697  const DictionaryEntry bytes)
698  : DictionaryCompressor<T>::Pattern(number, code, metadata_length,
699  DeltaSizeBits, match_location, false),
700  bytes(bytes)
701  {
702  }
703 
712  static bool
714  const DictionaryEntry& base_bytes)
715  {
716  const typename std::make_signed<T>::type limit = DeltaSizeBits ?
717  mask(DeltaSizeBits - 1) : 0;
718  const T value =
720  const T base =
722  const typename std::make_signed<T>::type delta = value - base;
723  return (delta >= -limit) && (delta <= limit);
724  }
725 
726  static bool
728  const DictionaryEntry& dict_bytes, const int match_location)
729  {
730  return (match_location >= 0) && isValidDelta(bytes, dict_bytes);
731  }
732 
734  decompress(const DictionaryEntry dict_bytes) const override
735  {
736  return bytes;
737  }
738 };
739 
750 template <class T>
751 template <unsigned N>
752 class DictionaryCompressor<T>::SignExtendedPattern
753  : public DictionaryCompressor<T>::Pattern
754 {
755  private:
756  static_assert((N > 0) & (N <= (sizeof(T) * 8)),
757  "The original data's type size must be smaller than the dictionary's");
758 
760  const T bits : N;
761 
762  public:
763  SignExtendedPattern(const int number,
764  const uint64_t code,
765  const uint64_t metadata_length,
766  const DictionaryEntry bytes,
767  const bool allocate = false)
768  : DictionaryCompressor<T>::Pattern(number, code, metadata_length, N,
769  -1, allocate),
770  bits(fromDictionaryEntry(bytes) & mask(N))
771  {
772  }
773 
774  static bool
776  const DictionaryEntry& dict_bytes, const int match_location)
777  {
779  return data == sext<N>(data & mask(N));
780  }
781 
783  decompress(const DictionaryEntry dict_bytes) const override
784  {
785  return toDictionaryEntry(sext<N>(bits));
786  }
787 };
788 
789 } // namespace Compressor
790 
791 #endif //__MEM_CACHE_COMPRESSORS_DICTIONARY_COMPRESSOR_HH__
Compressor::DictionaryCompressor::Pattern::getSizeBits
virtual std::size_t getSizeBits() const
Get size, in bits, of the pattern (excluding prefix).
Definition: dictionary_compressor.hh:352
Compressor::BaseDictionaryCompressor
Definition: dictionary_compressor.hh:63
Compressor::BaseDictionaryCompressor::BaseDictionaryCompressor
BaseDictionaryCompressor(const Params &p)
Definition: base_dictionary_compressor.cc:39
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:693
data
const char data[]
Definition: circlebuf.test.cc:47
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:470
popCount
constexpr int popCount(uint64_t val)
Returns the number of set ones in the provided value.
Definition: bitfield.hh:314
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:483
Compressor::DictionaryCompressor::DeltaPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:727
base.hh
Compressor::DictionaryCompressor::Pattern::getMatchLocation
uint8_t getMatchLocation() const
Get the index of the dictionary match location.
Definition: dictionary_compressor.hh:343
Compressor
Definition: base.cc:47
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:617
Compressor::DictionaryCompressor< uint64_t >::DictionaryEntry
std::array< uint8_t, sizeof(uint64_t)> DictionaryEntry
Convenience typedef for a dictionary entry.
Definition: dictionary_compressor.hh:117
Compressor::DictionaryCompressor::SignExtendedPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:775
Compressor::DictionaryCompressor::Pattern::print
std::string print() const
Extract pattern's information to a string.
Definition: dictionary_compressor.hh:370
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:294
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:611
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:138
Compressor::DictionaryCompressor::UncompressedPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:439
Compressor::DictionaryCompressor::UncompressedPattern::data
const DictionaryEntry data
A copy of the original data.
Definition: dictionary_compressor.hh:416
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:70
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:182
Compressor::Base
Base cache compressor interface.
Definition: base.hh:59
Compressor::BaseDictionaryCompressor::~BaseDictionaryCompressor
~BaseDictionaryCompressor()=default
Compressor::Base::BaseStats
Definition: base.hh:126
Stats::Vector
A vector of scalar stats.
Definition: statistics.hh:2007
Compressor::DictionaryCompressor::SignExtendedPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:783
Compressor::DictionaryCompressor::MaskedValuePattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:552
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:297
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:312
Compressor::Base::CompressionData
Definition: base.hh:240
Compressor::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:113
bitfield.hh
Compressor::BaseDictionaryCompressor::DictionaryStats
Definition: dictionary_compressor.hh:72
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:528
Compressor::DictionaryCompressor::Pattern::allocate
const bool allocate
Wether the pattern allocates a dictionary entry or not.
Definition: dictionary_compressor.hh:300
statistics.hh
Compressor::BaseDictionaryCompressor::DictionaryStats::patterns
Stats::Vector patterns
Number of data entries that were compressed to each pattern.
Definition: dictionary_compressor.hh:82
Compressor::DictionaryCompressor::Pattern::patternNumber
const int patternNumber
Pattern enum number.
Definition: dictionary_compressor.hh:285
Compressor::BaseDictionaryCompressor::DictionaryStats::DictionaryStats
DictionaryStats(BaseStats &base_group, BaseDictionaryCompressor &_compressor)
Definition: base_dictionary_compressor.cc:45
Compressor::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:196
Compressor::DictionaryCompressor::MaskedValuePattern
A pattern that compares masked values to a masked portion of a fixed value.
Definition: dictionary_compressor.hh:131
Compressor::DictionaryCompressor::SignExtendedPattern::bits
const T bits
The non-extended original value.
Definition: dictionary_compressor.hh:757
Compressor::DictionaryCompressor::MaskedPattern::bits
const T bits
A copy of the bits that do not belong to the mask.
Definition: dictionary_compressor.hh:464
Compressor::DictionaryCompressor::CompData::entries
std::vector< std::unique_ptr< Pattern > > entries
The patterns matched in the original line.
Definition: dictionary_compressor.hh:392
Compressor::DictionaryCompressor::SignExtendedPattern
A pattern that checks whether the value is an N bits sign-extended value, that is,...
Definition: dictionary_compressor.hh:139
Compressor::DictionaryCompressor::Pattern::shouldAllocate
bool shouldAllocate() const
Determine if pattern allocates a dictionary entry.
Definition: dictionary_compressor.hh:362
Compressor::DictionaryCompressor::MaskedPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:494
Compressor::DictionaryCompressor::DeltaPattern::bytes
const DictionaryEntry bytes
The original value.
Definition: dictionary_compressor.hh:683
Compressor::DictionaryCompressor::MaskedValuePattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:540
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:269
Compressor::DictionaryCompressor::fromDictionaryEntry
static T fromDictionaryEntry(const DictionaryEntry &entry)
Turn a dictionary entry into a value.
Definition: dictionary_compressor_impl.hh:225
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:149
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:135
Compressor::DictionaryCompressor::toDictionaryEntry
static DictionaryEntry toDictionaryEntry(T value)
Turn a value into a dictionary entry.
Definition: dictionary_compressor_impl.hh:213
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:137
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:419
Compressor::BaseDictionaryCompressor::Params
BaseDictionaryCompressorParams Params
Definition: dictionary_compressor.hh:101
Stats::Group
Statistics container.
Definition: group.hh:87
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:572
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:79
Compressor::DictionaryCompressor::Factory
Create a factory to determine if input matches a pattern.
Definition: dictionary_compressor.hh:147
Compressor::DictionaryCompressor::dictionary
std::vector< DictionaryEntry > dictionary
The dictionary.
Definition: dictionary_compressor.hh:190
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:164
X86ISA::limit
BitfieldType< SegDescriptorLimit > limit
Definition: misc.hh:924
bits
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:73
X86ISA::type
type
Definition: misc.hh:727
Compressor::DictionaryCompressor::Pattern::getCode
uint8_t getCode() const
Get code of this pattern.
Definition: dictionary_compressor.hh:336
Compressor::DictionaryCompressor::DeltaPattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:734
Compressor::BaseDictionaryCompressor::DictionaryStats::compressor
const BaseDictionaryCompressor & compressor
Definition: dictionary_compressor.hh:74
Compressor::DictionaryCompressor::RepeatedValuePattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:630
Compressor::DictionaryCompressor::SignExtendedPattern::SignExtendedPattern
SignExtendedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const DictionaryEntry bytes, const bool allocate=false)
Definition: dictionary_compressor.hh:763
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Compressor::DictionaryCompressor::DictionaryCompressor
DictionaryCompressor(const Params &p)
Definition: dictionary_compressor_impl.hh:63
Compressor::DictionaryCompressor::~DictionaryCompressor
~DictionaryCompressor()=default
Compressor::DictionaryCompressor::RepeatedValuePattern::decompress
DictionaryEntry decompress(const DictionaryEntry dict_bytes) const override
Decompress the pattern.
Definition: dictionary_compressor.hh:649
Compressor::DictionaryCompressor::UncompressedPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:431
Compressor::DictionaryCompressor::LocatedMaskedPattern
A pattern that narrows the MaskedPattern by allowing a only single possible dictionary entry to be ma...
Definition: dictionary_compressor.hh:133
Compressor::DictionaryCompressor::Pattern
The compressed data is composed of multiple pattern entries.
Definition: dictionary_compressor.hh:281
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:713
Compressor::DictionaryCompressor::Pattern::length
const uint8_t length
Length, in bits, of the code and match location.
Definition: dictionary_compressor.hh:291
Compressor::BaseDictionaryCompressor::dictionarySize
const std::size_t dictionarySize
Dictionary size.
Definition: dictionary_compressor.hh:67
Compressor::DictionaryCompressor::decompress
void decompress(const CompressionData *comp_data, uint64_t *data) override
Apply the decompression process to the compressed data.
Definition: dictionary_compressor_impl.hh:183
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:288
Compressor::DictionaryCompressor::MaskedPattern
A pattern that compares masked values against dictionary entries.
Definition: dictionary_compressor.hh:129
Compressor::DictionaryCompressor::LocatedMaskedPattern::isPattern
static bool isPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
Definition: dictionary_compressor.hh:584
Compressor::DictionaryCompressor::UncompressedPattern
A pattern containing the original uncompressed data.
Definition: dictionary_compressor.hh:411
ArmISA::mask
Bitfield< 28, 24 > mask
Definition: miscregs_types.hh:711
Compressor::DictionaryCompressor::CompData
Definition: dictionary_compressor.hh:388
Compressor::DictionaryCompressor::Pattern::getPatternNumber
int getPatternNumber() const
Get enum number associated to this pattern.
Definition: dictionary_compressor.hh:329
Compressor::BaseDictionaryCompressor::DictionaryStats::regStats
void regStats() override
Callback to set stat parameters.
Definition: base_dictionary_compressor.cc:54

Generated on Tue Jun 22 2021 15:28:29 for gem5 by doxygen 1.8.17