Ignore:
Timestamp:
Jun 10, 2017, 2:11:39 PM (23 months ago)
Author:
cameron
Message:

setCapacity/getCapacity/getLinearlyAvailableItems for SourceBuffer?

File:
1 edited

Legend:

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

    r5497 r5501  
    520520            Value * priorOffset = idb->CreateAnd(priorProduced[priorIdx], idb->getSize(idb->getBitBlockWidth() - 1));
    521521            Value * instance = idb->getStreamSetBufferPtr(mStreamSetOutputs[i].name);
    522             Value * accessibleBlocks = cb->getLinearlyAccessibleBlocks(idb.get(), priorBlock);
     522            Value * accessibleBlocks = idb->getLinearlyAccessibleBlocks(mStreamSetOutputs[i].name, priorBlock);
    523523            Value * accessible = idb->CreateSub(idb->CreateShl(accessibleBlocks, log2BlockSize), priorOffset);
    524524            Value * wraparound = idb->CreateICmpULT(accessible, newlyProduced);
     
    536536            Value * instance = idb->getStreamSetBufferPtr(mStreamSetOutputs[i].name);
    537537            Value * newlyProduced = idb->CreateSub(idb->getProducedItemCount(mStreamSetOutputs[i].name), priorProduced[priorIdx]);
    538             Value * accessible = cb->getLinearlyAccessibleItems(idb.get(), priorProduced[priorIdx]);
     538            Value * accessible = idb->getLinearlyAccessibleItems(mStreamSetOutputs[i].name, priorProduced[priorIdx]);
    539539            Value * wraparound = idb->CreateICmpULT(accessible, newlyProduced);
    540540            idb->CreateCondBr(wraparound, copyBack, done);
     
    867867            Value * maxReferenceItems = nullptr;
    868868            if ((rate.isFixedRatio()) && (rate.getRatioNumerator() == rate.getRatioDenominator()) && (rate.referenceStreamSet() == "")) {
    869                 maxReferenceItems = kb->CreateMul(mStreamSetInputBuffers[i]->getLinearlyAccessibleBlocks(kb.get(), blkNo), blockSize);
     869                maxReferenceItems = kb->CreateMul(kb->getLinearlyAccessibleBlocks(mStreamSetInputs[i].name, blkNo), blockSize);
    870870            } else {
    871                 Value * linearlyAvailItems = mStreamSetInputBuffers[i]->getLinearlyAccessibleItems(kb.get(), p);
     871                Value * linearlyAvailItems = kb->getLinearlyAccessibleItems(mStreamSetInputs[i].name, p);
    872872                maxReferenceItems = rate.CreateMaxReferenceItemsCalculation(kb.get(), linearlyAvailItems);
    873873            }
     
    890890            Value * maxReferenceItems = nullptr;
    891891            if ((rate.isFixedRatio()) && (rate.getRatioNumerator() == rate.getRatioDenominator())) {
    892                 maxReferenceItems = kb->CreateMul(mStreamSetOutputBuffers[0]->getLinearlyWritableBlocks(kb.get(), blkNo), blockSize);
     892                maxReferenceItems = kb->CreateMul(kb->getLinearlyWritableBlocks(mStreamSetOutputs[i].name, blkNo), blockSize);
    893893            } else {
    894                 Value * writableItems = mStreamSetOutputBuffers[0]->getLinearlyWritableItems(kb.get(), p);
     894                Value * writableItems = kb->getLinearlyWritableItems(mStreamSetOutputs[i].name, p);
    895895                maxReferenceItems = rate.CreateMaxReferenceItemsCalculation(kb.get(), writableItems);
    896896            }
     
    915915        if (!isDerived[i]) {
    916916            Value * avail = kb->CreateSub(mAvailableItemCount[i], processedItemCount[i]);
    917             Value * linearlyAvail = mStreamSetInputBuffers[i]->getLinearlyAccessibleItems(kb.get(), processedItemCount[i]);
     917            Value * linearlyAvail = kb->getLinearlyAccessibleItems(mStreamSetInputs[i].name, processedItemCount[i]);
    918918            doMultiBlockArgs.push_back(kb->CreateSelect(kb->CreateICmpULT(avail, linearlyAvail), avail, linearlyAvail));
    919919        }
     
    942942            Value * priorOffset = kb->CreateAnd(producedItemCount[i], kb->getSize(kb->getBitBlockWidth() - 1));
    943943            Value * instance = kb->getStreamSetBufferPtr(mStreamSetOutputs[i].name);
    944             Value * accessibleBlocks = cb->getLinearlyAccessibleBlocks(kb.get(), priorBlock);
     944            Value * accessibleBlocks = kb->getLinearlyAccessibleBlocks(mStreamSetOutputs[i].name, priorBlock);
    945945            Value * accessible = kb->CreateSub(kb->CreateShl(accessibleBlocks, log2BlockSize), priorOffset);
    946946            Value * wraparound = kb->CreateICmpULT(accessible, newlyProduced);
     
    958958            Value * instance = kb->getStreamSetBufferPtr(mStreamSetOutputs[i].name);
    959959            Value * newlyProduced = kb->CreateSub(kb->getProducedItemCount(mStreamSetOutputs[i].name), producedItemCount[i]);
    960             Value * accessible = cb->getLinearlyAccessibleItems(kb.get(), producedItemCount[i]);
     960            Value * accessible = kb->getLinearlyAccessibleItems(mStreamSetOutputs[i].name, producedItemCount[i]);
    961961            Value * wraparound = kb->CreateICmpULT(accessible, newlyProduced);
    962962            kb->CreateCondBr(wraparound, copyBack, done);
     
    10501050            // Round up to exact multiple of block size.
    10511051            neededItems = kb->CreateAnd(kb->CreateAdd(neededItems, kb->getSize(bitBlockWidth - 1)), blockBaseMask);
    1052             Value * availFromBase = mStreamSetInputBuffers[i]->getLinearlyAccessibleItems(kb.get(), blockBasePos);
     1052            Value * availFromBase = kb->getLinearlyAccessibleItems(mStreamSetInputs[i].name, blockBasePos);
    10531053            Value * copyItems1 = kb->CreateSelect(kb->CreateICmpULT(neededItems, availFromBase), neededItems, availFromBase);
    10541054            Value * copyItems2 = kb->CreateSub(neededItems, copyItems1);
     
    10911091        // Round up to exact multiple of block size.
    10921092        copyItems = kb->CreateAnd(kb->CreateAdd(copyItems, kb->getSize(bitBlockWidth - 1)), blockBaseMask);
    1093         Value * writableFromBase = mStreamSetOutputBuffers[i]->getLinearlyWritableItems(kb.get(), blockBasePos[i]); // must be a whole number of blocks.
     1093        Value * writableFromBase = kb->getLinearlyWritableItems(mStreamSetOutputs[i].name, blockBasePos[i]); // must be a whole number of blocks.
    10941094        Value * copyItems1 = kb->CreateSelect(kb->CreateICmpULT(copyItems, writableFromBase), copyItems, writableFromBase);
    10951095        Value * copyBlocks1 = kb->CreateUDiv(copyItems1, blockSize);
Note: See TracChangeset for help on using the changeset viewer.