Changeset 5255


Ignore:
Timestamp:
Jan 12, 2017, 9:09:58 AM (10 months ago)
Author:
cameron
Message:

Fixes for mmap kernel for blocksPerSegment, codeUnitWidth, new doSegment interface

Location:
icGREP/icgrep-devel/icgrep
Files:
7 edited

Legend:

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

    r5254 r5255  
    8282    LinearCopybackBuffer Base64out(iBuilder, iBuilder->getStreamSetTy(1, 8), segmentSize * bufferSegments * 16 + 2);
    8383   
    84     MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     84    MMapSourceKernel mmapK(iBuilder, segmentSize * bufferSegments * 16);
    8585    mmapK.generateKernel({}, {&ByteStream});
    8686    mmapK.setInitialArguments({fileSize});
  • icGREP/icgrep-devel/icgrep/editd/editd.cpp

    r5254 r5255  
    308308    ExternalFileBuffer CCResults(iBuilder, iBuilder->getStreamSetTy(4));
    309309
    310     MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     310    MMapSourceKernel mmapK(iBuilder);
    311311    std::unique_ptr<Module> mmapM = mmapK.createKernelModule({}, {&ByteStream});
    312312    mmapK.setInitialArguments({fileSize});
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5254 r5255  
    292292    ExternalFileBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
    293293   
    294     kernel::MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     294    kernel::MMapSourceKernel mmapK(iBuilder, segmentSize * bufferSegments);
    295295    mmapK.generateKernel({}, {&ByteStream});
    296296    mmapK.setInitialArguments({fileSize});
  • icGREP/icgrep-devel/icgrep/kernels/mmap_kernel.cpp

    r5248 r5255  
    1616    BasicBlock * setTermination = BasicBlock::Create(iBuilder->getContext(), "setTermination", doSegmentFunction, 0);
    1717    BasicBlock * mmapSourceExit = BasicBlock::Create(iBuilder->getContext(), "mmapSourceExit", doSegmentFunction, 0);
    18     Constant * blockItems = iBuilder->getSize(iBuilder->getBitBlockWidth());
     18    Constant * segmentItems = iBuilder->getSize(mSegmentBlocks * iBuilder->getBitBlockWidth());
     19   
    1920   
    2021    Function::arg_iterator args = doSegmentFunction->arg_begin();
    21     Value * self = &*(args++);
    22     Value * blocksToDo = &*(args);
     22    Value * self = &*(args);
    2323   
    2424    Value * fileItems = getScalarField(self, "fileSize");
     25    if (mCodeUnitWidth > 8) {
     26        fileItems = iBuilder->CreateUDiv(fileItems, iBuilder->getSize(mCodeUnitWidth/8));
     27    }
    2528    Value * produced = getProducedItemCount(self, "sourceBuffer");
    2629    Value * itemsAvail = iBuilder->CreateSub(fileItems, produced);
    27     Value * itemsMax = iBuilder->CreateMul(blocksToDo, blockItems);
    28     Value * lessThanFullSegment = iBuilder->CreateICmpULT(itemsAvail, itemsMax);
    29     Value * itemsToDo = iBuilder->CreateSelect(lessThanFullSegment, itemsAvail, itemsMax);
     30    Value * lessThanFullSegment = iBuilder->CreateICmpULT(itemsAvail, segmentItems);
     31    Value * itemsToDo = iBuilder->CreateSelect(lessThanFullSegment, itemsAvail, segmentItems);
    3032    setProducedItemCount(self, "sourceBuffer", iBuilder->CreateAdd(produced, itemsToDo));
    3133   
  • icGREP/icgrep-devel/icgrep/kernels/mmap_kernel.h

    r5248 r5255  
    2020class MMapSourceKernel : public KernelBuilder {
    2121public:
    22     MMapSourceKernel(IDISA::IDISA_Builder * iBuilder, unsigned segmentSize, unsigned codeUnitWidth = 8) :
     22    MMapSourceKernel(IDISA::IDISA_Builder * iBuilder, unsigned blocksPerSegment = 1, unsigned codeUnitWidth = 8) :
    2323    KernelBuilder(iBuilder, "mmap_source",
    2424                  {}, {Binding{iBuilder->getStreamSetTy(1, codeUnitWidth), "sourceBuffer"}},
    2525                  {Binding{iBuilder->getSizeTy(), "fileSize"}}, {}, {}),
    26     mSegmentSize(segmentSize),
     26    mSegmentBlocks(blocksPerSegment),
    2727    mCodeUnitWidth(codeUnitWidth) {}
    2828   
    2929private:
    30     unsigned mSegmentSize;
     30    unsigned mSegmentBlocks;
    3131    unsigned mCodeUnitWidth;
    3232 
  • icGREP/icgrep-devel/icgrep/u8u16.cpp

    r5254 r5255  
    296296    LinearCopybackBuffer U16out(iBuilder, iBuilder->getStreamSetTy(16, 16), segmentSize * bufferSegments + 2);
    297297
    298     MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     298    MMapSourceKernel mmapK(iBuilder, segmentSize * bufferSegments);
    299299    mmapK.generateKernel({}, {&ByteStream});
    300300    mmapK.setInitialArguments({fileSize});
  • icGREP/icgrep-devel/icgrep/wc.cpp

    r5249 r5255  
    158158    SingleBlockBuffer BasisBits(iBuilder, iBuilder->getStreamSetTy(8, 1));
    159159   
    160     MMapSourceKernel mmapK(iBuilder, iBuilder->getStride());
     160    MMapSourceKernel mmapK(iBuilder);
    161161    std::unique_ptr<Module> mmapM = mmapK.createKernelModule({}, {&ByteStream});
    162162    mmapK.setInitialArguments({fileSize});
Note: See TracChangeset for help on using the changeset viewer.