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

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

Init checkin for lz4_grep count-only pipeline with multiplexing

File size: 2.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 generateExtractOnlyPipeline(const std::string &outputFile);
31    void generateSwizzledExtractOnlyPipeline(const std::string &outputFile);
32    void generateExtractAndDepositOnlyPipeline(const std::string &outputFile);
33    void generateSwizzledExtractAndDepositOnlyPipeline(const std::string &outputFile);
34
35protected:
36    //// Protected Method
37    void generateMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
38    // Pipeline
39    virtual void generateLoadByteStreamAndBitStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
40    virtual void generateExtractAndDepositMarkers(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
41    virtual std::pair<parabix::StreamSetBuffer*, parabix::StreamSetBuffer*> generateSwizzleExtractData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
42    virtual parabix::StreamSetBuffer* generateBitStreamExtractData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
43
44    void generateCompressionMarker(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
45
46    // BufferSize related Helper Function
47    virtual int getInputBufferBlocks();
48    virtual int getDecompressedBufferBlocks();
49    int get4MbBufferBlocks();
50
51
52    //// Data Member
53    // Driver
54    ParabixDriver mPxDriver;
55
56    // Runtime Arguments
57    llvm::Value * mInputStream;
58    llvm::Value * mHeaderSize;
59    llvm::Value * mFileSize;
60    llvm::Value * mHasBlockChecksum;
61
62
63    // StreamSetBuffers
64    parabix::StreamSetBuffer * mCompressedByteStream;
65    parabix::StreamSetBuffer * mCompressedBasisBits;
66    parabix::StreamSetBuffer * mDeletionMarker;
67    parabix::StreamSetBuffer * mCompressionMarker;
68    parabix::StreamSetBuffer * mDepositMarker;
69    parabix::StreamSetBuffer * mMatchOffsetMarker;
70
71    // M0CountMarker will not contain anything, it will only be used to pass producedItemCount and manage processedItemCount between different kernel
72    parabix::StreamSetBuffer * mM0Marker;
73};
74
75
76#endif //ICGREP_LZ4GENERATOR_H
Note: See TracBrowser for help on using the repository browser.