Ignore:
Timestamp:
Mar 28, 2017, 1:25:59 PM (2 years ago)
Author:
cameron
Message:

Bug fix for SwizzledBitstreamCompressByCount? final block

File:
1 edited

Legend:

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

    r5375 r5376  
    343343void SwizzledBitstreamCompressByCount::generateFinalBlockMethod(Value * remainingBytes) {
    344344    CreateDoBlockMethodCall();
    345     // All the data has been written.  Update the count to include pending data.
     345    Constant * blockOffsetMask = iBuilder->getSize(iBuilder->getBitBlockWidth() - 1);
     346    Constant * outputIndexShift = iBuilder->getSize(std::log2(mFieldWidth));
     347   
     348    Value * outputProduced = getProducedItemCount("outputSwizzle0"); // All output groups have the same count.
     349    Value * producedOffset = iBuilder->CreateAnd(outputProduced, blockOffsetMask);
     350    Value * outputIndex = iBuilder->CreateLShr(producedOffset, outputIndexShift);
    346351    Value * pendingOffset = getScalarField("pendingOffset");
    347     Value * produced = iBuilder->CreateAdd(pendingOffset, getProducedItemCount("outputSwizzle0"));
    348     setProducedItemCount("outputSwizzle0", produced);
    349 }
    350 }
     352
     353    // Write the pending data.
     354    for (unsigned i = 0; i < mSwizzleSetCount; i++) {
     355        Value * pendingData = getScalarField("pendingSwizzleData" + std::to_string(i));
     356        Value * outputStreamPtr = getOutputStreamBlockPtr("outputSwizzle" + std::to_string(i), iBuilder->getInt32(0));
     357        iBuilder->CreateBlockAlignedStore(pendingData, iBuilder->CreateGEP(outputStreamPtr, outputIndex));
     358    }
     359    setProducedItemCount("outputSwizzle0", iBuilder->CreateAdd(pendingOffset, outputProduced));
     360}
     361}
Note: See TracChangeset for help on using the changeset viewer.