Changeset 5304


Ignore:
Timestamp:
Feb 6, 2017, 7:33:31 AM (8 months ago)
Author:
cameron
Message:

Deletion kernel: eliminate final block hack that overwrites input delmask, leave counting to doSegment routine

File:
1 edited

Legend:

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

    r5297 r5304  
    6868    Value * delCountPtr = getOutputStream("deletionCounts", iBuilder->getInt32(0));
    6969    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(delCount), delCountPtr);
    70     // Stream deletion has only been applied within fields; the actual number of data items has not yet changed.
    71     Value * produced = getProducedItemCount("outputStreamSet");
    72     produced = iBuilder->CreateAdd(produced, iBuilder->getSize(iBuilder->getStride()));
    73     setProducedItemCount("outputStreamSet", produced);
    74     setProducedItemCount("deletionCounts", produced);
    7570}
    7671
     
    8075    Value * EOF_del = iBuilder->bitCast(iBuilder->CreateShl(Constant::getAllOnesValue(vecTy), remaining));
    8176    Value * const delmaskPtr = getInputStream("delMaskSet", iBuilder->getInt32(0));
    82     Value * const delmaskVal = iBuilder->CreateBlockAlignedLoad(delmaskPtr);
    83     iBuilder->CreateBlockAlignedStore(iBuilder->CreateOr(EOF_del, delmaskVal), delmaskPtr);
    84     CreateDoBlockMethodCall();
    85     // Adjust the produced item count
    86     Value * produced = getProducedItemCount("outputStreamSet");
    87     produced = iBuilder->CreateSub(produced, iBuilder->getSize(iBuilder->getStride()));
    88     produced =  iBuilder->CreateAdd(produced, remainingBytes);
    89     setProducedItemCount("outputStreamSet", produced);
    90     setProducedItemCount("deletionCounts", produced);
     77    Value * delMask = iBuilder->CreateOr(EOF_del, iBuilder->CreateBlockAlignedLoad(delmaskPtr));
     78    const auto move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, delMask);
     79    for (unsigned j = 0; j < mStreamCount; ++j) {
     80        Value * inputStreamPtr = getInputStream("inputStreamSet", iBuilder->getInt32(j));
     81        Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamPtr);
     82        Value * output = apply_parallel_prefix_deletion(iBuilder, mDeletionFieldWidth, delMask, move_masks, input);
     83        Value * outputStreamPtr = getOutputStream("outputStreamSet", iBuilder->getInt32(j));
     84        iBuilder->CreateBlockAlignedStore(output, outputStreamPtr);
     85    }
     86    Value * delCount = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(delMask));
     87    Value * delCountPtr = getOutputStream("deletionCounts", iBuilder->getInt32(0));
     88    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(delCount), delCountPtr);
    9189}
    9290
     
    10098, mDeletionFieldWidth(fw)
    10199, mStreamCount(streamCount) {
    102     mDoBlockUpdatesProducedItemCountsAttribute = true;
     100    mDoBlockUpdatesProducedItemCountsAttribute = false;
    103101}
    104102
Note: See TracChangeset for help on using the changeset viewer.