Ignore:
Timestamp:
Mar 23, 2015, 8:37:57 PM (4 years ago)
Author:
cameron
Message:

Restructure to use a single process_block_state data area

File:
1 edited

Legend:

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

    r4537 r4538  
    6666, mBasisBitsInputPtr(nullptr)
    6767, mCarryQueueIdx(0)
    68 , mCarryQueuePtr(nullptr)
     68, mCarryDataPtr(nullptr)
    6969, mNestingDepth(0)
    7070, mCarryQueueSize(0)
    7171, mAdvanceQueueIdx(0)
    72 , mAdvanceQueuePtr(nullptr)
    7372, mAdvanceQueueSize(0)
    7473, mZeroInitializer(ConstantAggregateZero::get(mBitBlockType))
     
    126125    mBasisBitsAddr = args++;
    127126    mBasisBitsAddr->setName("basis_bits");
    128     mCarryQueuePtr = args++;
    129     mCarryQueuePtr->setName("carry_q");
    130     mAdvanceQueuePtr = args++;
    131     mAdvanceQueuePtr->setName("advance_q");
     127    mCarryDataPtr = args++;
     128    mCarryDataPtr->setName("carry_data");
    132129    mOutputAddrPtr = args++;
    133130    mOutputAddrPtr->setName("output");
     
    174171    mExecutionEngine->finalizeObject();
    175172
    176     //Return the required size of the carry queue and a pointer to the process_block function.
    177     return CompiledPabloFunction(mCarryQueueSize, mAdvanceQueueSize, mFunction, mExecutionEngine);
     173    //Return the required size of the carry data area to the process_block function.
     174    return CompiledPabloFunction((mCarryQueueSize + mAdvanceQueueSize) * sizeof(BitBlock), mFunction, mExecutionEngine);
    178175}
    179176
     
    197194    functionTypeArgs.push_back(mBasisBitsInputPtr);
    198195
    199     //The carry q array.
     196    //The carry data array.
    200197    //A pointer to the BitBlock vector.
    201     functionTypeArgs.push_back(PointerType::get(mBitBlockType, 0));
    202     // Advance q array
    203198    functionTypeArgs.push_back(PointerType::get(mBitBlockType, 0));
    204199
     
    316311
    317312    //Starts on process_block
    318     SmallVector<AttributeSet, 5> Attrs;
     313    SmallVector<AttributeSet, 4> Attrs;
    319314    AttributeSet PAS;
    320315    {
     
    335330        B.addAttribute(Attribute::NoCapture);
    336331        PAS = AttributeSet::get(mMod->getContext(), 3U, B);
    337     }
    338     Attrs.push_back(PAS);
    339     {
    340         AttrBuilder B;
    341         B.addAttribute(Attribute::NoCapture);
    342         PAS = AttributeSet::get(mMod->getContext(), 4U, B);
    343332    }
    344333    Attrs.push_back(PAS);
     
    935924    if (mNestingDepth == 0) {
    936925        IRBuilder<> b(mBasicBlock);
    937         mCarryQueueVector[index] = b.CreateAlignedLoad(b.CreateGEP(mCarryQueuePtr, b.getInt64(index)), BLOCK_SIZE/8, false);
     926        mCarryQueueVector[index] = b.CreateAlignedLoad(b.CreateGEP(mCarryDataPtr, b.getInt64(index)), BLOCK_SIZE/8, false);
    938927    }
    939928    return mCarryQueueVector[index];
     
    945934    if (mNestingDepth == 0) {
    946935        IRBuilder<> b(mBasicBlock);
    947         b.CreateAlignedStore(carryOut, b.CreateGEP(mCarryQueuePtr, b.getInt64(index)), BLOCK_SIZE/8, false);
     936        b.CreateAlignedStore(carryOut, b.CreateGEP(mCarryDataPtr, b.getInt64(index)), BLOCK_SIZE/8, false);
    948937    }
    949938    mCarryQueueSummaryIdx[index] = -1;
     
    955944    if (mNestingDepth == 0) {
    956945        IRBuilder<> b(mBasicBlock);
    957         mAdvanceQueueVector[index] = b.CreateAlignedLoad(b.CreateGEP(mAdvanceQueuePtr, b.getInt64(index)), BLOCK_SIZE/8, false);
     946        mAdvanceQueueVector[index] = b.CreateAlignedLoad(b.CreateGEP(mCarryDataPtr, b.getInt64(mCarryQueueSize + index)), BLOCK_SIZE/8, false);
    958947    }
    959948    return mAdvanceQueueVector[index];
     
    965954    if (mNestingDepth == 0) {
    966955        IRBuilder<> b(mBasicBlock);
    967         b.CreateAlignedStore(advanceOut, b.CreateGEP(mAdvanceQueuePtr, b.getInt64(index)), BLOCK_SIZE/8, false);
     956        b.CreateAlignedStore(advanceOut, b.CreateGEP(mCarryDataPtr, b.getInt64(mCarryQueueSize + index)), BLOCK_SIZE/8, false);
    968957    }
    969958    mAdvanceQueueSummaryIdx[index] = -1;
     
    10711060}
    10721061
    1073 CompiledPabloFunction::CompiledPabloFunction(unsigned carryQSize, unsigned advanceQSize, Function * function, ExecutionEngine * executionEngine)
    1074 : CarryQueueSize(carryQSize)
    1075 , AdvanceQueueSize(advanceQSize)
     1062CompiledPabloFunction::CompiledPabloFunction(size_t carryDataSize, Function * function, ExecutionEngine * executionEngine)
     1063: CarryDataSize(carryDataSize)
    10761064, FunctionPointer(executionEngine->getPointerToFunction(function))
    10771065, mFunction(function)
Note: See TracChangeset for help on using the changeset viewer.