Changeset 5333 for icGREP/icgrep-devel


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

add LineBreak? kernel for icGrep

Location:
icGREP/icgrep-devel/icgrep
Files:
3 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        }
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.cpp

    r5317 r5333  
    5151    Value * recordStart = getScalarField("LineStart");
    5252    Value * recordNum = getScalarField("LineNum");
    53     Value * matches = loadInputStreamBlock("matchResults", iBuilder->getInt32(0));
    54     Value * linebreaks = loadInputStreamBlock("matchResults", iBuilder->getInt32(1));
     53    Value * matches = loadInputStreamBlock("matchResult", iBuilder->getInt32(0));
     54    Value * linebreaks = loadInputStreamBlock("lineBreak", iBuilder->getInt32(0));
    5555    Value * matchWordVector = iBuilder->CreateBitCast(matches, scanwordVectorType);
    5656    Value * breakWordVector = iBuilder->CreateBitCast(linebreaks, scanwordVectorType);
     
    248248ScanMatchKernel::ScanMatchKernel(IDISA::IDISA_Builder * iBuilder, GrepType grepType)
    249249: BlockOrientedKernel(iBuilder, "scanMatch",
    250     {Binding{iBuilder->getStreamSetTy(2, 1), "matchResults"}},
     250    {Binding{iBuilder->getStreamSetTy(1, 1), "matchResult"}, Binding{iBuilder->getStreamSetTy(1, 1), "lineBreak"}},
    251251    {},
    252252    {Binding{iBuilder->getInt8PtrTy(), "FileBuf"}, Binding{iBuilder->getSizeTy(), "FileSize"}, Binding{iBuilder->getSizeTy(), "FileIdx"}},
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5310 r5333  
    233233        nestedCount.createAssign(output, nestedCount.createCount(matches));
    234234    } else {
    235         Var * const output = mKernel->addOutput("output", mKernel->getStreamSetTy(2));
     235        Var * const output = mKernel->addOutput("output", mKernel->getStreamSetTy(1));
    236236        mPB.createAssign(mPB.createExtract(output, mPB.getInteger(0)), matches);
    237         mPB.createAssign(mPB.createExtract(output, mPB.getInteger(1)), mLineBreak);
     237        //mPB.createAssign(mPB.createExtract(output, mPB.getInteger(1)), mLineBreak);
    238238    }
    239239}
Note: See TracChangeset for help on using the changeset viewer.