Ignore:
Timestamp:
Jan 12, 2017, 7:03:38 PM (3 years ago)
Author:
cameron
Message:

finalSegment kernel methods initial check-in

File:
1 edited

Legend:

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

    r5255 r5257  
    222222Function * editdPipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder, const std::vector<std::string> & patterns) {
    223223   
    224     ExternalFileBuffer ChStream(iBuilder, iBuilder->getStreamSetTy(4));
    225     SingleBlockBuffer MatchResults(iBuilder, iBuilder->getStreamSetTy(editDistance + 1));
    226 
    227     PabloKernel editdk(iBuilder, "editd");
    228 
    229     buildPatternKernel(editdk, iBuilder, patterns);
    230 
    231     kernel::editdScanKernel editdScanK(iBuilder, editDistance);
    232    
    233     std::unique_ptr<Module> editdM = editdk.createKernelModule({&ChStream}, {&MatchResults});
    234     std::unique_ptr<Module> scanM = editdScanK.createKernelModule({&MatchResults}, {});               
    235    
    236     editdk.addKernelDeclarations(mMod);
    237     editdScanK.addKernelDeclarations(mMod);
    238 
    239224    Type * const size_ty = iBuilder->getSizeTy();
    240225    Type * const voidTy = iBuilder->getVoidTy();
     
    250235    fileSize->setName("fileSize");
    251236   
     237    ExternalFileBuffer ChStream(iBuilder, iBuilder->getStreamSetTy(4));
     238    SingleBlockBuffer MatchResults(iBuilder, iBuilder->getStreamSetTy(editDistance + 1));
     239
     240    MMapSourceKernel mmapK(iBuilder);
     241    std::unique_ptr<Module> mmapM = mmapK.createKernelModule({}, {&ChStream});
     242    mmapK.setInitialArguments({fileSize});
     243   
     244    PabloKernel editdk(iBuilder, "editd");
     245
     246    buildPatternKernel(editdk, iBuilder, patterns);
     247
     248    kernel::editdScanKernel editdScanK(iBuilder, editDistance);
     249   
     250    std::unique_ptr<Module> editdM = editdk.createKernelModule({&ChStream}, {&MatchResults});
     251    std::unique_ptr<Module> scanM = editdScanK.createKernelModule({&MatchResults}, {});               
     252   
     253    mmapK.addKernelDeclarations(mMod);
     254    editdk.addKernelDeclarations(mMod);
     255    editdScanK.addKernelDeclarations(mMod);
     256
    252257    iBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", main,0));
    253258
     
    255260    MatchResults.allocateBuffer();
    256261   
    257     generatePipelineLoop(iBuilder, {&editdk, &editdScanK});
     262    generatePipelineLoop(iBuilder, {&mmapK, &editdk, &editdScanK});
    258263       
    259264    iBuilder->CreateRetVoid();
    260265   
    261266    Linker L(*mMod);
     267    L.linkInModule(std::move(mmapM));
    262268    L.linkInModule(std::move(editdM));
    263269    L.linkInModule(std::move(scanM));
Note: See TracChangeset for help on using the changeset viewer.