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

File:
1 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   
Note: See TracChangeset for help on using the changeset viewer.