source: icGREP/icgrep-devel/icgrep/lzparabix/LZParabixGenerator.h @ 6123

Last change on this file since 6123 was 6123, checked in by xwa163, 13 months ago

Encode BitStream? directly in LZParabix compressed file

File size: 2.3 KB
Line 
1
2#ifndef ICGREP_LZPARABIXGENERATOR_H
3#define ICGREP_LZPARABIXGENERATOR_H
4#include <llvm/IR/Module.h>
5#include <llvm/IR/Function.h>
6
7#include <llvm/Support/Signals.h>
8#include <llvm/Support/ManagedStatic.h>
9#include <IR_Gen/idisa_target.h>
10
11#include <toolchain/toolchain.h>
12
13#include <toolchain/cpudriver.h>
14#include <string>
15#include <vector>
16
17typedef void (*MainFunctionType)(char * byte_data, size_t headerSize, size_t filesize, bool hasBlockChecksum);
18
19class LZParabixGenerator {
20public:
21    LZParabixGenerator();
22
23    MainFunctionType getMainFunc();
24
25    void generatePipeline(const std::string &outputFile);
26
27protected:
28    //// Protected Method
29    void generateMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
30    virtual void generateLoadByteStreamAndBitStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
31
32
33    parabix::StreamSetBuffer* generateFullBitStreamDecompression(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
34    std::vector<parabix::StreamSetBuffer*> generateAioBitStreamDecompressoin(
35            const std::unique_ptr<kernel::KernelBuilder> & iBuilder,
36            std::vector<parabix::StreamSetBuffer*> bitStreamSets
37    );
38
39
40    // BufferSize related Helper Function
41    virtual int getInputBufferBlocks(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
42    virtual int getDecompressedBufferBlocks(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
43    int get4MbBufferBlocks();
44
45    //// Data Member
46    // Driver
47    ParabixDriver mPxDriver;
48    size_t mLzParabixBlockSize;
49
50
51    // Runtime Arguments
52    llvm::Value * mInputStream;
53    llvm::Value * mHeaderSize;
54    llvm::Value * mFileSize;
55    llvm::Value * mHasBlockChecksum;
56
57
58    // StreamSetBuffers
59    parabix::StreamSetBuffer * mCompressedByteStream;
60    parabix::StreamSetBuffer * mCompressedBasisBits;
61
62    // Block Data
63    void generateBlockData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
64    parabix::StreamSetBuffer * BlockData_BlockStart;
65    parabix::StreamSetBuffer * BlockData_BlockEnd;
66
67    parabix::StreamSetBuffer* extractLiteralBitStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
68
69    std::vector<parabix::StreamSetBuffer*> generateBitStreamDecompression(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, std::vector<parabix::StreamSetBuffer*> inputBitStreams);
70};
71
72
73#endif //ICGREP_LZPARABIXGENERATOR_H
Note: See TracBrowser for help on using the repository browser.