Ignore:
Timestamp:
Dec 15, 2017, 12:44:01 PM (17 months ago)
Author:
nmedfort
Message:

Initial check-in of LookAhead? support; modified LineBreakKernel? to compute CR+LF using LookAhead?(1) + misc. fixes.

File:
1 edited

Legend:

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

    r5757 r5782  
    8282            itemCount = CreateExactUDiv(itemCount, ConstantInt::get(itemCount->getType(), r.denominator()));
    8383        }
     84    } else if (LLVM_UNLIKELY(rate.isPopCount())) {
     85        Port port; unsigned index;
     86        std::tie(port, index) = mKernel->getStreamPort(rate.getReference());
     87
     88
     89
     90
    8491    } else {
    8592        itemCount = getScalarField(name + suffix);
     
    133140Value * KernelBuilder::getLinearlyWritableItems(const std::string & name, Value * fromPosition, bool reverse) {
    134141    const StreamSetBuffer * const buf = mKernel->getOutputStreamSetBuffer(name);
    135     return buf->getLinearlyWritableItems(this, getStreamHandle(name), fromPosition, reverse);
     142    return buf->getLinearlyWritableItems(this, getStreamHandle(name), fromPosition, getConsumedItemCount(name), reverse);
    136143}
    137144
     
    195202    // (w.r.t the stream copy) would be n*m. By taking this into account we can optimize and simplify the copy code.
    196203    const auto fieldWidth = getFieldWidth(itemWidth * itemAlignment, blockWidth);
    197     assert ("overflow error" && is_power_2(fieldWidth) && (itemWidth <= fieldWidth) && (fieldWidth <= blockWidth));
     204
     205//    CallPrintInt(mKernel->getName() + "_" + name + "_target", target);
     206//    CallPrintInt(mKernel->getName() + "_" + name + "_targetOffset", targetOffset);
     207//    CallPrintInt(mKernel->getName() + "_" + name + "_source", source);
     208//    CallPrintInt(mKernel->getName() + "_" + name + "_sourceOffset", sourceOffset);
     209//    CallPrintInt(mKernel->getName() + "_" + name + "_itemsToCopy", itemsToCopy);
    198210
    199211    if (LLVM_LIKELY(itemWidth < fieldWidth)) {
     
    223235
    224236       So if we're copying the entire stream set block or our stream set has one element, we can use memcpy.
     237
     238       One compilication here is when the BlockSize of a stream is not equal to the BitBlockWidth.
     239
    225240
    226241    */
     
    421436
    422437Value * KernelBuilder::loadInputStreamPack(const std::string & name, Value * streamIndex, Value * packIndex) {
    423 
    424 
    425 
    426438    return CreateBlockAlignedLoad(getInputStreamPackPtr(name, streamIndex, packIndex));
    427439}
     
    432444}
    433445
    434 Value * KernelBuilder::getAdjustedInputStreamBlockPtr(Value * blockAdjustment, const std::string & name, Value * streamIndex) {
     446Value * KernelBuilder::getInputStreamBlockPtr(const std::string & name, Value * const streamIndex, Value * const blockOffset) {
    435447    Value * const addr = mKernel->getStreamSetInputAddress(name);
    436448    if (addr) {
    437         return CreateGEP(addr, {blockAdjustment, streamIndex});
     449        return CreateGEP(addr, {blockOffset, streamIndex});
    438450    } else {
    439451        const StreamSetBuffer * const buf = mKernel->getInputStreamSetBuffer(name);
    440452        Value * blockIndex = CreateLShr(getProcessedItemCount(name), std::log2(getBitBlockWidth()));
    441         blockIndex = CreateAdd(blockIndex, blockAdjustment);
     453        blockIndex = CreateAdd(blockIndex, blockOffset);
    442454        return buf->getStreamBlockPtr(this, getStreamHandle(name), getBaseAddress(name), streamIndex, blockIndex, true);
    443455    }
Note: See TracChangeset for help on using the changeset viewer.