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

Add mmap kernel to all pipelines

File:
1 edited

Legend:

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

    r5243 r5254  
    2929#include <IR_Gen/idisa_target.h>
    3030#include <kernels/pipeline.h>
     31#include <kernels/mmap_kernel.h>
    3132#include <kernels/interface.h>
    3233#include <kernels/kernel.h>
     
    262263    assert (iBuilder);
    263264
     265    Type * const size_ty = iBuilder->getSizeTy();
     266    Type * const voidTy = iBuilder->getVoidTy();
     267    Type * const bitBlockType = iBuilder->getBitBlockType();
     268    Type * const inputType = ArrayType::get(ArrayType::get(bitBlockType, 8), 1)->getPointerTo();
     269    Type * const outputType = ArrayType::get(ArrayType::get(bitBlockType, 16), 1)->getPointerTo();
     270   
     271    Function * const main = cast<Function>(mod->getOrInsertFunction("Main", voidTy, inputType, outputType, size_ty, nullptr));
     272    main->setCallingConv(CallingConv::C);
     273    Function::arg_iterator args = main->arg_begin();
     274   
     275    Value * const inputStream = &*(args++);
     276    inputStream->setName("inputStream");
     277    Value * const outputStream = &*(args++);
     278    outputStream->setName("outputStream");
     279    Value * const fileSize = &*(args++);
     280    fileSize->setName("fileSize");
     281
    264282    ExternalFileBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
    265283
     
    278296    LinearCopybackBuffer U16out(iBuilder, iBuilder->getStreamSetTy(16, 16), segmentSize * bufferSegments + 2);
    279297
     298    MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     299    mmapK.generateKernel({}, {&ByteStream});
     300    mmapK.setInitialArguments({fileSize});
     301   
    280302    S2PKernel s2pk(iBuilder);
    281303
     
    303325    }
    304326
    305     Type * const size_ty = iBuilder->getSizeTy();
    306     Type * const voidTy = iBuilder->getVoidTy();
    307     Type * const bitBlockType = iBuilder->getBitBlockType();
    308     Type * const inputType = ArrayType::get(ArrayType::get(bitBlockType, 8), 1)->getPointerTo();
    309     Type * const outputType = ArrayType::get(ArrayType::get(bitBlockType, 16), 1)->getPointerTo();
    310    
    311     Function * const main = cast<Function>(mod->getOrInsertFunction("Main", voidTy, inputType, outputType, size_ty, nullptr));
    312     main->setCallingConv(CallingConv::C);
    313     Function::arg_iterator args = main->arg_begin();
    314 
    315     Value * const inputStream = &*(args++);
    316     inputStream->setName("inputStream");
    317     Value * const outputStream = &*(args++);
    318     outputStream->setName("outputStream");
    319     Value * const fileSize = &*(args++);
    320     fileSize->setName("fileSize");
    321327
    322328    iBuilder->SetInsertPoint(BasicBlock::Create(mod->getContext(), "entry", main,0));
     
    336342
    337343    if (segmentPipelineParallel){
    338         generateSegmentParallelPipeline(iBuilder, {&s2pk, &u8u16k, &delK, &p2sk, &stdoutK});
     344        generateSegmentParallelPipeline(iBuilder, {&mmapK, &s2pk, &u8u16k, &delK, &p2sk, &stdoutK});
    339345    } else {
    340         generatePipelineLoop(iBuilder, {&s2pk, &u8u16k, &delK, &p2sk, &stdoutK});
     346        generatePipelineLoop(iBuilder, {&mmapK, &s2pk, &u8u16k, &delK, &p2sk, &stdoutK});
    341347    }
    342348
Note: See TracChangeset for help on using the changeset viewer.