Ignore:
Timestamp:
Jul 23, 2016, 1:04:44 PM (3 years ago)
Author:
cameron
Message:

Use dynamic size_t determination

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

Legend:

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

    r5096 r5106  
    4444    mSelf = selfPtr;
    4545   
    46     Value * cdArrayPtr = iBuilder->CreateGEP(mSelf, {iBuilder->getInt64(0), mKernelBuilder->getScalarIndex("carries")});
     46    Value * cdArrayPtr = iBuilder->CreateGEP(mSelf, {ConstantInt::get(iBuilder->getSizeTy(), 0), mKernelBuilder->getScalarIndex("carries")});
    4747#ifndef NDEBUG
    48     iBuilder->CallPrintInt("cdArrayPtr", iBuilder->CreatePtrToInt(cdArrayPtr, iBuilder->getInt64Ty()));
     48    iBuilder->CallPrintInt("cdArrayPtr", iBuilder->CreatePtrToInt(cdArrayPtr, iBuilder->getSizeTy()));
    4949#endif
    5050    mCarryPackBasePtr = iBuilder->CreateBitCast(cdArrayPtr, PointerType::get(mCarryPackType, 0));
     
    179179 ** ------------------------------------------------------------------------------------------------------------- */
    180180Value * CarryManager::longAdvanceCarryInCarryOut(const unsigned index, const unsigned shiftAmount, Value * const value) {
    181     Value * advBaseIndex = iBuilder->getInt64(index);
     181    Value * advBaseIndex = ConstantInt::get(iBuilder->getSizeTy(), index);
    182182    if (shiftAmount <= mBitBlockWidth) {
    183183        // special case using a single buffer entry and the carry_out value.
     
    197197    const unsigned advanceEntries = mCarryInfo->longAdvanceEntries(shiftAmount);
    198198    const unsigned bufsize = mCarryInfo->longAdvanceBufferSize(shiftAmount);
    199     Value * indexMask = iBuilder->getInt64(bufsize - 1);  // A mask to implement circular buffer indexing
     199    Value * indexMask = ConstantInt::get(iBuilder->getSizeTy(), bufsize - 1);  // A mask to implement circular buffer indexing
    200200    Value * blockIndex = mKernelBuilder->getScalarField(mSelf, blockNoScalar);
    201     Value * loadIndex0 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, iBuilder->getInt64(advanceEntries)), indexMask), advBaseIndex);
     201    Value * loadIndex0 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, ConstantInt::get(iBuilder->getSizeTy(), advanceEntries)), indexMask), advBaseIndex);
    202202    Value * storeIndex = iBuilder->CreateAdd(iBuilder->CreateAnd(blockIndex, indexMask), advBaseIndex);
    203203    Value * carry_block0 = iBuilder->CreateBlockAlignedLoad(iBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex0));
     
    209209    }
    210210    // Otherwise we need to combine data from the two oldest blocks.
    211     Value * loadIndex1 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, iBuilder->getInt64(advanceEntries-1)), indexMask), advBaseIndex);
     211    Value * loadIndex1 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, ConstantInt::get(iBuilder->getSizeTy(), advanceEntries-1)), indexMask), advBaseIndex);
    212212    Value * carry_block1 = iBuilder->CreateBlockAlignedLoad(iBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex1));
    213213    Value* block0_shr = iBuilder->CreateLShr(iBuilder->CreateBitCast(carry_block0, iBuilder->getIntNTy(mBitBlockWidth)), mBitBlockWidth - block_shift);
     
    477477    assert (packIndex < mCarryInPack.size());
    478478    if (mCarryInPack[packIndex] == nullptr) {
    479         Value * const packPtr = iBuilder->CreateGEP(mCarryPackBasePtr, iBuilder->getInt64(packIndex));
     479        Value * const packPtr = iBuilder->CreateGEP(mCarryPackBasePtr, ConstantInt::get(iBuilder->getSizeTy(), packIndex));
    480480        assert (packIndex < mCarryPackPtr.size());
    481481        mCarryPackPtr[packIndex] = packPtr;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5102 r5106  
    5353std::vector<ScalarBinding> PabloKernel::accumBindings(std::vector<std::string> accum_names) {
    5454    std::vector<ScalarBinding> vec;
    55     Type * accum_t = iBuilder->getInt64Ty();
     55    Type * accum_t = iBuilder->getSizeTy();
    5656    for (auto a : accum_names) {
    5757        vec.push_back(ScalarBinding{accum_t, a});
Note: See TracChangeset for help on using the changeset viewer.