Ignore:
Timestamp:
Oct 25, 2017, 4:57:58 PM (2 years ago)
Author:
nmedfort
Message:

First stage of MultiBlockKernel? and pipeline restructuring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r5705 r5706  
    621621    assert (mHasLongAdvance);
    622622    assert (shiftAmount >= LONG_ADVANCE_BREAKPOINT);
     623    assert (value);
    623624
    624625    const auto blockWidth = iBuilder->getBitBlockWidth();
     
    631632    if (mIfDepth > 0) {
    632633        if (shiftAmount > blockWidth) {
     634
     635            // TODO: once CEILING(shiftAmount / 256) > 2, consider using a half-adder/subtractor strategy?
    633636
    634637            Value * carry = iBuilder->CreateZExt(iBuilder->bitblock_any(value), streamTy);
     
    673676                    }
    674677                    stream = iBuilder->CreateAnd(stream, ConstantVector::get(ArrayRef<Constant *>(mask, n)));
    675 
    676678                    addToCarryOutSummary(iBuilder, stream);
    677679                    iBuilder->CreateBlockAlignedStore(stream, ptr);
    678                     RecursivelyDeleteTriviallyDeadInstructions(carry);
    679680                    break;
    680681                }
     
    736737            Value * const carryInPtr2 = iBuilder->CreateGEP(mCurrentFrame, indices);
    737738            Value * const carryIn2 = iBuilder->CreateBlockAlignedLoad(carryInPtr2);
    738 
     739            assert (carryOutPtr->getType()->getPointerElementType() == value->getType());
    739740            iBuilder->CreateBlockAlignedStore(value, carryOutPtr);
    740741
     
    859860 * @brief hasIterationSpecificAssignment
    860861 ** ------------------------------------------------------------------------------------------------------------- */
    861 bool CarryManager::hasIterationSpecificAssignment(const PabloBlock * const scope) {
    862 #if 0
    863     return dyn_cast_or_null<While>(scope->getBranch()) != nullptr;
    864 #else
    865     if (const While * const br = dyn_cast_or_null<While>(scope->getBranch())) {
    866         for (const Var * var : br->getEscaped()) {
    867             for (const PabloAST * user : var->users()) {
    868                 if (const Extract * e = dyn_cast<Extract>(user)) {
    869                     if (LLVM_UNLIKELY(e->getIndex() == var)) {
    870                         // If we assign this Var a value and read the value as the index parameter
    871                         // of a nested Extract statement, then we cannot collapse the carries.
    872                         const PabloBlock * parent = e->getParent();
    873                         for (;;) {
    874                             if (parent == scope) {
    875                                 return true;
    876                             }
    877                             parent = parent->getPredecessor();
    878                             if (parent == nullptr) {
    879                                 break;
    880                             }
    881                         }
    882                     }
    883                 }
    884             }
    885         }
     862bool isNonRegularLanguage(const PabloBlock * const scope) {
     863    if (const Branch * br = scope->getBranch()) {
     864        return !br->isRegular();
    886865    }
    887866    return false;
    888 #endif
    889867}
    890868
     
    923901
    924902    const unsigned carryScopeIndex = mCarryScopes++;
    925     const bool nonCarryCollapsingMode = hasIterationSpecificAssignment(scope);
     903    const bool nonCarryCollapsingMode = isNonRegularLanguage(scope);
    926904    Type * const carryPackType = (loopDepth == 0) ? carryTy : ArrayType::get(carryTy, 2);
    927905    std::vector<Type *> state;
Note: See TracChangeset for help on using the changeset viewer.