source: icGREP/icgrep-devel/icgrep/lz4/LZ4Generator.h @ 6119

Last change on this file since 6119 was 6119, checked in by xwa163, 10 months ago
  1. Add some BasisSetNumbering? option to fix bug of multiplexing
  2. Use BiigEndian? BitNumbering? for lz4 and lzparabix related pipeline
  3. Support multiplexing in LZ4BitStreamAio pipeline
File size: 3.6 KB
Line 
1
2#ifndef ICGREP_LZ4GENERATOR_H
3#define ICGREP_LZ4GENERATOR_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
16namespace re { class CC; }
17
18
19typedef void (*MainFunctionType)(char * byte_data, size_t headerSize, size_t filesize, bool hasBlockChecksum);
20
21class LZ4Generator {
22
23public:
24    LZ4Generator();
25
26    MainFunctionType getMainFunc();
27
28    void generatePipeline(const std::string &outputFile);
29    void generateSwizzledPipeline(const std::string &outputFile);
30    void generateNewExtractOnlyPipeline(const std::string &outputFile);
31    void generateExtractOnlyPipeline(const std::string &outputFile);
32    void generateSwizzledExtractOnlyPipeline(const std::string &outputFile);
33    void generateExtractAndDepositOnlyPipeline(const std::string &outputFile);
34    void generateSwizzledExtractAndDepositOnlyPipeline(const std::string &outputFile);
35
36protected:
37    //// Protected Method
38    std::vector<parabix::StreamSetBuffer*> convertCompressedBitsStreamWithBitStreamAioApproach(
39            std::vector<parabix::StreamSetBuffer*> compressedBitStreams, std::string prefix);
40
41    void generateMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
42    // Pipeline
43    virtual void generateLoadByteStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
44    virtual void generateLoadByteStreamAndBitStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
45    virtual void generateExtractAndDepositMarkers(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
46    virtual parabix::StreamSetBuffer * generateParallelAIODecompression(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, bool enableGather, bool enableScatter, int minParallelLevel);
47    virtual parabix::StreamSetBuffer * generateAIODecompression(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
48    virtual parabix::StreamSetBuffer * generateSwizzledAIODecompression(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
49    virtual parabix::StreamSetBuffer * generateBitStreamAIODecompression(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
50
51    virtual std::pair<parabix::StreamSetBuffer*, parabix::StreamSetBuffer*> generateSwizzleExtractData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
52    virtual parabix::StreamSetBuffer* generateBitStreamExtractData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
53
54    void generateCompressionMarker(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
55
56    // BufferSize related Helper Function
57    virtual int getInputBufferBlocks(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
58    virtual int getDecompressedBufferBlocks(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
59    int get4MbBufferBlocks();
60
61
62    //// Data Member
63    // Driver
64    ParabixDriver mPxDriver;
65
66    // Runtime Arguments
67    llvm::Value * mInputStream;
68    llvm::Value * mHeaderSize;
69    llvm::Value * mFileSize;
70    llvm::Value * mHasBlockChecksum;
71
72
73    // StreamSetBuffers
74    parabix::StreamSetBuffer * mCompressedByteStream;
75    parabix::StreamSetBuffer * mCompressedBasisBits;
76    parabix::StreamSetBuffer * mDeletionMarker;
77    parabix::StreamSetBuffer * mCompressionMarker;
78    parabix::StreamSetBuffer * mDepositMarker;
79    parabix::StreamSetBuffer * mMatchOffsetMarker;
80
81    // M0CountMarker will not contain anything, it will only be used to pass producedItemCount and manage processedItemCount between different kernel
82    parabix::StreamSetBuffer * mM0Marker;
83
84    unsigned mLz4BlockSize;
85};
86
87
88#endif //ICGREP_LZ4GENERATOR_H
Note: See TracBrowser for help on using the repository browser.