source: icGREP/icgrep-devel/icgrep/kernels/lzparabix/LZParabixAioKernel.h @ 6114

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

Init check in for new compression format (lzparabix) related kernels and pipelines, including compressor, decoder and grep

File size: 2.5 KB
Line 
1//
2// Created by wxy325 on 2018/6/18.
3//
4
5#ifndef ICGREP_LZPARABIXAIOKERNEL_H
6#define ICGREP_LZPARABIXAIOKERNEL_H
7
8#include "kernels/kernel.h"
9#include <string>
10#include <map>
11#include <vector>
12
13namespace llvm {
14    class Module;
15    class Function;
16    class BasicBlock;
17    class Value;
18}
19
20namespace IDISA { class IDISA_Builder; }
21
22namespace kernel {
23
24    class LZParabixAioKernel : public SegmentOrientedKernel {
25
26    public:
27        LZParabixAioKernel(const std::unique_ptr<kernel::KernelBuilder> &b, std::vector<unsigned> numsOfBitStreams = {8});
28
29    protected:
30        void generateProcessCompressedBlock(const std::unique_ptr<KernelBuilder> &b, llvm::Value *lz4BlockStart,
31                                            llvm::Value *lz4BlockEnd);
32        void generateDoSegmentMethod(const std::unique_ptr<KernelBuilder> &b) override;
33        llvm::Value *generateLoadInt64NumberInput(const std::unique_ptr<KernelBuilder> &iBuilder,
34                                                  std::string inputBufferName, llvm::Value *globalOffset);
35        llvm::Value *processSequence(const std::unique_ptr<KernelBuilder> &b, llvm::Value *beginTokenPos,
36                                                         llvm::Value *lz4BlockEnd);
37        llvm::Value *processLiteral(const std::unique_ptr<KernelBuilder> &b, llvm::Value* cursorPos, llvm::Value* literalLength);
38        llvm::Value *processMatch(const std::unique_ptr<KernelBuilder> &b, llvm::Value* cursorPos, llvm::Value* matchOffset, llvm::Value* sequenceBasePtr);
39
40
41        std::vector<unsigned> mNumsOfBitStreams;
42
43
44        // ---- Output
45        void initPendingOutputScalar(const std::unique_ptr<KernelBuilder> &b);
46        void appendBitStreamOutput(const std::unique_ptr<KernelBuilder> &b, std::vector<llvm::Value*>& extractedValues, llvm::Value* valueLength);
47        void storePendingOutput(const std::unique_ptr<KernelBuilder> &b);
48
49
50        void initPendingOutputScalar_BitStream(const std::unique_ptr<KernelBuilder> &b);
51        void appendBitStreamOutput_BitStream(const std::unique_ptr<KernelBuilder> &b, std::vector<llvm::Value*>& extractedValues, llvm::Value* valueLength);
52        void storePendingOutput_BitStream(const std::unique_ptr<KernelBuilder> &b);
53
54
55        void initPendingOutputScalar_Swizzled(const std::unique_ptr<KernelBuilder> &b);
56        void appendBitStreamOutput_Swizzled(const std::unique_ptr<KernelBuilder> &b, std::vector<llvm::Value*>& extractedValues, llvm::Value* valueLength);
57        void storePendingOutput_Swizzled(const std::unique_ptr<KernelBuilder> &b);
58    };
59
60}
61
62
63
64
65#endif //ICGREP_LZPARABIXAIOKERNEL_H
Note: See TracBrowser for help on using the repository browser.