Changeset 4672 for icGREP/icgrep-devel


Ignore:
Timestamp:
Jul 15, 2015, 7:00:50 AM (4 years ago)
Author:
cameron
Message:

Clean-ups

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

Legend:

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

    r4670 r4672  
    110110   
    111111   
    112     totalCarryDataBits = nestedframePosition;
     112    scopeCarryDataBits = nestedframePosition;
    113113   
    114     if ((ifDepth > 0) && (totalCarryDataBits > BLOCK_SIZE)) {
     114    if ((ifDepth > 0) && (scopeCarryDataBits > BLOCK_SIZE)) {
    115115        // Need extra space for the summary variable, always the last
    116116        // entry within an if block.
    117         AlignUpwards(totalCarryDataBits, BLOCK_SIZE);
    118         summary.frameOffsetinBits = totalCarryDataBits;
     117        AlignUpwards(scopeCarryDataBits, BLOCK_SIZE);
     118        summary.frameOffsetinBits = scopeCarryDataBits;
    119119        summary.allocatedBits = BLOCK_SIZE;
    120         totalCarryDataBits += BLOCK_SIZE;
     120        scopeCarryDataBits += BLOCK_SIZE;
    121121    }
    122122    else {
    123123        summary.frameOffsetinBits = 0;
    124         summary.allocatedBits = totalCarryDataBits;
     124        summary.allocatedBits = scopeCarryDataBits;
    125125    }
    126     return totalCarryDataBits;
     126    return scopeCarryDataBits;
    127127}
    128128
  • icGREP/icgrep-devel/icgrep/pablo/carry_data.h

    r4670 r4672  
    4141                           nested({0, 0, 0}),
    4242                           summary({0, 0}),
    43                            totalCarryDataBits(0)
     43                           scopeCarryDataBits(0)
    4444                           {}
    4545       
     
    9090    unsigned getLocalCarryDataSize () { return nested.frameOffsetinBits / BLOCK_SIZE; }
    9191
    92     unsigned getTotalCarryDataSize () { return totalCarryDataBits / BLOCK_SIZE; }
     92    unsigned getScopeCarryDataSize () { return scopeCarryDataBits / BLOCK_SIZE; }
    9393   
    94     bool blockHasCarries() const { return totalCarryDataBits > 0;}
     94    bool blockHasCarries() const { return scopeCarryDataBits > 0;}
    9595   
    96     bool explicitSummaryRequired() const { return totalCarryDataBits > BLOCK_SIZE;}
     96    bool explicitSummaryRequired() const { return scopeCarryDataBits > BLOCK_SIZE;}
    9797   
    9898    bool summaryNeededInParentBlock() const {return (ifDepth > 0) && blockHasCarries();}
     
    113113    struct {unsigned frameOffsetinBits; unsigned allocatedBits;} summary;
    114114
    115     unsigned totalCarryDataBits;
     115    unsigned scopeCarryDataBits;
    116116   
    117117};
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4670 r4672  
    2525    mCarryDataPtr = carryPtr;
    2626    mCarryInfo = &(pb->carryData);
    27     mTotalCarryDataSize = mCarryInfo->enumerate(*pb)/BLOCK_SIZE + 1;   // One extra element for the block no.
    28     mBlockNoPtr = mBuilder->CreateBitCast(mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(mTotalCarryDataSize - 1)), Type::getInt64PtrTy(mBuilder->getContext()));
     27    unsigned totalCarryDataBits = mCarryInfo->enumerate(*pb);
     28    mTotalCarryDataBitBlocks = (totalCarryDataBits + BLOCK_SIZE - 1)/BLOCK_SIZE + 1; // One extra element for the block no.
     29    mBlockNoPtr = mBuilder->CreateBitCast(mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(mTotalCarryDataBitBlocks - 1)), Type::getInt64PtrTy(mBuilder->getContext()));
    2930    mBlockNo = mBuilder->CreateLoad(mBlockNoPtr);
    30     mCarryInVector.resize(mTotalCarryDataSize);
    31     mCarryInPhis.resize(mTotalCarryDataSize);
    32     mCarryOutAccumPhis.resize(mTotalCarryDataSize);
    33     mCarryOutVector.resize(mTotalCarryDataSize);
    34    
    35     return mTotalCarryDataSize;
    36 }
    37 
     31    mCarryInVector.resize(mTotalCarryDataBitBlocks);
     32    mCarryInPhis.resize(mTotalCarryDataBitBlocks);
     33    mCarryOutAccumPhis.resize(mTotalCarryDataBitBlocks);
     34    mCarryOutVector.resize(mTotalCarryDataBitBlocks);
     35   
     36    return mTotalCarryDataBitBlocks;
     37}
     38   
    3839void CarryManager::generateBlockNoIncrement() {
    3940    mBuilder->CreateStore(mBuilder->CreateAdd(mBlockNo, mBuilder->getInt64(1)), mBlockNoPtr);
     
    204205    Value * packPtr = mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(summary_idx));
    205206    Value * summary_expr = mBuilder->CreateAlignedLoad(packPtr, BLOCK_SIZE/8);
    206     // If the totalCarryDataSize is 1, then the carry summary is also the pack expr.
     207    // If the scopeCarryDataSize is 1, then the carry summary is also the pack expr.
    207208    mCarryInVector[summary_idx] = summary_expr;
    208209    return summary_expr;
     
    225226    const unsigned carrySummaryIndex = mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex();
    226227   
    227     if (mCarryInfo->getTotalCarryDataSize() == 1) {
    228         // If totalCarryDataSize == 1, then we have one pack which serves as
     228    if (mCarryInfo->getScopeCarryDataSize() == 1) {
     229        // If scopeCarryDataSize == 1, then we have one pack which serves as
    229230        // the summary.   It should already be stored.   
    230231        return;
     
    276277    const unsigned baseCarryDataIdx = cd.getBlockCarryDataIndex();
    277278    const unsigned localCarryDataSize = cd.getLocalCarryDataSize();
    278     const unsigned totalCarryDataSize = cd.getTotalCarryDataSize();
    279     if (totalCarryDataSize == 0) return;
    280     if ((cd.getIfDepth() > 0) && (totalCarryDataSize == 1)) return;
     279    const unsigned scopeCarryDataSize = cd.getScopeCarryDataSize();
     280    if (scopeCarryDataSize == 0) return;
     281    if ((cd.getIfDepth() > 0) && (scopeCarryDataSize == 1)) return;
    281282    if (cd.getWhileDepth() > 0) return;
    282283    for (auto i = baseCarryDataIdx; i < baseCarryDataIdx + localCarryDataSize; ++i) {
     
    291292    const unsigned baseCarryDataIdx = cd.getBlockCarryDataIndex();
    292293    const unsigned localCarryDataSize = cd.getLocalCarryDataSize();
    293     const unsigned totalCarryDataSize = cd.getTotalCarryDataSize();
     294    const unsigned scopeCarryDataSize = cd.getScopeCarryDataSize();
    294295    const unsigned carrySummaryIndex = cd.summaryCarryDataIndex();
    295     if (totalCarryDataSize == 0) return;
     296    if (scopeCarryDataSize == 0) return;
    296297    if (cd.getWhileDepth() > 0) return;
    297298    for (auto i = baseCarryDataIdx; i < baseCarryDataIdx + localCarryDataSize; ++i) {
     
    299300        mBuilder->CreateAlignedStore(mCarryOutVector[i], storePtr, BLOCK_SIZE/8, false);
    300301    }
    301     if (totalCarryDataSize > 1) {
     302    if (scopeCarryDataSize > 1) {
    302303        Value * summaryPtr = mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(carrySummaryIndex));
    303304        mBuilder->CreateAlignedStore(mCarryOutVector[carrySummaryIndex], summaryPtr, BLOCK_SIZE/8, false);
     
    309310
    310311void CarryManager::ensureCarriesLoadedRecursive() {
    311     const unsigned totalCarryDataSize = mCarryInfo->getTotalCarryDataSize();
     312    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
    312313    if (mCarryInfo->getWhileDepth() == 1) {
    313         for (auto i = mCurrentScopeIndex; i < mCurrentScopeIndex + totalCarryDataSize; ++i) {
     314        for (auto i = mCurrentScopeIndex; i < mCurrentScopeIndex + scopeCarryDataSize; ++i) {
    314315            mCarryInVector[i] = mBuilder->CreateAlignedLoad(mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(i)), BLOCK_SIZE/8, false);
    315316        }
     
    319320
    320321void CarryManager::initializeCarryDataPhisAtWhileEntry(BasicBlock * whileEntryBlock) {
    321     const unsigned totalCarryDataSize = mCarryInfo->getTotalCarryDataSize();
    322     for (unsigned index = mCurrentScopeIndex; index < mCurrentScopeIndex + totalCarryDataSize; ++index) {
     322    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
     323    for (unsigned index = mCurrentScopeIndex; index < mCurrentScopeIndex + scopeCarryDataSize; ++index) {
    323324#ifdef SET_WHILE_CARRY_IN_TO_ZERO_AFTER_FIRST_ITERATION
    324325        PHINode * phi_in = mBuilder->CreatePHI(mBitBlockType, 2);
     
    334335
    335336void CarryManager::extendCarryDataPhisAtWhileBodyFinalBlock(BasicBlock * whileBodyFinalBlock) {
    336     const unsigned totalCarryDataSize = mCarryInfo->getTotalCarryDataSize();
    337     for (unsigned index = mCurrentScopeIndex; index < mCurrentScopeIndex + totalCarryDataSize; ++index) {
     337    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
     338    for (unsigned index = mCurrentScopeIndex; index < mCurrentScopeIndex + scopeCarryDataSize; ++index) {
    338339#ifdef SET_WHILE_CARRY_IN_TO_ZERO_AFTER_FIRST_ITERATION
    339340        mCarryInPhis[index]->addIncoming(mZeroInitializer, whileBodyFinalBlock);
     
    347348
    348349void CarryManager::ensureCarriesStoredRecursive() {
    349     const unsigned totalCarryDataSize = mCarryInfo->getTotalCarryDataSize();
     350    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
    350351    if (mCarryInfo->getWhileDepth() == 1) {
    351         for (auto i = mCurrentScopeIndex; i < mCurrentScopeIndex + totalCarryDataSize; ++i) {
     352        for (auto i = mCurrentScopeIndex; i < mCurrentScopeIndex + scopeCarryDataSize; ++i) {
    352353            Value * storePtr = mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(i));
    353354            mBuilder->CreateAlignedStore(mCarryOutVector[i], storePtr, BLOCK_SIZE/8, false);
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r4670 r4672  
    4545    , mBlockNoPtr(nullptr)
    4646    , mBlockNo(nullptr)
    47     , mTotalCarryDataSize(0)
     47    , mTotalCarryDataBitBlocks(0)
    4848    {
    4949
     
    112112    Value * mBlockNoPtr;
    113113    Value * mBlockNo;
    114     unsigned mTotalCarryDataSize;
     114    unsigned mTotalCarryDataBitBlocks;
    115115
    116116    std::vector<Value *> mCarryInVector;
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4657 r4672  
    196196    SymbolGenerator &                                   mSymbolGenerator;
    197197    PabloBlock *                                        mParent;
    198     unsigned                                            mCarryVectorIndex;
    199     unsigned                                            mPackedCarryDataIndex;
    200     unsigned                                            mLocalCarryCount;
    201     unsigned                                            mLocalAdvanceCount;
    202     unsigned                                            mTotalCarryVectorSize;
    203     unsigned                                            mTotalCarryDataSize;
    204198};
    205199
Note: See TracChangeset for help on using the changeset viewer.