Ignore:
Timestamp:
Jan 10, 2017, 5:43:35 PM (2 years ago)
Author:
cameron
Message:

Add mmap kernel to all pipelines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/array-test.cpp

    r5245 r5254  
    2929#include <kernels/interface.h>
    3030#include <kernels/kernel.h>
     31#include <kernels/mmap_kernel.h>
    3132#include <kernels/pipeline.h>
    3233#include <pablo/builder.hpp>
     
    106107    Type * byteStreamTy = iBuilder->getStreamSetTy(1, 8);
    107108
     109    Module * const mod = iBuilder->getModule();
     110   
     111    Function * const main = cast<Function>(mod->getOrInsertFunction("Main", iBuilder->getVoidTy(), byteStreamTy->getPointerTo(), iBuilder->getSizeTy(), nullptr));
     112    main->setCallingConv(CallingConv::C);
     113    Function::arg_iterator args = main->arg_begin();
     114   
     115    Value * const inputStream = &*(args++);
     116    inputStream->setName("input");
     117    Value * const fileSize = &*(args++);
     118    fileSize->setName("fileSize");
     119   
    108120    ExternalFileBuffer ByteStream(iBuilder, byteStreamTy);
    109121    SingleBlockBuffer BasisBits(iBuilder, iBuilder->getStreamSetTy(8, 1));
    110122    SingleBlockBuffer matches(iBuilder, iBuilder->getStreamSetTy(count, 1));
    111123
     124    MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     125    mmapK.generateKernel({}, {&ByteStream});
     126    mmapK.setInitialArguments({fileSize});
     127   
    112128    S2PKernel  s2pk(iBuilder);
    113129    s2pk.generateKernel({&ByteStream}, {&BasisBits});
     
    118134    bm.generateKernel({&BasisBits}, {&matches});
    119135
    120     Module * const mod = iBuilder->getModule();
    121 
    122     Function * const main = cast<Function>(mod->getOrInsertFunction("Main", iBuilder->getVoidTy(), byteStreamTy->getPointerTo(), iBuilder->getSizeTy(), nullptr));
    123     main->setCallingConv(CallingConv::C);
    124     Function::arg_iterator args = main->arg_begin();
    125 
    126     Value * const inputStream = &*(args++);
    127     inputStream->setName("input");
    128     Value * const fileSize = &*(args++);
    129     fileSize->setName("fileSize");
    130 
    131136    iBuilder->SetInsertPoint(BasicBlock::Create(mod->getContext(), "entry", main, 0));
    132137
     
    135140    matches.allocateBuffer();
    136141
    137     generatePipelineLoop(iBuilder, {&s2pk, &bm});
     142    generatePipelineLoop(iBuilder, {&mmapK, &s2pk, &bm});
    138143    iBuilder->CreateRetVoid();
    139144
Note: See TracChangeset for help on using the changeset viewer.