Ignore:
Timestamp:
Nov 18, 2016, 1:46:55 PM (2 years ago)
Author:
nmedfort
Message:

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

File:
1 edited

Legend:

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

    r5202 r5217  
    5353    auto savePoint = iBuilder->saveIP();
    5454    Module * m = iBuilder->getModule();
    55    
     55
    5656    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
    57    
     57
    5858    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
    59    
     59
    6060    Value * self = getParameter(doBlockFunction, "self");
     61
    6162    Value * blockNo = getScalarField(self, blockNoScalar);
    62     Value * inputStreamBlock = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
    63     Value * outputStreamBlock = getStreamSetBlockPtr(self, "outputStreamSet", blockNo);
    64     Value * delCountBlock = getStreamSetBlockPtr(self, "deletionCounts", blockNo);
    6563
    66     Value * del_mask = iBuilder->CreateBlockAlignedLoad(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(mStreamCount)});
    67    
    68     std::vector<Value *> move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, del_mask);
    69    
     64    Value * inputStreamPtr = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
     65
     66    Value * delMaskPtr = getStreamSetBlockPtr(self, "delMaskSet", blockNo);
     67
     68    Value * outputStreamPtr = getStreamSetBlockPtr(self, "outputStreamSet", blockNo);
     69
     70    Value * delCountPtr = getStreamSetBlockPtr(self, "deletionCounts", blockNo);
     71
     72    Value * delMask = iBuilder->CreateBlockAlignedLoad(delMaskPtr, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
     73
     74    std::vector<Value *> move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, delMask);
     75
    7076    for (unsigned j = 0; j < mStreamCount; ++j) {
    71         Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
    72         Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, del_mask, move_masks, input);
    73         iBuilder->CreateBlockAlignedStore(output, outputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
     77        Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
     78        Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, delMask, move_masks, input);
     79        iBuilder->CreateBlockAlignedStore(output, outputStreamPtr, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
    7480    }
    75     Value * counts = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(del_mask));
    76     iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(counts), delCountBlock, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
     81    Value * counts = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(delMask));
     82    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(counts), delCountPtr, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    7783    /* Stream deletion has only been applied within fields; the actual number of data items
    7884     * has not yet changed.   */
    7985    Value * produced = getProducedItemCount(self);
    8086    produced = iBuilder->CreateAdd(produced, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride()));
    81     setProducedItemCount(self, produced);   
     87    setProducedItemCount(self, produced);
    8288    iBuilder->CreateRetVoid();
    8389    iBuilder->restoreIP(savePoint);
     
    8793    auto savePoint = iBuilder->saveIP();
    8894    Module * m = iBuilder->getModule();
    89    
     95
    9096    unsigned blockSize = iBuilder->getBitBlockWidth();
    9197    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
     
    96102    Value * self = getParameter(finalBlockFunction, "self");
    97103    Value * blockNo = getScalarField(self, blockNoScalar);
    98     Value * inputStreamBlock = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
     104    Value * delMaskBlock = getStreamSetBlockPtr(self, "delMaskSet", blockNo);
    99105    Value * remaining = iBuilder->CreateZExt(remainingBytes, iBuilder->getIntNTy(blockSize));
    100106    Value * EOF_del = iBuilder->bitCast(iBuilder->CreateShl(Constant::getAllOnesValue(iBuilder->getIntNTy(blockSize)), remaining));
    101     Value * const delmaskPtr = iBuilder->CreateGEP(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(16)});
     107    Value * const delmaskPtr = iBuilder->CreateGEP(delMaskBlock, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    102108    Value * const delmaskVal = iBuilder->CreateBlockAlignedLoad(delmaskPtr);
    103109    iBuilder->CreateBlockAlignedStore(iBuilder->CreateOr(EOF_del, delmaskVal), delmaskPtr);
Note: See TracChangeset for help on using the changeset viewer.