gem5  v21.2.1.1
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits > Class Template Reference

A pattern that checks whether the difference of the value and the dictionary entries' is below a certain threshold. More...

#include <dictionary_compressor.hh>

Inheritance diagram for gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >:
gem5::compression::DictionaryCompressor< T >::Pattern

Public Member Functions

 DeltaPattern (const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes)
 
DictionaryEntry decompress (const DictionaryEntry dict_bytes) const override
 Decompress the pattern. More...
 
- Public Member Functions inherited from gem5::compression::DictionaryCompressor< T >::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. More...
 
virtual ~Pattern ()=default
 Default destructor. More...
 
int getPatternNumber () const
 Get enum number associated to this pattern. More...
 
uint8_t getCode () const
 Get code of this pattern. More...
 
uint8_t getMatchLocation () const
 Get the index of the dictionary match location. More...
 
virtual std::size_t getSizeBits () const
 Get size, in bits, of the pattern (excluding prefix). More...
 
bool shouldAllocate () const
 Determine if pattern allocates a dictionary entry. More...
 
std::string print () const
 Extract pattern's information to a string. More...
 

Static Public Member Functions

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 limited sized container. More...
 
static bool isPattern (const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location)
 

Private Attributes

const DictionaryEntry bytes
 The original value. More...
 

Additional Inherited Members

- Protected Attributes inherited from gem5::compression::DictionaryCompressor< T >::Pattern
const int patternNumber
 Pattern enum number. More...
 
const uint8_t code
 Code associated to the pattern. More...
 
const uint8_t length
 Length, in bits, of the code and match location. More...
 
const uint8_t numUnmatchedBits
 Number of unmatched bits. More...
 
const int matchLocation
 Index representing the the match location. More...
 
const bool allocate
 Wether the pattern allocates a dictionary entry or not. More...
 

Detailed Description

template<class T>
template<std::size_t DeltaSizeBits>
class gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >

A pattern that checks whether the difference of the value and the dictionary entries' is below a certain threshold.

If so, the pattern is successful, and only the delta bits need to be stored.

For example, if the delta can only contain up to 4 bits, and the dictionary contains the entry 0xA231, the value 0xA232 would be compressible, and the delta 0x1 would be stored. The value 0xA249, on the other hand, would not be compressible, since its delta (0x18) needs 5 bits to be stored.

Template Parameters
DeltaSizeBitsSize of a delta entry, in number of bits, which determines the threshold. Must always be smaller than the dictionary entry type's size.

Definition at line 142 of file dictionary_compressor.hh.

Constructor & Destructor Documentation

◆ DeltaPattern()

template<class T >
template<std::size_t DeltaSizeBits>
gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >::DeltaPattern ( const int  number,
const uint64_t  code,
const uint64_t  metadata_length,
const int  match_location,
const DictionaryEntry  bytes 
)
inline

Definition at line 698 of file dictionary_compressor.hh.

Member Function Documentation

◆ decompress()

template<class T >
template<std::size_t DeltaSizeBits>
DictionaryEntry gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >::decompress ( const DictionaryEntry  dict_bytes) const
inlineoverridevirtual

Decompress the pattern.

Each pattern has its own way of interpreting its data.

Parameters
dict_bytesThe bytes in the corresponding matching entry.
Returns
The decompressed pattern.

Implements gem5::compression::DictionaryCompressor< T >::Pattern.

Definition at line 739 of file dictionary_compressor.hh.

◆ isPattern()

template<class T >
template<std::size_t DeltaSizeBits>
static bool gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >::isPattern ( const DictionaryEntry bytes,
const DictionaryEntry dict_bytes,
const int  match_location 
)
inlinestatic

Definition at line 732 of file dictionary_compressor.hh.

◆ isValidDelta()

template<class T >
template<std::size_t DeltaSizeBits>
static bool gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >::isValidDelta ( const DictionaryEntry bytes,
const DictionaryEntry base_bytes 
)
inlinestatic

Compares a given value against a base to calculate their delta, and then determines whether it fits a limited sized container.

Parameters
bytesValue to be compared against base.
base_bytesBase value.
Returns
Whether the value fits in the container.

Definition at line 718 of file dictionary_compressor.hh.

References gem5::X86ISA::base, gem5::compression::DictionaryCompressor< T >::fromDictionaryEntry(), gem5::X86ISA::limit, gem5::mask(), and gem5::X86ISA::type.

Member Data Documentation

◆ bytes

template<class T >
template<std::size_t DeltaSizeBits>
const DictionaryEntry gem5::compression::DictionaryCompressor< T >::DeltaPattern< DeltaSizeBits >::bytes
private

The original value.

In theory we should keep only the deltas, but the dictionary entry is not inserted in the dictionary before the call to the constructor, so the delta cannot be calculated then.

Definition at line 688 of file dictionary_compressor.hh.


The documentation for this class was generated from the following file:

Generated on Wed May 4 2022 12:15:02 for gem5 by doxygen 1.8.17