Ignore:
Timestamp:
Jan 16, 2017, 9:55:26 AM (2 years ago)
Author:
cameron
Message:

Move responsibility for ProducedItemCount? into doSegment unless overridden

File:
1 edited

Legend:

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

    r5260 r5261  
    6666}
    6767
     68P2SKernel::P2SKernel(IDISA::IDISA_Builder * iBuilder) :
     69    KernelBuilder(iBuilder, "p2s",
     70                  {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}},
     71                  {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
     72                  {}, {}, {}) {
     73
     74    }
     75   
     76
    6877void P2SKernelWithCompressedOutput::generateDoBlockMethod() const {
    6978    auto savePoint = iBuilder->saveIP();
     
    93102    Value * unit_counts = iBuilder->fwCast(units_per_register, iBuilder->CreateBlockAlignedLoad(delCountBlock_ptr));
    94103
     104    Value * unitsGenerated = getProducedItemCount(self, "byteStream"); // units generated to buffer
    95105    Value * output_ptr = getStreamView(i8PtrTy, self, "byteStream", blockNo, iBuilder->getInt32(0));
    96106    Value * offset = iBuilder->getInt32(0);
     
    99109        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(j)), i32);
    100110    }
    101     iBuilder->CreateRetVoid();
    102     iBuilder->restoreIP(savePoint);
    103 }
     111    unitsGenerated = iBuilder->CreateAdd(unitsGenerated, iBuilder->CreateZExt(offset, iBuilder->getSizeTy()));
     112    setProducedItemCount(self, "byteStream", unitsGenerated);
     113
     114    iBuilder->CreateRetVoid();
     115    iBuilder->restoreIP(savePoint);
     116}
     117   
     118P2SKernelWithCompressedOutput::P2SKernelWithCompressedOutput(IDISA::IDISA_Builder * iBuilder) :
     119    KernelBuilder(iBuilder, "p2s_compress",
     120                  {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
     121                  {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
     122                  {}, {}, {}) {
     123        setDoBlockUpdatesProducedItemCountsAttribute(true);
     124
     125    }
     126   
     127   
    104128
    105129void P2S16Kernel::generateDoBlockMethod() const {
     
    140164    iBuilder->restoreIP(savePoint);
    141165}
    142 
     166   
     167
     168P2S16Kernel::P2S16Kernel(IDISA::IDISA_Builder * iBuilder) :
     169    KernelBuilder(iBuilder, "p2s_16",
     170                  {Binding{iBuilder->getStreamSetTy(16, 1), "basisBits"}},
     171                  {Binding{iBuilder->getStreamSetTy(1, 16), "i16Stream"}},
     172                  {}, {}, {}) {
     173       
     174    }
     175
     176   
    143177void P2S16KernelWithCompressedOutput::generateDoBlockMethod() const {
    144178    auto savePoint = iBuilder->saveIP();
     
    219253}
    220254   
    221 }
     255P2S16KernelWithCompressedOutput::P2S16KernelWithCompressedOutput(IDISA::IDISA_Builder * iBuilder) :
     256    KernelBuilder(iBuilder, "p2s_16_compress",
     257                  {Binding{iBuilder->getStreamSetTy(16, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
     258                  {Binding{iBuilder->getStreamSetTy(1, 16), "i16Stream"}},
     259                  {},
     260                  {},
     261                  {Binding{iBuilder->getSizeTy(), "unitsGenerated"}, Binding{iBuilder->getSizeTy(), "unitsWritten"}}) {
     262        setDoBlockUpdatesProducedItemCountsAttribute(true);
     263}
     264   
     265   
     266}
Note: See TracChangeset for help on using the changeset viewer.