Ignore:
Timestamp:
Jul 20, 2016, 1:15:01 PM (3 years ago)
Author:
cameron
Message:

Kernel system restructuring progress

File:
1 edited

Legend:

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

    r5101 r5102  
    132132
    133133    Encoding encoding(type, bits);
    134 
    135     ExternalUnboundedBuffer ByteStream(iBuilder, StreamSetType(1, i8));
    136     CircularBuffer BasisBits(iBuilder, StreamSetType(8, i1), segmentSize);
    137 
    138134    mIsNameExpression = isNameExpression;
    139     re_ast = re::regular_expression_passes(encoding, re_ast);   
    140     pablo::PabloFunction * function = re::re2pablo_compiler(encoding, re_ast);
    141    
    142     kernel::s2pKernel  s2pk(iBuilder, ByteStream, BasisBits);
    143     kernel::scanMatchKernel scanMatchK(iBuilder, 64, false);
    144    
    145     s2pk.generateKernel();
    146     scanMatchK.generateKernel();
    147    
    148     //std::unique_ptr<Module> s2pM = s2pk.createKernelModule();
    149     //std::unique_ptr<Module> scanMatchM = scanMatchK.createKernelModule();
    150    
    151     //s2pk.addKernelDeclarations(mMod);
    152     //scanMatchK.addKernelDeclarations(mMod);
    153    
    154     pablo_function_passes(function);
    155     pablo::PabloKernel  icgrepK(iBuilder, "icgrep", function, {"matchedLineCount"});
    156     icgrepK.generateKernel();
    157    
    158     //std::unique_ptr<Module> icgrepM = icgrepK.createKernelModule();
    159     //icgrepK.addKernelDeclarations(mMod);
    160    
     135
    161136    Type * const int64ty = iBuilder->getInt64Ty();
    162137    Type * const int8PtrTy = iBuilder->getInt8PtrTy();
     
    175150    fileIdx->setName("fileIdx");
    176151
     152       
     153    ExternalUnboundedBuffer ByteStream(iBuilder, StreamSetType(1, i8));
     154    CircularBuffer BasisBits(iBuilder, StreamSetType(8, i1), segmentSize);
     155    CircularBuffer MatchResults(iBuilder, StreamSetType(2, i1), segmentSize);
     156
     157    kernel::s2pKernel  s2pk(iBuilder, ByteStream, BasisBits);
     158    s2pk.generateKernel();
     159
     160    re_ast = re::regular_expression_passes(encoding, re_ast);   
     161    pablo::PabloFunction * function = re::re2pablo_compiler(encoding, re_ast);
     162    pablo_function_passes(function);
     163    pablo::PabloKernel  icgrepK(iBuilder, "icgrep", function, BasisBits, MatchResults, {"matchedLineCount"});
     164    icgrepK.generateKernel();
    177165
    178166    ByteStream.setStreamSetBuffer(inputStream);
    179167    BasisBits.allocateBuffer();
    180 
     168    MatchResults.allocateBuffer();
     169   
     170    Value * s2pInstance = s2pk.createInstance({}, {&ByteStream}, {&BasisBits});
     171    Value * icgrepInstance = icgrepK.createInstance({}, {&BasisBits}, {&MatchResults});
     172   
    181173    if (CountOnly) {
    182         Value * s2pInstance = s2pk.createInstance({}, {&ByteStream}, {&BasisBits});
    183         Value * icgrepInstance = icgrepK.createInstance({}, {&BasisBits}, {});
    184        
    185174        generatePipelineLoop(iBuilder, {&s2pk, &icgrepK}, {s2pInstance, icgrepInstance}, fileSize);
    186175        Value * matchCount = icgrepK.createGetAccumulatorCall(icgrepInstance, "matchedLineCount");
     
    188177    }
    189178    else {
    190        
    191         CircularBuffer MatchResults(iBuilder, StreamSetType(2, i1), segmentSize);
    192         ByteStream.setStreamSetBuffer(inputStream);
    193         BasisBits.allocateBuffer();
    194         MatchResults.allocateBuffer();
    195        
    196        
    197         Value * s2pInstance = s2pk.createInstance({}, {&ByteStream}, {&BasisBits});
    198         Value * icgrepInstance = icgrepK.createInstance({}, {&BasisBits}, {&MatchResults});
     179        kernel::scanMatchKernel scanMatchK(iBuilder, MatchResults, 64, false);
     180        scanMatchK.generateKernel();
     181               
    199182        Value * scanMatchInstance = scanMatchK.createInstance({iBuilder->CreateBitCast(inputStream, int8PtrTy), fileSize, fileIdx}, {&MatchResults}, {});
    200183       
Note: See TracChangeset for help on using the changeset viewer.