Ignore:
Timestamp:
Apr 28, 2018, 3:54:43 PM (12 months ago)
Author:
nmedfort
Message:

Added temporary buffer functionality to the pipeline for single stream source buffers. Fixed memory leak from UCD::UnicodeBreakRE()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/radix64.cpp

    r5985 r5998  
    3939// of bytes to the actual output stream.
    4040
    41 //void expand3_4Kernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> &b, Value * const numOfStrides) {
    42 
    43 //    BasicBlock * expand2_3entry = b->GetInsertBlock();
    44 //    BasicBlock * expand_3_4_loop = b->CreateBasicBlock("expand_3_4_loop");
    45 //    BasicBlock * expand3_4_exit = b->CreateBasicBlock("expand3_4_exit");
    46 
    47 //    // Determine the require shufflevector constants.
    48 //    const unsigned PACK_SIZE = b->getBitBlockWidth()/8;
    49 
    50 //    ConstantInt * const ZERO = b->getSize(0);
    51 //    ConstantInt * const ONE = b->getSize(1);
    52 //    ConstantInt * const THREE = b->getSize(3);
    53 //    ConstantInt * const FOUR = b->getSize(4);
    54 //    ConstantInt * const SEVEN = b->getSize(7);
    55 
    56 //    // Construct a list of indexes in  the form
    57 //    // 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, ...
    58 //    unsigned sourceByteIndex = 0;
    59 //    unsigned expand3_4_index[PACK_SIZE];
    60 //    for (unsigned i = 0; i < PACK_SIZE; i++) {
    61 //        expand3_4_index[i] = sourceByteIndex;
    62 //        if (i % 4 != 2) sourceByteIndex++;
    63 //    }
    64 //    unsigned const expand3_4_offset[4] = {PACK_SIZE, 3*PACK_SIZE/4, PACK_SIZE/2, PACK_SIZE/4};
    65 //    Value * expand_3_4_shuffle[4];
    66 //    for (unsigned j = 0; j < 4; j++) {
    67 //        std::vector<Constant *> Idxs;
    68 //        for (unsigned i = 0; i < PACK_SIZE; i++) {
    69 //            Idxs.push_back(ConstantInt::get(b->getInt32Ty(), expand3_4_offset[j] + expand3_4_index[i]));
    70 //        }
    71 //        expand_3_4_shuffle[j] = ConstantVector::get(Idxs);
    72 //    }
    73 
    74 
    75 
    76 //    Constant * triplePackSize = b->getSize(3 * PACK_SIZE); // 3 packs per loop.
    77 //    UndefValue * undefPack = UndefValue::get(b->fwVectorType(8));
    78 
    79 //    Value * const numOfBlocks = b->CreateMul(numOfStrides, b->getSize(8));
    80 
    81 //    Value * itemsToDo = mAvailableItemCount[0];
    82 
    83 //    // The main loop processes 3 packs of data at a time.
    84 //    b->CreateBr(expand_3_4_loop);
    85 
    86 //    b->SetInsertPoint(expand_3_4_loop);
    87 //    PHINode * loopItemsRemain = b->CreatePHI(b->getSizeTy(), 2);
    88 //    PHINode * strideOffset = b->CreatePHI(b->getSizeTy(), 2);
    89 //    loopItemsRemain->addIncoming(itemsToDo, expand2_3entry);
    90 //    strideOffset->addIncoming(ZERO, expand2_3entry);
    91 
    92 //    Value * const baseInputOffset = b->CreateMul(strideOffset, THREE);
    93 //    Value * const baseOutputOffset = b->CreateMul(strideOffset, FOUR);
    94 //    Value * carryOver = undefPack;
    95 //    for (unsigned i = 0; i < 3; ++i) {
    96 //        ConstantInt * const index = b->getSize(i);
    97 //        Value * const inputOffset = b->CreateAdd(baseInputOffset, index);
    98 //        Value * const inputPackIndex = b->CreateAnd(inputOffset, SEVEN);
    99 //        Value * const inputBlockOffset = b->CreateLShr(inputOffset, THREE);
    100 //        Value * const input = b->fwCast(8, b->loadInputStreamPack("sourceStream", ZERO, inputPackIndex, inputBlockOffset));
    101 //        Value * const expanded = b->CreateShuffleVector(carryOver, input, expand_3_4_shuffle[i]);
    102 //        Value * const outputOffset = b->CreateAdd(baseOutputOffset, index);
    103 //        Value * const outputPackIndex = b->CreateAnd(outputOffset, SEVEN);
    104 //        Value * const outputBlockOffset = b->CreateLShr(outputOffset, THREE);
    105 //        b->storeOutputStreamPack("expand34Stream", ZERO, outputPackIndex, outputBlockOffset, b->bitCast(expanded));
    106 //        carryOver = input;
    107 //    }
    108 //    Value * expanded = b->CreateShuffleVector(carryOver, undefPack, expand_3_4_shuffle[3]);
    109 //    Value * outputOffset = b->CreateAdd(baseOutputOffset, THREE);
    110 //    Value * const outputPackIndex = b->CreateAnd(outputOffset, SEVEN);
    111 //    Value * const outputBlockOffset = b->CreateLShr(outputOffset, THREE);
    112 //    b->storeOutputStreamPack("expand34Stream", ZERO, outputPackIndex, outputBlockOffset, b->bitCast(expanded));
    113 
    114 //    Value * remainingItems = b->CreateSub(loopItemsRemain, triplePackSize);
    115 
    116 //    loopItemsRemain->addIncoming(remainingItems, expand_3_4_loop);
    117 //    Value * const nextStrideOffset = b->CreateAdd(strideOffset, ONE);
    118 //    strideOffset->addIncoming(nextStrideOffset, expand_3_4_loop);
    119 
    120 //    //Value * continueLoop = b->CreateICmpSGT(remainingItems, ZERO);
    121 //    Value * continueLoop = b->CreateICmpULT(nextStrideOffset, numOfBlocks);
    122 //    b->CreateCondBr(continueLoop, expand_3_4_loop, expand3_4_exit);
    123 
    124 //    b->SetInsertPoint(expand3_4_exit);
    125 
    126 //}
    127 
    12841void expand3_4Kernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> &b, Value * const numOfStrides) {
    12942
Note: See TracChangeset for help on using the changeset viewer.