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

Last change on this file since 6184 was 6184, checked in by nmedfort, 8 months ago

Initial version of PipelineKernel? + revised StreamSet? model.

File size: 2.1 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#include <toolchain/cpudriver.h>
15#include <string>
16
17namespace kernel { class StreamSet; }
18namespace kernel { class Scalar; }
19
20struct LZ4BlockInfo {
21    kernel::StreamSet * blockStart;
22    kernel::StreamSet * blockEnd;
23    kernel::StreamSet * isCompress;
24
25    LZ4BlockInfo() : blockStart(nullptr), blockEnd(nullptr), isCompress(nullptr) { }
26};
27
28class LZ4BaseGenerator {
29public:
30    LZ4BaseGenerator();
31    virtual ~LZ4BaseGenerator();
32protected:
33    //// Member Function
34    // Input
35    kernel::StreamSet * loadByteStream();
36    std::pair<kernel::StreamSet*, kernel::StreamSet*> loadByteStreamAndBitStream();
37
38    // Stream Conversion
39    kernel::StreamSet* s2p(kernel::StreamSet* byteStream);
40    kernel::StreamSet* p2s(kernel::StreamSet* bitStream);
41
42
43            // LZ4 Decoder
44    LZ4BlockInfo getBlockInfo(kernel::StreamSet* compressedByteStream);
45
46    kernel::StreamSet * byteStreamDecompression(kernel::StreamSet* compressedByteStream);
47
48    kernel::StreamSet * swizzledDecompression(kernel::StreamSet* compressedByteStream, kernel::StreamSet* compressedBasisBits);
49
50    kernel::StreamSet * bitStreamDecompression(kernel::StreamSet* compressedByteStream, kernel::StreamSet* compressedBasisBits);
51
52    kernel::StreamSets convertCompressedBitsStreamWithBitStreamAioApproach(kernel::StreamSet* compressedByteStream, kernel::StreamSets compressedBitStreams);
53
54    // BufferSize related Helper Function
55    unsigned getDefaultBufferBlocks();
56    unsigned getBlockSizeBufferBlocks();
57
58
59    //// Data Member
60    // Driver
61    CPUDriver mPxDriver;
62    std::unique_ptr<kernel::PipelineBuilder> mPipeline;
63
64    // Runtime Arguments
65    kernel::Scalar * mInputStream;
66    kernel::Scalar * mHeaderSize;
67    kernel::Scalar * mFileSize;
68    kernel::Scalar * mHasBlockChecksum;
69
70    const unsigned mLz4BlockSize;
71
72    LZ4BlockInfo mBlockInfo;
73};
74
75
76#endif //ICGREP_LZ4BASEGENERATOR_H
Note: See TracBrowser for help on using the repository browser.