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

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

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.