Ignore:
Timestamp:
Feb 10, 2017, 3:55:14 PM (2 years ago)
Author:
nmedfort
Message:

Removed BlockNo? + updated LookAhead? to use getInputStream.

File:
1 edited

Legend:

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

    r5310 r5311  
    1313#include <llvm/Support/raw_ostream.h>
    1414
    15 static const auto BLOCK_NO_SCALAR = "blockNo";
    16 
    1715static const auto DO_BLOCK_SUFFIX = "_DoBlock";
    1816
     
    108106        addScalar(binding.type, binding.name);
    109107    }
    110     addScalar(iBuilder->getSizeTy(), BLOCK_NO_SCALAR);
    111108    addScalar(iBuilder->getSizeTy(), LOGICAL_SEGMENT_NO_SCALAR);
    112109    addScalar(iBuilder->getInt1Ty(), TERMINATION_SIGNAL);
     
    245242}
    246243
    247 Value * KernelBuilder::getBlockNo() const {
    248     return getScalarField(mSelf, BLOCK_NO_SCALAR);
    249 }
    250 
    251 void KernelBuilder::setBlockNo(Value * value) const {
    252     setScalarField(mSelf, BLOCK_NO_SCALAR, value);
    253 }
    254 
    255244inline Value * KernelBuilder::computeBlockIndex(const std::vector<Binding> & bindings, const std::string & name, Value * itemCount) const {
    256245    for (const Binding & b : bindings) {
     
    279268}
    280269
     270llvm::Value * KernelBuilder::getInputStream(Value * blockAdjustment, const std::string & name, llvm::Value * streamIndex) const {
     271    Value * blockIndex = computeBlockIndex(mStreamSetInputs, name, getProcessedItemCount(name));
     272    blockIndex = iBuilder->CreateAdd(blockIndex, blockAdjustment);
     273    const StreamSetBuffer * const buf = getInputStreamSetBuffer(name);
     274    return buf->getStream(getStreamSetBufferPtr(name), streamIndex, blockIndex);
     275}
     276
    281277Value * KernelBuilder::getOutputStream(const std::string & name, Value * streamIndex) const {
    282278    Value * const blockIndex = computeBlockIndex(mStreamSetOutputs, name, getProducedItemCount(name));
     
    326322Value * KernelBuilder::createGetAccumulatorCall(Value * self, const std::string & accumName) const {
    327323    return iBuilder->CreateCall(getAccumulatorFunction(accumName), {self});
    328 }
    329 
    330 Value * KernelBuilder::getInputStreamSetPtr(const std::string & name, Value * blockNo) const {
    331     return getInputStreamSetBuffer(name)->getStreamSetPtr(getStreamSetBufferPtr(name), blockNo);
    332324}
    333325
     
    385377
    386378    ConstantInt * stride = iBuilder->getSize(iBuilder->getStride());
    387     ConstantInt * strideBlocks = iBuilder->getSize(iBuilder->getStride() / iBuilder->getBitBlockWidth());
    388379
    389380    Value * availablePos = producerPos[0];
     
    405396
    406397    iBuilder->SetInsertPoint(strideLoopBody);
    407     Value * blockNo = getBlockNo();
    408398
    409399    CreateDoBlockMethodCall();
    410400
    411     setBlockNo(iBuilder->CreateAdd(blockNo, strideBlocks));
    412 
    413401    // Update counts
    414 
    415402    for (unsigned i = 0; i < mStreamSetInputs.size(); i++) {
    416403        Value * processed = getProcessedItemCount(mStreamSetInputs[i].name);
Note: See TracChangeset for help on using the changeset viewer.