source: icGREP/icgrep-devel/icgrep/lz4/lz4_base_generator.h @ 6137

Last change on this file since 6137 was 6137, checked in by xwa163, 12 months ago
  1. LZ4 ScanMatch? pipeline
  2. Refactor LZ4 Generator
  3. Adjust some naming
File size: 2.2 KB
Line 
1
2
3#ifndef ICGREP_LZ4BASEGENERATOR_H
4#define ICGREP_LZ4BASEGENERATOR_H
5
6#include <llvm/IR/Module.h>
7#include <llvm/IR/Function.h>
8
9#include <llvm/Support/Signals.h>
10#include <llvm/Support/ManagedStatic.h>
11#include <IR_Gen/idisa_target.h>
12
13#include <toolchain/toolchain.h>
14
15#include <toolchain/cpudriver.h>
16#include <string>
17
18struct LZ4BlockInfo {
19    parabix::StreamSetBuffer* blockStart;
20    parabix::StreamSetBuffer* blockEnd;
21    parabix::StreamSetBuffer* isCompress;
22};
23
24class LZ4BaseGenerator {
25public:
26    LZ4BaseGenerator();
27
28protected:
29    //// Member Function
30    // Input
31    parabix::StreamSetBuffer* loadByteStream();
32    std::pair<parabix::StreamSetBuffer*, parabix::StreamSetBuffer*> loadByteStreamAndBitStream();
33
34    // Stream Conversion
35    parabix::StreamSetBuffer* s2p(parabix::StreamSetBuffer* byteStream);
36
37
38            // LZ4 Decoder
39    LZ4BlockInfo getBlockInfo(parabix::StreamSetBuffer* compressedByteStream);
40    parabix::StreamSetBuffer * byteStreamDecompression(
41            parabix::StreamSetBuffer* compressedByteStream
42    );
43    parabix::StreamSetBuffer * swizzledDecompression(
44            parabix::StreamSetBuffer* compressedByteStream,
45            parabix::StreamSetBuffer* compressedBasisBits
46    );
47    parabix::StreamSetBuffer * bitStreamDecompression(
48            parabix::StreamSetBuffer* compressedByteStream,
49            parabix::StreamSetBuffer* compressedBasisBits
50    );
51
52    parabix::StreamSetBuffer *parallelByteStreamDecompression(
53            parabix::StreamSetBuffer *compressedByteStream,
54            bool enableGather, bool enableScatter, int minParallelLevel
55    );
56
57    std::vector<parabix::StreamSetBuffer*> convertCompressedBitsStreamWithBitStreamAioApproach(
58            parabix::StreamSetBuffer* compressedByteStream,
59            std::vector<parabix::StreamSetBuffer*> compressedBitStreams
60    );
61
62
63
64    // BufferSize related Helper Function
65    unsigned getDefaultBufferBlocks();
66    unsigned getBlockSizeBufferBlocks();
67
68
69    //// Data Member
70    // Driver
71    ParabixDriver mPxDriver;
72
73    // Runtime Arguments
74    llvm::Value * mInputStream;
75    llvm::Value * mHeaderSize;
76    llvm::Value * mFileSize;
77    llvm::Value * mHasBlockChecksum;
78
79    unsigned mLz4BlockSize;
80};
81
82
83#endif //ICGREP_LZ4BASEGENERATOR_H
Note: See TracBrowser for help on using the repository browser.