Ignore:
Timestamp:
May 11, 2017, 7:58:32 PM (2 years ago)
Author:
cameron
Message:

Bug fixes for MultiBlockKernel?, StdOutKernel?

File:
1 edited

Legend:

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

    r5440 r5442  
    9393Value * StreamSetBuffer::getRawItemPointer(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * streamIndex, Value * absolutePosition) const {
    9494    Value * ptr = getBaseAddress(iBuilder, self);
     95
    9596    if (!isa<ConstantInt>(streamIndex) || !cast<ConstantInt>(streamIndex)->isZero()) {
    9697        ptr = iBuilder->CreateGEP(ptr, {iBuilder->getInt32(0), streamIndex});
    9798    }
     99    Value * bufferItemPosition = modByBufferBlocks(iBuilder, absolutePosition);
    98100    IntegerType * const ty = cast<IntegerType>(mBaseType->getArrayElementType()->getVectorElementType());
    99101    ptr = iBuilder->CreatePointerCast(ptr, ty->getPointerTo());
     
    101103        const auto bw = ty->getBitWidth();
    102104        if (LLVM_LIKELY((bw & (bw - 1)) == 0)) { // is power of 2
    103             absolutePosition = iBuilder->CreateUDiv(absolutePosition, ConstantInt::get(absolutePosition->getType(), 8 / bw));
     105            bufferItemPosition = iBuilder->CreateUDiv(bufferItemPosition, ConstantInt::get(absolutePosition->getType(), 8 / bw));
    104106        } else {
    105             absolutePosition = iBuilder->CreateMul(absolutePosition, ConstantInt::get(absolutePosition->getType(), bw));
    106             absolutePosition = iBuilder->CreateUDiv(absolutePosition, ConstantInt::get(absolutePosition->getType(), 8));
     107            bufferItemPosition = iBuilder->CreateMul(bufferItemPosition, ConstantInt::get(absolutePosition->getType(), bw));
     108            bufferItemPosition = iBuilder->CreateUDiv(bufferItemPosition, ConstantInt::get(absolutePosition->getType(), 8));
    107109        }
    108110    }
    109     return iBuilder->CreateGEP(ptr, absolutePosition);
     111    Value * rawPointer = iBuilder->CreateGEP(ptr, bufferItemPosition);
     112    return rawPointer;
    110113}
    111114
Note: See TracChangeset for help on using the changeset viewer.