Ignore:
Timestamp:
Jul 17, 2016, 11:12:34 AM (3 years ago)
Author:
cameron
Message:

Simplify kernel DoBlock? interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5086 r5096  
    151151    std::vector<Value *> basePtrs;
    152152    std::vector<Value *> blockMasks;
    153     for (auto sSet : mStreamSetInputs) {
     153/*    for (auto sSet : mStreamSetInputs) {
    154154        basePtrs.push_back(getScalarField(self, sSet.ssName + basePtrSuffix));
    155155        blockMasks.push_back(getScalarField(self, sSet.ssName + blkMaskSuffix));
     
    158158        basePtrs.push_back(getScalarField(self, sSet.ssName + basePtrSuffix));
    159159        blockMasks.push_back(getScalarField(self, sSet.ssName + blkMaskSuffix));
    160     }
     160    }*/
    161161   
    162162    iBuilder->CreateBr(blockLoop);
     
    169169    std::vector<Value *> doBlockArgs = {self};
    170170
    171     for (unsigned i = 0; i < basePtrs.size(); i++) {
    172         doBlockArgs.push_back(iBuilder->CreateGEP(basePtrs[i], iBuilder->CreateAnd(blockNo, blockMasks[i])));
    173     }
     171    for (auto sSet : mStreamSetInputs) {
     172        doBlockArgs.push_back(getCircularBufferBlockPointer(self, sSet.ssName, blockNo));
     173    }
     174    for (auto sSet : mStreamSetOutputs) {
     175        doBlockArgs.push_back(getCircularBufferBlockPointer(self, sSet.ssName, blockNo));
     176    }
     177//    for (unsigned i = 0; i < basePtrs.size(); i++) {
     178//        doBlockArgs.push_back(iBuilder->CreateGEP(basePtrs[i], iBuilder->CreateAnd(blockNo, blockMasks[i])));
     179//    }
    174180    Value * rslt = iBuilder->CreateCall(doBlockFunction, doBlockArgs);
    175181    setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, iBuilder->getInt64(1)));
     
    218224}
    219225
    220 
    221 
     226Value * KernelBuilder::getCircularBufferBlockPointer(Value * self, std::string streamName, Value * blockNo) {
     227    Value * bufferBase = getScalarField(self, streamName + basePtrSuffix);
     228    Value * blockMask = getScalarField(self, streamName + blkMaskSuffix);
     229    return iBuilder->CreateGEP(bufferBase, iBuilder->CreateAnd(blockNo, blockMask));
     230}
     231
     232
     233
Note: See TracChangeset for help on using the changeset viewer.