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

First stage of MultiBlockKernel? and pipeline restructuring

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
12 edited

Legend:

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

    r5371 r5706  
    88#include <pablo/printer_pablos.h>
    99#include <boost/container/flat_set.hpp>
     10#include <llvm/Support/ErrorHandling.h>
    1011#include <llvm/Support/raw_ostream.h>
    1112
  • icGREP/icgrep-devel/icgrep/pablo/branch.cpp

    r5371 r5706  
    113113, mEscapedCapacity(0)
    114114, mEscaped(nullptr)
     115, mRegular(true)
    115116{
    116117
  • icGREP/icgrep-devel/icgrep/pablo/branch.h

    r5454 r5706  
    3838        return mBody;
    3939    }
     40    inline bool isRegular() const {
     41        return mRegular;
     42    }
     43    inline void setRegular(const bool value) {
     44        mRegular = value;
     45    }
    4046    PabloBlock * setBody(PabloBlock * const body);
    4147    EscapedVars getEscaped() const;
     
    4955    unsigned        mEscapedCapacity;
    5056    PabloAST **     mEscaped;
     57    bool            mRegular;
    5158};
    5259
  • 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;
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r5705 r5706  
    9191    static unsigned getScopeCount(const PabloBlock * const scope, unsigned index = 0);
    9292
    93     static bool hasIterationSpecificAssignment(const PabloBlock * const scope);
    94 
    9593    llvm::StructType * analyse(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, const PabloBlock * const scope, const unsigned ifDepth = 0, const unsigned whileDepth = 0, const bool isNestedWithinNonCarryCollapsingLoop = false);
    9694
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/distributivepass.cpp

    r5620 r5706  
    3434
    3535#include <boost/graph/strong_components.hpp>
     36#include <llvm/Support/ErrorHandling.h>
    3637#include <llvm/Support/raw_ostream.h>
    3738#include <pablo/printer_pablos.h>
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_simplifier.cpp

    r5646 r5706  
    1818#endif
    1919#include <boost/container/flat_set.hpp>
     20#include <llvm/IR/Type.h>
    2021
    2122using namespace boost;
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/schedulingprepass.cpp

    r5512 r5706  
    88#ifndef NDEBUG
    99#include <pablo/analysis/pabloverifier.hpp>
     10#else
     11#include <llvm/Support/ErrorHandling.h>
    1012#endif
    1113#include <boost/container/flat_set.hpp>
     
    372374bool SchedulingPrePass::optimize(PabloKernel * const kernel) {
    373375    #ifdef NDEBUG
    374     report_fatal_error("DistributivePass is unsupported");
     376    llvm::report_fatal_error("DistributivePass is unsupported");
    375377    #else
    376378    SchedulingPrePassContainer S;
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r5647 r5706  
    1515#include <pablo/branch.h>
    1616#include <pablo/printer_pablos.h>
     17#include <llvm/Support/ErrorHandling.h>
    1718#include <llvm/Support/raw_os_ostream.h>
    1819
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5705 r5706  
    461461                if (array->isReadOnly()) {
    462462                    value = iBuilder->getInputStreamBlockPtr(array->getName(), index);
     463                    value = iBuilder->CreateLoad(value);
    463464                } else if (array->isReadNone()) {
    464465                    value = iBuilder->getOutputStreamBlockPtr(array->getName(), index);
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5630 r5706  
    256256    prepareStreamSetNameMap();
    257257    for (const Binding & ss : mStreamSetInputs) {
    258         Var * param = new (mAllocator) Var(makeName(ss.name), ss.type, mAllocator, Var::KernelInputParameter);
     258        Var * param = new (mAllocator) Var(makeName(ss.getName()), ss.getType(), mAllocator, Var::KernelInputParameter);
    259259        param->addUser(this);
    260260        mInputs.push_back(param);
     
    262262    }
    263263    for (const Binding & ss : mStreamSetOutputs) {
    264         Var * result = new (mAllocator) Var(makeName(ss.name), ss.type, mAllocator, Var::KernelOutputParameter);
     264        Var * result = new (mAllocator) Var(makeName(ss.getName()), ss.getType(), mAllocator, Var::KernelOutputParameter);
    265265        result->addUser(this);
    266266        mOutputs.push_back(result);
     
    268268    }
    269269    for (const Binding & ss : mScalarOutputs) {
    270         Var * result = new (mAllocator) Var(makeName(ss.name), ss.type, mAllocator, Var::KernelOutputParameter);
     270        Var * result = new (mAllocator) Var(makeName(ss.getName()), ss.getType(), mAllocator, Var::KernelOutputParameter);
    271271        result->addUser(this);
    272272        mOutputs.push_back(result);
    273273        mVariables.push_back(result);
    274         mScalarOutputNameMap.emplace(ss.name, result);
     274        mScalarOutputNameMap.emplace(ss.getName(), result);
    275275        result->setScalar();
    276276    }
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.h

    r5630 r5706  
    1515
    1616namespace llvm { class Type; }
     17namespace llvm { class VectorType; }
     18
    1719namespace pablo { class Integer; }
    1820namespace pablo { class Ones; }
     
    133135    PabloKernel(const std::unique_ptr<kernel::KernelBuilder> & builder,
    134136                std::string && kernelName,
    135                 std::vector<Binding> stream_inputs = {},
    136                 std::vector<Binding> stream_outputs = {},
    137                 std::vector<Binding> scalar_parameters = {},
    138                 std::vector<Binding> scalar_outputs = {});
     137                std::vector<kernel::Binding> stream_inputs = {},
     138                std::vector<kernel::Binding> stream_outputs = {},
     139                std::vector<kernel::Binding> scalar_parameters = {},
     140                std::vector<kernel::Binding> scalar_outputs = {});
    139141
    140142    virtual void generatePabloMethod() = 0;
Note: See TracChangeset for help on using the changeset viewer.