Ignore:
Timestamp:
Jun 13, 2018, 6:03:20 AM (11 months ago)
Author:
cameron
Message:

u32u8 progress

File:
1 edited

Legend:

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

    r6055 r6085  
    102102        kb->storeOutputStreamBlock("outputStreamSet", kb->getInt32(j), blockOffsetPhi, output);
    103103    }
     104#ifndef STREAM_COMPRESS_USING_EXTRACTION_MASK
    104105    Value * unitCount = kb->simd_popcount(mCompressFieldWidth, extractionMask);
    105106    kb->storeOutputStreamBlock("unitCounts", kb->getInt32(0), blockOffsetPhi, kb->bitCast(unitCount));
     107#endif
    106108    Value * nextBlk = kb->CreateAdd(blockOffsetPhi, kb->getSize(1));
    107109    blockOffsetPhi->addIncoming(nextBlk, processBlock);
     
    115117                      {Binding{kb->getStreamSetTy(streamCount), "inputStreamSet"},
    116118                          Binding{kb->getStreamSetTy(), "extractionMask"}},
    117                       {Binding{kb->getStreamSetTy(streamCount), "outputStreamSet"},
    118                           Binding{kb->getStreamSetTy(), "unitCounts", FixedRate(), RoundUpTo(kb->getBitBlockWidth())}},
     119#ifdef STREAM_COMPRESS_USING_EXTRACTION_MASK
     120                   {Binding{kb->getStreamSetTy(streamCount), "outputStreamSet"}},
     121#else
     122                   {Binding{kb->getStreamSetTy(streamCount), "outputStreamSet"},
     123                       Binding{kb->getStreamSetTy(), "unitCounts", FixedRate(), RoundUpTo(kb->getBitBlockWidth())}},
     124#endif
    119125                      {}, {}, {})
    120126, mCompressFieldWidth(fieldWidth)
     
    144150    Value * extractionMaskPtr = kb->getInputStreamBlockPtr("extractionMask", ZERO, blockOffsetPhi);
    145151    extractionMaskPtr = kb->CreatePointerCast(extractionMaskPtr, fieldPtrTy);
     152#ifndef STREAM_COMPRESS_USING_EXTRACTION_MASK
    146153    Value * unitCountPtr = kb->getOutputStreamBlockPtr("unitCounts", ZERO, blockOffsetPhi);
    147154    unitCountPtr = kb->CreatePointerCast(unitCountPtr, fieldPtrTy);
     
    151158        kb->CreateStore(popc, kb->CreateGEP(unitCountPtr, kb->getInt32(i)));
    152159    }
     160#else
     161    for (unsigned i = 0; i < fieldsPerBlock; i++) {
     162        mask[i] = kb->CreateLoad(kb->CreateGEP(extractionMaskPtr, kb->getInt32(i)));
     163    }
     164#endif
    153165    for (unsigned j = 0; j < mStreamCount; ++j) {
    154166        Value * inputPtr = kb->getInputStreamBlockPtr("inputStreamSet", kb->getInt32(j), blockOffsetPhi);
     
    173185                   {Binding{kb->getStreamSetTy(streamCount), "inputStreamSet"},
    174186                       Binding{kb->getStreamSetTy(), "extractionMask"}},
     187#ifdef STREAM_COMPRESS_USING_EXTRACTION_MASK
     188                   {Binding{kb->getStreamSetTy(streamCount), "outputStreamSet"}},
     189#else
    175190                   {Binding{kb->getStreamSetTy(streamCount), "outputStreamSet"},
    176191                       Binding{kb->getStreamSetTy(), "unitCounts", FixedRate(), RoundUpTo(kb->getBitBlockWidth())}},
     192#endif
    177193                   {}, {}, {})
    178194, mPEXTWidth(fieldWidth)
     
    184200: MultiBlockKernel("streamCompress" + std::to_string(fieldWidth) + "_" + std::to_string(streamCount),
    185201                   {Binding{kb->getStreamSetTy(streamCount), "sourceStreamSet"},
    186                        Binding{kb->getStreamSetTy(), "unitCounts"}},
     202#ifdef STREAM_COMPRESS_USING_EXTRACTION_MASK
     203                       Binding{kb->getStreamSetTy(), "extractionMask"}},
     204#else
     205                   Binding{kb->getStreamSetTy(), "unitCounts"}},
     206#endif
    187207                   {Binding{kb->getStreamSetTy(streamCount), "compressedOutput", BoundedRate(0, 1)}},
    188208                   {}, {}, {})
     
    234254        pendingDataPhi[i]->addIncoming(pendingData[i], entry);
    235255    }
     256#ifdef STREAM_COMPRESS_USING_EXTRACTION_MASK
     257    Value * fieldPopCounts = b->simd_popcount(fw, b->loadInputStreamBlock("extractionMask", ZERO, blockOffsetPhi));
     258#else
    236259    Value * fieldPopCounts = b->loadInputStreamBlock("unitCounts", ZERO, blockOffsetPhi);
     260#endif
    237261    // For each field determine the (partial) sum popcount of all fields up to and
    238262    // including the current field.
     
    241265        partialSum = b->simd_add(fw, partialSum, b->mvmd_slli(fw, partialSum, i));
    242266    }
    243     Value * blockPopCount = b->CreateZExtOrTrunc(b->CreateExtractElement(partialSum, numFields-1), sizeTy);
     267    Value * blockPopCount = b->CreateZExtOrTrunc(b->mvmd_extract(fw, partialSum, numFields-1), sizeTy);
    244268    //
    245269    // Now determine for each source field the output offset of the first bit.
     
    366390    b->CreateBr(updateProducedCount);
    367391    b->SetInsertPoint(updateProducedCount);
    368      Value * produced = b->getProducedItemCount("compressedOutput");
     392    Value * produced = b->getProducedItemCount("compressedOutput");
    369393    produced = b->CreateAdd(produced, b->CreateMul(nextOutputBlk, bitBlockWidthConst));
    370394    produced = b->CreateSelect(mIsFinal, b->CreateAdd(produced, newPending), produced);
     
    802826    }
    803827    parabix::StreamSetBuffer * compressedFields = mDriver.addBuffer<parabix::StaticBuffer>(iBuilder, iBuilder->getStreamSetTy(N), mBufferBlocks);
     828#ifndef STREAM_COMPRESS_USING_EXTRACTION_MASK
    804829    parabix::StreamSetBuffer * unitCounts = mDriver.addBuffer<parabix::StaticBuffer>(iBuilder, iBuilder->getStreamSetTy(), mBufferBlocks);
    805830   
     
    808833    Kernel * streamK = mDriver.addKernelInstance<StreamCompressKernel>(iBuilder, mIntraFieldCompressionWidth, N);
    809834    mDriver.makeKernelCall(streamK, {compressedFields, unitCounts}, {outputs});
    810 }
    811 
    812 
    813 }
     835#else
     836    mDriver.makeKernelCall(compressK, {inputs, mask}, {compressedFields});
     837   
     838    Kernel * streamK = mDriver.addKernelInstance<StreamCompressKernel>(iBuilder, mIntraFieldCompressionWidth, N);
     839    mDriver.makeKernelCall(streamK, {compressedFields, mask}, {outputs});
     840#endif
     841}
     842
     843
     844}
Note: See TracChangeset for help on using the changeset viewer.