Ignore:
Timestamp:
Dec 21, 2016, 3:53:58 PM (3 years ago)
Author:
nmedfort
Message:

Bug fixes for Carry Manager and issues reported by Fahad

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

Legend:

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

    r5217 r5233  
    304304 ** ------------------------------------------------------------------------------------------------------------- */
    305305struct OrderingVerifier {
    306     OrderingVerifier() : mParent(nullptr) {}
     306    OrderingVerifier() : mParent(nullptr), mSet() {}
    307307    OrderingVerifier(const OrderingVerifier & parent) : mParent(&parent) {}
    308308    bool count(const PabloAST * expr) const {
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r5228 r5233  
    1818namespace pablo {
    1919
    20 inline static unsigned nearest_pow2(const unsigned v) {
     20inline static unsigned nearest_pow2(const uint32_t v) {
    2121    assert(v > 0 && v < (UINT32_MAX / 2));
    2222    return (v < 2) ? 1 : (1 << (32 - __builtin_clz(v - 1)));
     
    107107    if (LLVM_UNLIKELY(mCarryInfo->variableLength)) {
    108108        // Check whether we need to resize the carry state
    109         PHINode * index = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2);
     109        PHINode * index = iBuilder->CreatePHI(iBuilder->getInt32Ty(), 2);
    110110        mLoopIndicies.push_back(index);
    111         index->addIncoming(iBuilder->getSize(0), entryBlock);
     111        index->addIncoming(iBuilder->getInt32(0), entryBlock);
    112112        Value * capacityPtr = iBuilder->CreateGEP(mCurrentFrame, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    113113        Value * capacity = iBuilder->CreateLoad(capacityPtr, false, "carryCapacity");
     
    122122
    123123        Type * const carryStateType = arrayPtr->getType()->getPointerElementType()->getPointerElementType();
    124         Value * newCapacity = iBuilder->CreateMul(iBuilder->CreateAdd(index, iBuilder->getSize(1)), iBuilder->getSize(2));
     124        Value * newCapacity = iBuilder->CreateMul(iBuilder->CreateAdd(index, iBuilder->getInt32(1)), iBuilder->getInt32(2));
    125125        Value * newArrayPtr = iBuilder->CreateAlignedMalloc(carryStateType, newCapacity, iBuilder->getCacheAlignment());
    126126        iBuilder->CreateMemCpy(newArrayPtr, arrayPtr, capacity, iBuilder->getCacheAlignment());
     
    151151        assert (mLoopIndicies.size() > 0);
    152152        PHINode * index = mLoopIndicies.back();
    153         index->addIncoming(iBuilder->CreateAdd(index, iBuilder->getSize(1)), exitBlock);
     153        index->addIncoming(iBuilder->CreateAdd(index, iBuilder->getInt32(1)), exitBlock);
    154154        mLoopIndicies.pop_back();
    155155    }
     
    183183        ConstantInt * zero = iBuilder->getInt32(0);
    184184        std::vector<Value *> indicies;
    185         // enter the (potentially nested) struct and extract the summary element (0)
     185        // enter the (potentially nested) struct and extract the summary element (always element 0)
    186186        unsigned count = 2;
    187187        if (LLVM_UNLIKELY(mCarryInfo->hasBorrowedSummary())) {
     
    301301 ** ------------------------------------------------------------------------------------------------------------- */
    302302Value * CarryManager::addCarryInCarryOut(const Statement * operation, Value * const e1, Value * const e2) {
     303    assert (dyn_cast_or_null<ScanThru>(operation) || dyn_cast_or_null<MatchStar>(operation));
    303304    Value * const carryIn = getNextCarryIn();
    304305    Value * carryOut, * result;
     
    404405    }
    405406    assert (carryInPtr->getType()->getPointerElementType() == mCarryPackType);
    406     return iBuilder->CreateBlockAlignedLoad(carryInPtr);
     407    Value * const carryIn = iBuilder->CreateBlockAlignedLoad(carryInPtr);
     408    if (mLoopDepth > 0) {
     409        iBuilder->CreateBlockAlignedStore(Constant::getNullValue(mCarryPackType), carryInPtr);
     410    }
     411    return carryIn;
    407412}
    408413
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/booleanreassociationpass.cpp

    r5202 r5233  
    424424        mBlock = block;
    425425        transformAST(C, G);
    426     } catch (std::runtime_error err) {
     426    } catch (std::exception &) {
    427427        printGraph(G, "E");
    428         throw err;
    429     } catch (std::exception err) {
    430         printGraph(G, "E");
    431         throw err;
     428        throw;
    432429    }
    433430}
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5230 r5233  
    126126}
    127127
     128void PabloKernel::initializeKernelState(Value * self) {
     129    iBuilder->CreateStore(Constant::getNullValue(mKernelStateType), self);
     130}
     131
    128132PabloKernel::PabloKernel(IDISA::IDISA_Builder * builder, const std::string & kernelName)
    129133: KernelBuilder(builder, kernelName, {}, {}, {}, {}, {Binding{builder->getBitBlockType(), "EOFbit"}, Binding{builder->getBitBlockType(), "EOFmask"}})
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.h

    r5230 r5233  
    112112    void generateDoBlockMethod() override;
    113113   
     114    void initializeKernelState(Value * self) override;
     115
    114116    // The default method for Pablo final block processing sets the
    115117    // EOFmark bit and then calls the standard DoBlock function.
Note: See TracChangeset for help on using the changeset viewer.