source: icGREP/icgrep-devel/icgrep/lz4/LZ4GrepGenerator.h @ 6059

Last change on this file since 6059 was 6059, checked in by xwa163, 12 months ago
  1. Enable swizzled match copy in multiplexing lz4_grep for some special case
  2. Implement some lz4 AIO (all-in-one) pipeline and related kernel
File size: 2.8 KB
Line 
1
2#ifndef ICGREP_LZ4GREPGENERATOR_H
3#define ICGREP_LZ4GREPGENERATOR_H
4
5#include "LZ4Generator.h"
6#include <grep_interface.h>
7#include <kernels/streamset.h>
8#include <cc/multiplex_CCs.h>
9#include <string>
10#include <vector>
11#include <sstream>
12#include <atomic>
13#include <grep/grep_engine.h>
14
15typedef void (*ScanMatchGrepMainFunctionType)(char * byte_data, size_t headerSize, size_t filesize, bool hasBlockChecksum, intptr_t match_accumulator);
16
17class LZ4GrepGenerator : public LZ4Generator{
18public:
19    LZ4GrepGenerator(bool enableMultiplexing = false);
20    void generateSwizzledCountOnlyGrepPipeline(re::RE *regex);
21    void generateCountOnlyGrepPipeline(re::RE *regex, bool enableGather = true);
22
23    void generateScanMatchGrepPipeline(re::RE* regex);
24    std::pair<parabix::StreamSetBuffer *, parabix::StreamSetBuffer *> grepPipeline(std::vector<re::RE *> &REs,
25                                                                                   parabix::StreamSetBuffer *decompressedBasisBits);
26
27    void generateMultiplexingCompressedBitStream(std::vector<re::RE *> &REs);
28    std::pair<parabix::StreamSetBuffer *, parabix::StreamSetBuffer *> multiplexingGrepPipeline(std::vector<re::RE *> &REs, bool useAio = false);
29
30
31    void invokeScanMatchGrep(char* fileBuffer, size_t blockStart, size_t blockEnd, bool hasBlockChecksum);
32
33    void generateMultiplexingSwizzledAioPipeline(re::RE* regex);
34    void generateMultiplexingSwizzledAioPipeline2(re::RE* regex);
35
36    void generateSwizzledAioPipeline(re::RE* regex);
37
38    void generateAioPipeline(re::RE* regex);
39
40private:
41    bool mEnableMultiplexing;
42
43    grep::GrepRecordBreakKind mGrepRecordBreak;
44    void initREs(std::vector<re::RE *> & REs);
45
46
47    re::CC * mBreakCC;
48    std::vector<re:: RE *> mREs;
49    std::set<re::Name *> mUnicodeProperties;
50    bool mMoveMatchesToEOL;
51
52
53    std::vector<std::ostringstream> mResultStrs;
54
55
56    void generateScanMatchMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
57
58
59    llvm::Value * match_accumulator;
60
61    ScanMatchGrepMainFunctionType getScanMatchGrepMainFunction();
62
63    std::unique_ptr<cc::MultiplexedAlphabet> mpx;
64
65    parabix::StreamSetBuffer * linefeedStreamFromDecompressedBits(parabix::StreamSetBuffer *decompressedBasisBits);
66    parabix::StreamSetBuffer * linefeedStreamFromCompressedBits();
67
68
69    parabix::StreamSetBuffer * convertCompressedBitsStreamWithSwizzledApproach(parabix::StreamSetBuffer* compressedBitStream, int numberOfStream, std::string prefix);
70    parabix::StreamSetBuffer * convertCompressedBitsStreamWithAioApproach(parabix::StreamSetBuffer* compressedBitStream, int numberOfStream, std::string prefix);
71    parabix::StreamSetBuffer * convertCompressedBitsStream(parabix::StreamSetBuffer* compressedBitStream, int numberOfStream, std::string prefix);
72};
73
74
75#endif //ICGREP_LZ4GREPGENERATOR_H
Note: See TracBrowser for help on using the repository browser.