Ignore:
Timestamp:
Jan 17, 2017, 1:29:52 PM (3 years ago)
Author:
cameron
Message:

Eliminate unneeded doBlock functions

File:
1 edited

Legend:

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

    r5264 r5265  
    1010
    1111namespace kernel {
    12 
    13 // The doBlock method is deprecated.   But in case it is used, just call doSegment with
    14 // 1 as the number of blocks to do.
    15 void StdOutKernel::generateDoBlockMethod() const {
    16     auto savePoint = iBuilder->saveIP();
    17     Module * m = iBuilder->getModule();
    18     Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
    19     Function * doSegmentFunction = m->getFunction(mKernelName + doSegment_suffix);
    20     iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
    21     Value * self = getParameter(doBlockFunction, "self");
    22     iBuilder->CreateCall(doSegmentFunction, {self, iBuilder->getSize(1)});
    23     iBuilder->CreateRetVoid();
    24     iBuilder->restoreIP(savePoint);
    25 }
    2612           
    2713// Rather than using doBlock logic to write one block at a time, this custom
     
    3925    Function::arg_iterator args = doSegmentFunction->arg_begin();
    4026    Value * self = &*(args++);
    41     Value * doFinal = &*(args++);
     27    /* unused Value * doFinal = &*(args++);*/ args++;
    4228    Value * producerPos = &*(args++);
    4329    ////iBuilder->CallPrintInt("blocksToDo", blocksToDo);
     
    6349}
    6450
    65 void StdOutKernel::generateFinalBlockMethod() const {
    66     auto savePoint = iBuilder->saveIP();
    67     Module * m = iBuilder->getModule();
    68     Function * finalBlockFunction = m->getFunction(mKernelName + finalBlock_suffix);
    69     Type * i8PtrTy = iBuilder->getInt8PtrTy();   
    70     iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "fb_flush", finalBlockFunction, 0));
    71     Constant * blockItems = iBuilder->getSize(iBuilder->getBitBlockWidth());
    72     Constant * itemBytes = iBuilder->getSize(mCodeUnitWidth/8);
    73     Value * self = getParameter(finalBlockFunction, "self");
    74     Value * streamStructPtr = getStreamSetStructPtr(self, "codeUnitBuffer");
    75     LoadInst * producerPos = iBuilder->CreateAtomicLoadAcquire(mStreamSetInputBuffers[0]->getProducerPosPtr(streamStructPtr));
    76     Value * processed = getProcessedItemCount(self, "codeUnitBuffer");
    77     Value * itemsAvail = iBuilder->CreateSub(producerPos, processed);
    78     Value * blockNo = getScalarField(self, blockNoScalar);
    79     Value * byteOffset = iBuilder->CreateMul(iBuilder->CreateURem(processed, blockItems), itemBytes);
    80     Value * bytePtr = getStreamView(i8PtrTy, self, "codeUnitBuffer", blockNo, byteOffset);
    81     iBuilder->CreateWriteCall(iBuilder->getInt32(1), bytePtr, iBuilder->CreateMul(itemsAvail, itemBytes));
    82     setProcessedItemCount(self, "codeUnitBuffer", producerPos);
    83     mStreamSetInputBuffers[0]->setConsumerPos(streamStructPtr, producerPos);
    84     setTerminationSignal(self);
    85     iBuilder->CreateRetVoid();
    86     iBuilder->restoreIP(savePoint);
    8751}
    88 }
Note: See TracChangeset for help on using the changeset viewer.