Changeset 4827


Ignore:
Timestamp:
Oct 9, 2015, 10:24:51 AM (2 years ago)
Author:
cameron
Message:

Parameterize carry_manager to inherit BitBlockWidth? from idisa builder

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.cpp

    r4750 r4827  
    1818
    1919VectorType * IDISA_Builder::fwVectorType(unsigned fw) {
    20     int fieldCount = mBitBlockSize/fw;
     20    int fieldCount = mBitBlockWidth/fw;
    2121    return VectorType::get(mLLVMBuilder->getIntNTy(fw), fieldCount);
    2222}
     
    107107
    108108Value * IDISA_Builder::esimd_mergeh(unsigned fw, Value * a, Value * b) {
    109     unsigned field_count = mBitBlockSize/fw;
     109    unsigned field_count = mBitBlockWidth/fw;
    110110    Value * aVec = fwCast(fw, a);
    111111    Value * bVec = fwCast(fw, b);
     
    119119
    120120Value * IDISA_Builder::esimd_mergel(unsigned fw, Value * a, Value * b) {
    121     unsigned field_count = mBitBlockSize/fw;
     121    unsigned field_count = mBitBlockWidth/fw;
    122122    Value * aVec = fwCast(fw, a);
    123123    Value * bVec = fwCast(fw, b);
     
    131131
    132132Value * IDISA_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {
    133     unsigned field_count = 2 * mBitBlockSize/fw;
     133    unsigned field_count = 2 * mBitBlockWidth/fw;
    134134    Value * aVec = fwCast(fw/2, a);
    135135    Value * bVec = fwCast(fw/2, b);
     
    142142
    143143Value * IDISA_Builder::hsimd_packl(unsigned fw, Value * a, Value * b) {
    144     unsigned field_count = 2 * mBitBlockSize/fw;
     144    unsigned field_count = 2 * mBitBlockWidth/fw;
    145145    Value * aVec = fwCast(fw/2, a);
    146146    Value * bVec = fwCast(fw/2, b);
     
    154154Value * IDISA_Builder::hsimd_signmask(unsigned fw, Value * a) {
    155155    Value * mask = mLLVMBuilder->CreateICmpSLT(fwCast(fw, a), ConstantAggregateZero::get(fwVectorType(fw)));
    156     return mLLVMBuilder->CreateBitCast(mask, mLLVMBuilder->getIntNTy(mBitBlockSize/fw));
     156    return mLLVMBuilder->CreateBitCast(mask, mLLVMBuilder->getIntNTy(mBitBlockWidth/fw));
    157157}
    158158
     
    163163
    164164Value * IDISA_Builder::mvmd_dslli(unsigned fw, Value * a, Value * b, unsigned shift) {
    165     unsigned field_count = mBitBlockSize/fw;
     165    unsigned field_count = mBitBlockWidth/fw;
    166166    Value * aVec = fwCast(fw, a);
    167167    Value * bVec = fwCast(fw, b);
     
    174174
    175175Value * IDISA_Builder::bitblock_any(Value * a) {
    176     Type * iBitBlock = mLLVMBuilder->getIntNTy(mBitBlockSize);
     176    Type * iBitBlock = mLLVMBuilder->getIntNTy(mBitBlockWidth);
    177177    return mLLVMBuilder->CreateICmpNE(mLLVMBuilder->CreateBitCast(a, iBitBlock),  ConstantInt::get(iBitBlock, 0));
    178178}
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r4821 r4827  
    2424    , mLLVMBuilder(nullptr)
    2525    , mBitBlockType(bitBlockType)
    26     , mBitBlockSize(bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth())
     26    , mBitBlockWidth(bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth())
    2727    , mZeroInitializer(Constant::getNullValue(bitBlockType))
    2828    , mOneInitializer(Constant::getAllOnesValue(bitBlockType)) {
     
    3636   
    3737    Type * getBitBlockType() { return mBitBlockType;}
    38     int getBitBlockSize() { return mBitBlockSize;}
     38    int getBitBlockWidth() { return mBitBlockWidth;}
    3939    Constant * allZeroes() {return mZeroInitializer;}
    4040    Constant * allOnes() {return mOneInitializer;}
     
    7878    IRBuilder <> * mLLVMBuilder;
    7979    Type * mBitBlockType;
    80     unsigned mBitBlockSize;
     80    unsigned mBitBlockWidth;
    8181    Constant * mZeroInitializer;
    8282    Constant * mOneInitializer;
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4826 r4827  
    5555    llvm::IRBuilderBase::InsertPoint ip = mBuilder->saveIP();
    5656    mBuilder->SetInsertPoint(BasicBlock::Create(m->getContext(), "entry1", f,0));
    57     mBuilder->CreateMemSet(mCarryBitBlockPtr, mBuilder->getInt8(0), mTotalCarryDataBitBlocks * BLOCK_SIZE/8, 4);
     57    mBuilder->CreateMemSet(mCarryBitBlockPtr, mBuilder->getInt8(0), mTotalCarryDataBitBlocks * mBITBLOCK_WIDTH/8, 4);
    5858    ReturnInst::Create(m->getContext(), mBuilder->GetInsertBlock());
    5959    mBuilder->restoreIP(ip);
     
    7474    }
    7575    else {
    76         mPACK_SIZE = BLOCK_SIZE;
     76        mPACK_SIZE = mBITBLOCK_WIDTH;
    7777        mITEMS_PER_PACK = 1;
    7878        mCarryPackType = mBitBlockType;
     
    8888
    8989    if (Strategy == SequentialFullyPackedStrategy) {
    90         mTotalCarryDataBitBlocks = (totalCarryDataSize + BLOCK_SIZE - 1)/BLOCK_SIZE;       
     90        mTotalCarryDataBitBlocks = (totalCarryDataSize + mBITBLOCK_WIDTH - 1)/mBITBLOCK_WIDTH;       
    9191    }
    9292    else {
     
    9696    ArrayType* cdArrayTy = ArrayType::get(mBitBlockType, mTotalCarryDataBitBlocks);
    9797    GlobalVariable* cdArray = new GlobalVariable(*m, cdArrayTy, /*isConstant=*/false, GlobalValue::CommonLinkage, /*Initializer=*/0, "process_block_carry_data");
    98     cdArray->setAlignment(BLOCK_SIZE/8);
     98    cdArray->setAlignment(mBITBLOCK_WIDTH/8);
    9999    ConstantAggregateZero* cdInitData = ConstantAggregateZero::get(cdArrayTy);
    100100    cdArray->setInitializer(cdInitData);
     
    109109        ArrayType* pcArrayTy = ArrayType::get(mBuilder->getIntNTy(64), mPabloCountCount);
    110110        GlobalVariable* pcArray = new GlobalVariable(*m, pcArrayTy, /*isConstant=*/false, GlobalValue::CommonLinkage, 0, "popcount_data");
    111         cdArray->setAlignment(BLOCK_SIZE/8);
     111        cdArray->setAlignment(mBITBLOCK_WIDTH/8);
    112112        ConstantAggregateZero* pcInitData = ConstantAggregateZero::get(pcArrayTy);
    113113        pcArray->setInitializer(pcInitData);
     
    319319    uint64_t mask = ((((uint64_t) 1) << carryBitCount) - 1)  << packOffset;
    320320    //std::cerr << "extractAndSaveCarryOutBits: packIndex =" << packIndex << ", packOffset = " << packOffset << ", mask = " << mask << std::endl;
    321     Value * field = iBuilder->mvmd_extract(mPACK_SIZE, bitblock, BLOCK_SIZE/mPACK_SIZE - 1);
     321    Value * field = iBuilder->mvmd_extract(mPACK_SIZE, bitblock, mBITBLOCK_WIDTH/mPACK_SIZE - 1);
    322322    //Value * field = maskSelectBitRange(field, PACK_SIZE - carryBitCount, carryBitCount);
    323323    if (rshift != 0) {
     
    336336
    337337Value * CarryManager::pack2bitblock(Value * pack) {
    338     return mBuilder->CreateBitCast(mBuilder->CreateZExt(pack, mBuilder->getIntNTy(BLOCK_SIZE)), mBitBlockType);
     338    return mBuilder->CreateBitCast(mBuilder->CreateZExt(pack, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), mBitBlockType);
    339339}
    340340   
     
    359359    }
    360360    else {
    361         Value * carry_bit = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_out_strm, mBuilder->getIntNTy(BLOCK_SIZE)), BLOCK_SIZE-1);
     361        Value * carry_bit = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_out_strm, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), mBITBLOCK_WIDTH-1);
    362362        mCarryOutPack[posn] = mBuilder->CreateBitCast(carry_bit, mBitBlockType);
    363363        if (mCarryInfo->getWhileDepth() == 0) {
     
    368368
    369369Value* CarryManager::genShiftLeft64(Value* e) {
    370     Value* i128_val = mBuilder->CreateBitCast(e, mBuilder->getIntNTy(BLOCK_SIZE));
     370    Value* i128_val = mBuilder->CreateBitCast(e, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
    371371    return mBuilder->CreateBitCast(mBuilder->CreateShl(i128_val, 64), mBitBlockType);
    372372}
    373373
    374374Value * CarryManager::addCarryInCarryOut(int localIndex, Value* e1, Value* e2) {
    375 #if (BLOCK_SIZE == 128)
     375#if (mBITBLOCK_WIDTH == 128)
    376376    Value * carryq_value = getCarryOpCarryIn(localIndex);
    377377    //calculate carry through logical ops
     
    387387    return sum;
    388388#else
    389     //BLOCK_SIZE == 256, there is no other implementation
     389    //mBITBLOCK_WIDTH == 256, there is no other implementation
    390390    Value * carryq_value = getCarryOpCarryIn(localIndex);
    391391    Value* carrygen = mBuilder->CreateAnd(e1, e2, "carrygen");
    392392    Value* carryprop = mBuilder->CreateOr(e1, e2, "carryprop");
    393     Value * sum = iBuilder->simd_add(BLOCK_SIZE, iBuilder->simd_add(BLOCK_SIZE, e1, e2), carryq_value);
     393    Value * sum = iBuilder->simd_add(mBITBLOCK_WIDTH, iBuilder->simd_add(mBITBLOCK_WIDTH, e1, e2), carryq_value);
    394394    Value* carry_out_strm = mBuilder->CreateOr(carrygen, mBuilder->CreateAnd(carryprop, mBuilder->CreateNot(sum)));
    395395    setCarryOpCarryOut(localIndex, carry_out_strm);
     
    415415    if (mITEMS_PER_PACK > 1) {// #ifdef PACKING
    416416        extractAndSaveCarryOutBits(strm, posn, 1);
    417         Value* carry_longint = mBuilder->CreateZExt(getCarryInBits(posn, 1), mBuilder->getIntNTy(BLOCK_SIZE));
    418         Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(BLOCK_SIZE));
     417        Value* carry_longint = mBuilder->CreateZExt(getCarryInBits(posn, 1), mBuilder->getIntNTy(mBITBLOCK_WIDTH));
     418        Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
    419419        Value* adv_longint = mBuilder->CreateOr(mBuilder->CreateShl(strm_longint, 1), carry_longint);
    420420        Value* result_value = mBuilder->CreateBitCast(adv_longint, mBitBlockType);
     
    428428    Value* result_value;
    429429   
    430 #if (BLOCK_SIZE == 128) && !defined(USE_LONG_INTEGER_SHIFT)
     430#if (mBITBLOCK_WIDTH == 128) && !defined(USE_LONG_INTEGER_SHIFT)
    431431    Value * ahead64 = iBuilder->mvmd_dslli(64, carry_in, strm, 1);
    432432    result_value = mBuilder->CreateOr(iBuilder->simd_srli(64, ahead64, 63), iBuilder->simd_slli(64, strm, 1));
    433433#else
    434     Value* advanceq_longint = mBuilder->CreateBitCast(carry_in, mBuilder->getIntNTy(BLOCK_SIZE));
    435     Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(BLOCK_SIZE));
    436     Value* adv_longint = mBuilder->CreateOr(mBuilder->CreateShl(strm_longint, 1), mBuilder->CreateLShr(advanceq_longint, BLOCK_SIZE - 1), "advance");
     434    Value* advanceq_longint = mBuilder->CreateBitCast(carry_in, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
     435    Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
     436    Value* adv_longint = mBuilder->CreateOr(mBuilder->CreateShl(strm_longint, 1), mBuilder->CreateLShr(advanceq_longint, mBITBLOCK_WIDTH - 1), "advance");
    437437    result_value = mBuilder->CreateBitCast(adv_longint, mBitBlockType);
    438438   
     
    446446        extractAndSaveCarryOutBits(strm, posn, shift_amount);
    447447        //std::cerr << "shortAdvanceCarryInCarryOut: posn = " << posn << ", shift_amount = " << shift_amount << std::endl;
    448         Value* carry_longint = mBuilder->CreateZExt(getCarryInBits(posn, shift_amount), mBuilder->getIntNTy(BLOCK_SIZE));
    449         Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(BLOCK_SIZE));
     448        Value* carry_longint = mBuilder->CreateZExt(getCarryInBits(posn, shift_amount), mBuilder->getIntNTy(mBITBLOCK_WIDTH));
     449        Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
    450450        Value* adv_longint = mBuilder->CreateOr(mBuilder->CreateShl(strm_longint, shift_amount), carry_longint);
    451451        Value* result_value = mBuilder->CreateBitCast(adv_longint, mBitBlockType);
     
    457457        storeCarryPack(posn);
    458458    }
    459     Value* advanceq_longint = mBuilder->CreateBitCast(carry_in, mBuilder->getIntNTy(BLOCK_SIZE));
    460     Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(BLOCK_SIZE));
    461     Value* adv_longint = mBuilder->CreateOr(mBuilder->CreateShl(strm_longint, shift_amount), mBuilder->CreateLShr(advanceq_longint, BLOCK_SIZE - shift_amount), "advance");
     459    Value* advanceq_longint = mBuilder->CreateBitCast(carry_in, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
     460    Value* strm_longint = mBuilder->CreateBitCast(strm, mBuilder->getIntNTy(mBITBLOCK_WIDTH));
     461    Value* adv_longint = mBuilder->CreateOr(mBuilder->CreateShl(strm_longint, shift_amount), mBuilder->CreateLShr(advanceq_longint, mBITBLOCK_WIDTH - shift_amount), "advance");
    462462    return mBuilder->CreateBitCast(adv_longint, mBitBlockType);
    463463}
     
    473473 
    474474 unsigned longAdvanceEntries(unsigned shift_amount) const {
    475  return (shift_amount + BLOCK_SIZE - 1)/BLOCK_SIZE;
     475 return (shift_amount + mBITBLOCK_WIDTH - 1)/mBITBLOCK_WIDTH;
    476476 }
    477477 
     
    485485    unsigned carryDataIndex = longAdvanceBitBlockPosition(localIndex);
    486486    Value * advBaseIndex = mBuilder->getInt64(carryDataIndex);
    487     if (shift_amount <= BLOCK_SIZE) {
     487    if (shift_amount <= mBITBLOCK_WIDTH) {
    488488        // special case using a single buffer entry and the carry_out value.
    489489        Value * advanceDataPtr = mBuilder->CreateGEP(mCarryBitBlockPtr, advBaseIndex);
    490         Value * carry_block0 = mBuilder->CreateAlignedLoad(advanceDataPtr, BLOCK_SIZE/8);
    491         mBuilder->CreateAlignedStore(carry_out, advanceDataPtr, BLOCK_SIZE/8);
     490        Value * carry_block0 = mBuilder->CreateAlignedLoad(advanceDataPtr, mBITBLOCK_WIDTH/8);
     491        mBuilder->CreateAlignedStore(carry_out, advanceDataPtr, mBITBLOCK_WIDTH/8);
    492492        /* Very special case - no combine */
    493         if (shift_amount == BLOCK_SIZE) return carry_block0;
    494         Value* block0_shr = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_block0, mBuilder->getIntNTy(BLOCK_SIZE)), BLOCK_SIZE - shift_amount);
    495         Value* block1_shl = mBuilder->CreateShl(mBuilder->CreateBitCast(carry_out, mBuilder->getIntNTy(BLOCK_SIZE)), shift_amount);
     493        if (shift_amount == mBITBLOCK_WIDTH) return carry_block0;
     494        Value* block0_shr = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_block0, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), mBITBLOCK_WIDTH - shift_amount);
     495        Value* block1_shl = mBuilder->CreateShl(mBuilder->CreateBitCast(carry_out, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), shift_amount);
    496496        return mBuilder->CreateBitCast(mBuilder->CreateOr(block1_shl, block0_shr), mBitBlockType);
    497497    }
    498498    // We need a buffer of at least two elements for storing the advance data.
    499     const unsigned block_shift = shift_amount % BLOCK_SIZE;
     499    const unsigned block_shift = shift_amount % mBITBLOCK_WIDTH;
    500500    const unsigned advanceEntries = mCarryInfo->longAdvanceEntries(shift_amount);
    501501    const unsigned bufsize = mCarryInfo->longAdvanceBufferSize(shift_amount);
     
    503503    Value * loadIndex0 = mBuilder->CreateAdd(mBuilder->CreateAnd(mBuilder->CreateSub(mBlockNo, mBuilder->getInt64(advanceEntries)), indexMask), advBaseIndex);
    504504    Value * storeIndex = mBuilder->CreateAdd(mBuilder->CreateAnd(mBlockNo, indexMask), advBaseIndex);
    505     Value * carry_block0 = mBuilder->CreateAlignedLoad(mBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex0), BLOCK_SIZE/8);
    506     // If the long advance is an exact multiple of BLOCK_SIZE, we simply return the oldest
     505    Value * carry_block0 = mBuilder->CreateAlignedLoad(mBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex0), mBITBLOCK_WIDTH/8);
     506    // If the long advance is an exact multiple of mBITBLOCK_WIDTH, we simply return the oldest
    507507    // block in the long advance carry data area. 
    508508    if (block_shift == 0) {
    509         mBuilder->CreateAlignedStore(carry_out, mBuilder->CreateGEP(mCarryBitBlockPtr, storeIndex), BLOCK_SIZE/8);
     509        mBuilder->CreateAlignedStore(carry_out, mBuilder->CreateGEP(mCarryBitBlockPtr, storeIndex), mBITBLOCK_WIDTH/8);
    510510        return carry_block0;
    511511    }
    512512    // Otherwise we need to combine data from the two oldest blocks.
    513513    Value * loadIndex1 = mBuilder->CreateAdd(mBuilder->CreateAnd(mBuilder->CreateSub(mBlockNo, mBuilder->getInt64(advanceEntries-1)), indexMask), advBaseIndex);
    514     Value * carry_block1 = mBuilder->CreateAlignedLoad(mBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex1), BLOCK_SIZE/8);
    515     Value* block0_shr = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_block0, mBuilder->getIntNTy(BLOCK_SIZE)), BLOCK_SIZE - block_shift);
    516     Value* block1_shl = mBuilder->CreateShl(mBuilder->CreateBitCast(carry_block1, mBuilder->getIntNTy(BLOCK_SIZE)), block_shift);
    517     mBuilder->CreateAlignedStore(carry_out, mBuilder->CreateGEP(mCarryBitBlockPtr, storeIndex), BLOCK_SIZE/8);
     514    Value * carry_block1 = mBuilder->CreateAlignedLoad(mBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex1), mBITBLOCK_WIDTH/8);
     515    Value* block0_shr = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_block0, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), mBITBLOCK_WIDTH - block_shift);
     516    Value* block1_shl = mBuilder->CreateShl(mBuilder->CreateBitCast(carry_block1, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), block_shift);
     517    mBuilder->CreateAlignedStore(carry_out, mBuilder->CreateGEP(mCarryBitBlockPtr, storeIndex), mBITBLOCK_WIDTH/8);
    518518    return mBuilder->CreateBitCast(mBuilder->CreateOr(block1_shl, block0_shr), mBitBlockType);
    519519}
     
    532532        Value * pack = getCarryPack(summary_index);
    533533        Value * summary_bits = maskSelectBitRange(pack, summaryPosition() % mPACK_SIZE, summaryBits());
    534         return mBuilder->CreateBitCast(mBuilder->CreateZExt(summary_bits, mBuilder->getIntNTy(BLOCK_SIZE)), mBitBlockType);
     534        return mBuilder->CreateBitCast(mBuilder->CreateZExt(summary_bits, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), mBitBlockType);
    535535    }
    536536    else {
     
    730730    Value * countSoFar = mBuilder->CreateAlignedLoad(countPtr, 8);
    731731    Value * fieldCounts = iBuilder->simd_popcount(64, to_count);
    732     for (int i = 0; i < BLOCK_SIZE/64; i++) {
     732    for (int i = 0; i < mBITBLOCK_WIDTH/64; i++) {
    733733        countSoFar = mBuilder->CreateAdd(countSoFar, iBuilder->mvmd_extract(64, fieldCounts, i));
    734734    }
    735735    mBuilder->CreateAlignedStore(countSoFar, countPtr, 8);
    736     return mBuilder->CreateBitCast(mBuilder->CreateZExt(countSoFar, mBuilder->getIntNTy(BLOCK_SIZE)), mBitBlockType);
     736    return mBuilder->CreateBitCast(mBuilder->CreateZExt(countSoFar, mBuilder->getIntNTy(mBITBLOCK_WIDTH)), mBitBlockType);
    737737}
    738738
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r4824 r4827  
    4141 
    4242    CarryManager(IRBuilder <> * b, IDISA::IDISA_Builder * idb)
    43     : mPACK_SIZE(BLOCK_SIZE)
    44     , mITEMS_PER_PACK(1)
    45     , mBuilder(b)
     43    : mBuilder(b)
    4644    , iBuilder(idb)
    4745    , mPackBuilder(idb)
    4846    , mBitBlockType(idb->getBitBlockType())
     47    , mBITBLOCK_WIDTH(idb->getBitBlockWidth())
     48    , mPACK_SIZE(mBITBLOCK_WIDTH)
     49    , mITEMS_PER_PACK(1)
    4950    , mPabloRoot(nullptr)
    5051    , mCurrentScope(nullptr)
     
    120121   
    121122private:
    122     unsigned mPACK_SIZE;
    123     unsigned mITEMS_PER_PACK;
    124123    IRBuilder <> * mBuilder;
    125124    IDISA::IDISA_Builder * iBuilder;
    126125    IDISA::IDISA_Builder * mPackBuilder;
    127126    Type * mBitBlockType;
     127    unsigned mBITBLOCK_WIDTH;
     128    unsigned mPACK_SIZE;
     129    unsigned mITEMS_PER_PACK;
    128130    PabloBlock * mPabloRoot;
    129131    PabloBlock * mCurrentScope;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4821 r4827  
    129129        Value* indices[] = {mBuilder->getInt64(0), mBuilder->getInt32(i)};
    130130        Value * gep = mBuilder->CreateGEP(mInputAddressPtr, indices);
    131         LoadInst * basisBit = mBuilder->CreateAlignedLoad(gep, BLOCK_SIZE/8, false, function->getParameter(i)->getName()->to_string());
     131        LoadInst * basisBit = mBuilder->CreateAlignedLoad(gep, iBuilder.getBitBlockWidth()/8, false, function->getParameter(i)->getName()->to_string());
    132132        mMarkerMap[function->getParameter(i)] = basisBit;
    133133        if (DumpTrace) {
     
    149149
    150150    if (DumpTrace) {
    151         genPrintRegister("mBlockNo", mBuilder->CreateAlignedLoad(mBuilder->CreateBitCast(mCarryManager->getBlockNoPtr(), PointerType::get(mBitBlockType, 0)), BLOCK_SIZE/8, false));
     151        genPrintRegister("mBlockNo", mBuilder->CreateAlignedLoad(mBuilder->CreateBitCast(mCarryManager->getBlockNoPtr(), PointerType::get(mBitBlockType, 0)), iBuilder.getBitBlockWidth()/8, false));
    152152    }
    153153   
     
    166166    mMod = nullptr; // don't delete this. It's either owned by the ExecutionEngine or the calling function.
    167167
    168     //Return the required size of the carry data area to the process_block function.
    169168    return mFunction;
    170169}
     
    253252    }
    254253   
    255     void PabloCompiler::compileIf(const If * ifStatement) {       
     254void PabloCompiler::compileIf(const If * ifStatement) {       
    256255    //
    257256    //  The If-ElseZero stmt:
     
    436435        mBuilder->CreateCall2(externalFunction, mInputAddressPtr, outputStruct);
    437436        Value * outputPtr = mBuilder->CreateGEP(outputStruct, std::vector<Value *>({ mBuilder->getInt32(0), mBuilder->getInt32(0) }));
    438         expr = mBuilder->CreateAlignedLoad(outputPtr, BLOCK_SIZE / 8, false);
     437        expr = mBuilder->CreateAlignedLoad(outputPtr, iBuilder.getBitBlockWidth() / 8, false);
    439438    }
    440439    else if (const And * pablo_and = dyn_cast<And>(stmt)) {
     
    536535    }
    537536    if (LLVM_UNLIKELY(marker->getType()->isPointerTy())) {
    538         marker = mBuilder->CreateAlignedLoad(marker, BLOCK_SIZE/8, false);
     537        marker = mBuilder->CreateAlignedLoad(marker, iBuilder.getBitBlockWidth()/8, false);
    539538    }
    540539    Value* indices[] = {mBuilder->getInt64(0), mBuilder->getInt32(index)};
    541540    Value* gep = mBuilder->CreateGEP(mOutputAddressPtr, indices);
    542     mBuilder->CreateAlignedStore(marker, gep, BLOCK_SIZE/8, false);
    543 }
    544 
    545 }
     541    mBuilder->CreateAlignedStore(marker, gep, iBuilder.getBitBlockWidth()/8, false);
     542}
     543
     544}
Note: See TracChangeset for help on using the changeset viewer.