Changeset 5249


Ignore:
Timestamp:
Jan 8, 2017, 10:55:10 AM (10 months ago)
Author:
cameron
Message:

wc uses mmap kernel

File:
1 edited

Legend:

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

    r5238 r5249  
    3131#include <kernels/interface.h>
    3232#include <kernels/kernel.h>
     33#include <kernels/mmap_kernel.h>
    3334#include <kernels/s2p_kernel.h>
    3435#include <kernels/pipeline.h>
     
    136137Function * pipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder) {
    137138    Type * mBitBlockType = iBuilder->getBitBlockType();
    138    
    139     ExternalFileBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
    140 
    141     SingleBlockBuffer BasisBits(iBuilder, iBuilder->getStreamSetTy(8, 1));
    142 
    143     S2PKernel  s2pk(iBuilder);
    144     std::unique_ptr<Module> s2pM = s2pk.createKernelModule({&ByteStream}, {&BasisBits});
    145    
    146     PabloKernel wck(iBuilder, "wc");
    147     wc_gen(&wck);
    148     pablo_function_passes(&wck);
    149    
    150     std::unique_ptr<Module> wcM = wck.createKernelModule({&BasisBits}, {});
    151    
    152     s2pk.addKernelDeclarations(mMod);
    153     wck.addKernelDeclarations(mMod);
    154 
    155139    Constant * record_counts_routine;
    156140    Type * const size_ty = iBuilder->getSizeTy();
     
    170154    fileIdx->setName("fileIdx");
    171155   
     156    ExternalFileBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
     157
     158    SingleBlockBuffer BasisBits(iBuilder, iBuilder->getStreamSetTy(8, 1));
     159   
     160    MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     161    std::unique_ptr<Module> mmapM = mmapK.createKernelModule({}, {&ByteStream});
     162    mmapK.setInitialArguments({fileSize});
     163   
     164    S2PKernel  s2pk(iBuilder);
     165    std::unique_ptr<Module> s2pM = s2pk.createKernelModule({&ByteStream}, {&BasisBits});
     166
     167    PabloKernel wck(iBuilder, "wc");
     168    wc_gen(&wck);
     169    pablo_function_passes(&wck);
     170   
     171    std::unique_ptr<Module> wcM = wck.createKernelModule({&BasisBits}, {});
     172   
     173    mmapK.addKernelDeclarations(mMod);
     174    s2pk.addKernelDeclarations(mMod);
     175    wck.addKernelDeclarations(mMod);
     176   
    172177    iBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", main,0));
    173178
     
    175180    BasisBits.allocateBuffer();
    176181   
    177     generatePipelineLoop(iBuilder, {&s2pk, &wck});
     182    generatePipelineLoop(iBuilder, {&mmapK, &s2pk, &wck});
    178183   
    179184    Value * lineCount = wck.createGetAccumulatorCall(wck.getInstance(), "lineCount");
     
    186191   
    187192    Linker L(*mMod);
     193    L.linkInModule(std::move(mmapM));
    188194    L.linkInModule(std::move(s2pM));
    189195    L.linkInModule(std::move(wcM));
Note: See TracChangeset for help on using the changeset viewer.