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

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

Init checkin for lz4_grep count-only pipeline with multiplexing

File size: 2.1 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    std::pair<parabix::StreamSetBuffer *, parabix::StreamSetBuffer *> multiplexingGrepPipeline(std::vector<re::RE *> &REs);
27
28
29    void invokeScanMatchGrep(char* fileBuffer, size_t blockStart, size_t blockEnd, bool hasBlockChecksum);
30
31private:
32    bool mEnableMultiplexing;
33
34    grep::GrepRecordBreakKind mGrepRecordBreak;
35    void initREs(std::vector<re::RE *> & REs);
36
37
38    re::CC * mBreakCC;
39    std::vector<re:: RE *> mREs;
40    std::set<re::Name *> mUnicodeProperties;
41    bool mMoveMatchesToEOL;
42
43
44    std::vector<std::ostringstream> mResultStrs;
45
46
47    void generateScanMatchMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
48
49
50    llvm::Value * match_accumulator;
51
52    ScanMatchGrepMainFunctionType getScanMatchGrepMainFunction();
53
54    std::unique_ptr<cc::MultiplexedAlphabet> mpx;
55
56    parabix::StreamSetBuffer * linefeedStreamFromDecompressedBits(parabix::StreamSetBuffer *decompressedBasisBits);
57    parabix::StreamSetBuffer * linefeedStreamFromCompressedBits();
58
59    parabix::StreamSetBuffer * convertCompressedBitsStream(parabix::StreamSetBuffer* compressedBitStream, int numberOfStream, std::string prefix);
60};
61
62
63#endif //ICGREP_LZ4GREPGENERATOR_H
Note: See TracBrowser for help on using the repository browser.