Ignore:
Timestamp:
Feb 20, 2017, 10:39:44 AM (2 years ago)
Author:
xuedongx
Message:

add LineBreak? kernel for icGrep

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5329 r5333  
    3636#include <util/aligned_allocator.h>
    3737
     38
    3839using namespace parabix;
    3940using namespace llvm;
     
    336337    kernel::S2PKernel  s2pk(iBuilder);
    337338    s2pk.generateKernel({&ByteStream}, {&BasisBits});
    338        
     339   
     340    std::vector<re::CC *> LF;
     341    LF.push_back(re::makeCC(0x0A));
     342   
     343    kernel::ParabixCharacterClassKernelBuilder linebreakK(iBuilder, "linebreak", LF, encodingBits);
     344    CircularBuffer LineBreakStream(iBuilder, iBuilder->getStreamSetTy(1, 1), segmentSize * bufferSegments);
     345    LineBreakStream.allocateBuffer();
     346    linebreakK.generateKernel({&BasisBits}, {&LineBreakStream});
     347
     348
    339349    pablo::PabloKernel icgrepK(iBuilder, "icgrep", {Binding{iBuilder->getStreamSetTy(8), "basis"}});
    340350    re::re2pablo_compiler(&icgrepK, re::regular_expression_passes(re_ast), CountOnly);
     
    366376#endif
    367377        if (CPU_Only) {
    368             CircularBuffer MatchResults(iBuilder, iBuilder->getStreamSetTy(2, 1), segmentSize * bufferSegments);
     378            CircularBuffer MatchResults(iBuilder, iBuilder->getStreamSetTy(1, 1), segmentSize * bufferSegments);
    369379            MatchResults.allocateBuffer();
    370380
     
    372382
    373383            kernel::ScanMatchKernel scanMatchK(iBuilder, mGrepType);
    374             scanMatchK.generateKernel({&MatchResults}, {});               
     384            scanMatchK.generateKernel({&MatchResults, &LineBreakStream}, {});               
    375385            scanMatchK.setInitialArguments({iBuilder->CreateBitCast(inputStream, int8PtrTy), fileSize, fileIdx});
    376386
    377387            if (pipelineParallel){
    378                 generatePipelineParallel(iBuilder, {&mmapK, &s2pk, &icgrepK, &scanMatchK});
     388                generatePipelineParallel(iBuilder, {&mmapK, &s2pk, &icgrepK, &linebreakK, &scanMatchK});
    379389            } else if (segmentPipelineParallel){
    380                 generateSegmentParallelPipeline(iBuilder, {&mmapK, &s2pk, &icgrepK, &scanMatchK});
     390                generateSegmentParallelPipeline(iBuilder, {&mmapK, &s2pk, &icgrepK, &linebreakK, &scanMatchK});
    381391            }  else{
    382                 generatePipelineLoop(iBuilder, {&mmapK, &s2pk, &icgrepK, &scanMatchK});
     392                generatePipelineLoop(iBuilder, {&mmapK, &s2pk, &icgrepK, &linebreakK, &scanMatchK});
    383393            }
    384394        }
Note: See TracChangeset for help on using the changeset viewer.