Ignore:
Timestamp:
Mar 13, 2017, 3:02:13 PM (2 years ago)
Author:
nmedfort
Message:

Work on non-carry collapsing mode.

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

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

    r5356 r5361  
    264264
    265265void KernelBuilder::setProducedItemCount(Value * instance, const std::string & name, Value * value) const {
    266     //iBuilder->CallPrintInt(mKernelName + "_" + name + "_produced_count", value);
    267266    setScalarField(instance, name + PRODUCED_ITEM_COUNT_SUFFIX, value);
    268267}
     
    576575    generateDoBlockMethod(); // must be implemented by the BlockOrientedKernelBuilder subtype
    577576
     577    unsigned priorIdx = 0;
    578578    for (unsigned i = 0; i < mStreamSetOutputs.size(); i++) {
    579         unsigned priorIdx = 0;
    580579        Value * log2BlockSize = iBuilder->getSize(std::log2(iBuilder->getBitBlockWidth()));
    581580        if (auto cb = dyn_cast<SwizzledCopybackBuffer>(mStreamSetOutputBuffers[i]))  {
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5355 r5361  
    264264    iBuilder->CreateStore(iBuilder->getSize(mInitialCapacity), capacityPtr);
    265265    Type * const bufferType = getType()->getStructElementType(1)->getPointerElementType();
    266     ConstantInt * const size = iBuilder->getSize(mBufferBlocks * mInitialCapacity);
    267     Value * const ptr = iBuilder->CreateAlignedMalloc(bufferType, size, iBuilder->getCacheAlignment());
    268     const auto alignment = bufferType->getPrimitiveSizeInBits() / 8;
    269     Constant * bufferWidth = ConstantExpr::getIntegerCast(ConstantExpr::getSizeOf(bufferType), size->getType(), false);
    270     iBuilder->CreateMemZero(ptr, iBuilder->CreateMul(size, bufferWidth), alignment);
     266    Constant * const bufferWidth = ConstantExpr::getIntegerCast(ConstantExpr::getSizeOf(bufferType), iBuilder->getSizeTy(), false);
     267    Constant * const size = ConstantExpr::getMul(iBuilder->getSize(mBufferBlocks * mInitialCapacity), bufferWidth);
     268    Value * const ptr = iBuilder->CreateAlignedMalloc(size, iBuilder->getCacheAlignment());
     269    iBuilder->CreateMemZero(ptr, size, bufferType->getPrimitiveSizeInBits() / 8);
    271270    Value * const streamSetPtr = iBuilder->CreateGEP(mStreamSetBufferPtr, {iBuilder->getInt32(0), iBuilder->getInt32(1)});
    272     iBuilder->CreateStore(ptr, streamSetPtr);
     271    iBuilder->CreateStore(iBuilder->CreatePointerCast(ptr, bufferType->getPointerTo()), streamSetPtr);
    273272}
    274273
     
    303302    Type * elementType = getType()->getStructElementType(1)->getPointerElementType();
    304303    Constant * const vectorWidth = ConstantExpr::getIntegerCast(ConstantExpr::getSizeOf(elementType), capacity->getType(), false);
    305     Value * newCapacity = iBuilder->CreateMul(iBuilder->CreateAdd(streamIndex, iBuilder->getSize(1)), iBuilder->getSize(2), "newCapacity");
     304
     305    Value * newCapacity = iBuilder->CreateAdd(streamIndex, iBuilder->getSize(1));
     306    newCapacity = iBuilder->CreateCeilLog2(newCapacity);
     307    newCapacity = iBuilder->CreateShl(iBuilder->getSize(1), newCapacity, "newCapacity");
    306308
    307309    std::string tmp;
     
    330332
    331333        Value * size = iBuilder->CreateMul(newCapacity, iBuilder->getSize(mBufferBlocks));
    332         Value * newStreamSet = iBuilder->CreateAlignedMalloc(elementType, size, iBuilder->getCacheAlignment());
     334        Value * newStreamSet = iBuilder->CreatePointerCast(iBuilder->CreateAlignedMalloc(iBuilder->CreateMul(size, vectorWidth), iBuilder->getCacheAlignment()), elementType->getPointerTo());
    333335        Value * const diffCapacity = iBuilder->CreateMul(iBuilder->CreateSub(newCapacity, capacity), vectorWidth);
    334336
Note: See TracChangeset for help on using the changeset viewer.