Ignore:
Timestamp:
Jan 30, 2018, 1:51:06 AM (16 months ago)
Author:
xwa163
Message:
  1. Use MemCpy? instead of streamCpy when handling buffer CopyBack?
  2. Rollback change of kernel_builder
  3. Fix bug of SwizzledDeleteByPEXTkernel when input data file is large
  4. Add large test cases for character_deletion
File:
1 edited

Legend:

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

    r5848 r5852  
    8484
    8585void SwizzledDeleteByPEXTkernel::generateFinalBlockMethod(const std::unique_ptr<KernelBuilder> &iBuilder, Value * remainingBytes) {
     86    const auto originalProducedItemCount = iBuilder->getProducedItemCount("outputSwizzle0");
    8687    IntegerType * vecTy = iBuilder->getIntNTy(iBuilder->getBitBlockWidth());
    8788    Value * remaining = iBuilder->CreateZExt(remainingBytes, vecTy);
     
    9091    const auto masks = get_PEXT_masks(iBuilder, delMask);
    9192    generateProcessingLoop(iBuilder, masks, delMask);
     93
     94    const auto newProducedItemCount = iBuilder->getProducedItemCount("outputSwizzle0");
    9295    Constant * blockOffsetMask = iBuilder->getSize(iBuilder->getBitBlockWidth() - 1);
    9396    Constant * outputIndexShift = iBuilder->getSize(std::log2(mDelCountFieldWidth));
     
    9699    Value * producedOffset = iBuilder->CreateAnd(outputProduced, blockOffsetMask);
    97100    Value * outputIndex = iBuilder->CreateLShr(producedOffset, outputIndexShift);
     101
     102    const auto deltaOutputIndex = iBuilder->CreateSub(
     103            iBuilder->CreateUDiv(newProducedItemCount, iBuilder->getSize(iBuilder->getBitBlockWidth())),
     104            iBuilder->CreateUDiv(originalProducedItemCount, iBuilder->getSize(iBuilder->getBitBlockWidth()))
     105    );
     106    outputIndex = iBuilder->CreateAdd(outputIndex, iBuilder->CreateMul(deltaOutputIndex, iBuilder->getSize(iBuilder->getBitBlockWidth() / mDelCountFieldWidth)));
     107
    98108    Value * pendingOffset = iBuilder->getScalarField("pendingOffset");
    99109
     
    102112        Value * pendingData = iBuilder->getScalarField("pendingSwizzleData" + std::to_string(i));
    103113        Value * outputStreamPtr = iBuilder->getOutputStreamBlockPtr("outputSwizzle" + std::to_string(i), iBuilder->getInt32(0));
    104                 // TODO it seems that we do not need to store pending data here
    105         // iBuilder->CreateBlockAlignedStore(pendingData, iBuilder->CreateGEP(outputStreamPtr, outputIndex));
     114        iBuilder->CreateBlockAlignedStore(pendingData, iBuilder->CreateGEP(outputStreamPtr, outputIndex));
    106115    }
    107116    iBuilder->setProducedItemCount("outputSwizzle0", iBuilder->CreateAdd(pendingOffset, outputProduced));
Note: See TracChangeset for help on using the changeset viewer.