Ignore:
Timestamp:
Apr 6, 2017, 4:14:34 PM (2 years ago)
Author:
cameron
Message:

Uniquify kernel names with buffer types/sizes; update u8u16 to use ParabixDriver?

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
5 edited

Legend:

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

    r5392 r5395  
    122122
    123123std::unique_ptr<Module> KernelBuilder::createKernelStub() {
    124     return make_unique<Module>(getName() + "_" + iBuilder->getBuilderUniqueName(), iBuilder->getContext());
     124    std::string cacheName = getName() + "_" + iBuilder->getBuilderUniqueName();
     125    for (auto & b: mStreamSetInputBuffers) {
     126        cacheName += ":" + b->getUniqueID();
     127    }
     128    for (auto & b: mStreamSetOutputBuffers) {
     129        cacheName += ":" + b->getUniqueID();
     130    }
     131    return make_unique<Module>(cacheName, iBuilder->getContext());
    125132}
    126133
     
    181188
    182189void KernelBuilder::generateKernel() {
     190    if (mIsGenerated) return;
    183191    auto savePoint = iBuilder->saveIP();
    184192    addKernelDeclarations(iBuilder->getModule());
     
    195203    }
    196204    iBuilder->restoreIP(savePoint);
     205    mIsGenerated = true;
    197206}
    198207
     
    523532    ConstantInt * stride = iBuilder->getSize(iBuilder->getStride());
    524533    Value * availablePos = producerPos[0];
    525     for (unsigned i = 1; i < mStreamSetInputs.size(); i++) {
    526         Value * p = producerPos[i];
    527         availablePos = iBuilder->CreateSelect(iBuilder->CreateICmpULT(availablePos, p), availablePos, p);
    528     }
    529 
    530534    Value * processed = getProcessedItemCount(mStreamSetInputs[0].name);
    531535    Value * itemsAvail = iBuilder->CreateSub(availablePos, processed);
     
    778782, mSelf(nullptr)
    779783, mCurrentMethod(nullptr)
    780 , mNoTerminateAttribute(false) {
     784, mNoTerminateAttribute(false)
     785, mIsGenerated(false) {
    781786
    782787}
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5392 r5395  
    327327    std::vector<const parabix::StreamSetBuffer *>   mStreamSetOutputBuffers;
    328328    bool                                            mNoTerminateAttribute;
     329    bool                                            mIsGenerated;
    329330
    330331};
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.cpp

    r5356 r5395  
    147147
    148148P2SKernel::P2SKernel(IDISA::IDISA_Builder * iBuilder)
    149 : BlockOrientedKernel(iBuilder, "p2s",
     149: BlockOrientedKernel(iBuilder, "Parabix:p2s",
    150150              {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}},
    151151              {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
     
    154154
    155155P2SKernelWithCompressedOutput::P2SKernelWithCompressedOutput(IDISA::IDISA_Builder * iBuilder)
    156 : BlockOrientedKernel(iBuilder, "p2s_compress",
     156: BlockOrientedKernel(iBuilder, "Parabix:p2s_compress",
    157157              {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
    158158                      {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream", MaxRatio(1)}},
     
    161161
    162162P2S16Kernel::P2S16Kernel(IDISA::IDISA_Builder * iBuilder)
    163 : BlockOrientedKernel(iBuilder, "p2s_16",
     163: BlockOrientedKernel(iBuilder, "Parabix:p2s_16",
    164164              {Binding{iBuilder->getStreamSetTy(16, 1), "basisBits"}},
    165165              {Binding{iBuilder->getStreamSetTy(1, 16), "i16Stream"}},
     
    169169
    170170P2S16KernelWithCompressedOutput::P2S16KernelWithCompressedOutput(IDISA::IDISA_Builder * b)
    171 : BlockOrientedKernel(b, "p2s_16_compress",
     171: BlockOrientedKernel(b, "Parabix:p2s_16_compress",
    172172              {Binding{b->getStreamSetTy(16, 1), "basisBits"}, Binding{b->getStreamSetTy(1, 1), "deletionCounts"}},
    173173              {Binding{b->getStreamSetTy(1, 16), "i16Stream", MaxRatio(1)}},
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5390 r5395  
    303303SwizzledCopybackBuffer::SwizzledCopybackBuffer(IDISA::IDISA_Builder * b, Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned fieldwidth, unsigned AddressSpace)
    304304: StreamSetBuffer(BufferKind::SwizzledCopybackBuffer, b, type, resolveStreamSetType(b, type), bufferBlocks, AddressSpace), mOverflowBlocks(overflowBlocks), mFieldWidth(fieldwidth) {
    305    
     305    mUniqueID = "SW" + std::to_string(fieldwidth) + ":" + std::to_string(bufferBlocks);
     306    if (mOverflowBlocks != 1) mUniqueID += "_" + std::to_string(mOverflowBlocks);
     307    if (AddressSpace > 0) mUniqueID += "@" + std::to_string(AddressSpace);
     308
    306309}
    307310
     
    461464SingleBlockBuffer::SingleBlockBuffer(IDISA::IDISA_Builder * b, Type * type)
    462465: StreamSetBuffer(BufferKind::BlockBuffer, b, type, resolveStreamSetType(b, type), 1, 0) {
     466    mUniqueID = "S";
    463467
    464468}
     
    466470ExternalFileBuffer::ExternalFileBuffer(IDISA::IDISA_Builder * b, Type * type, unsigned AddressSpace)
    467471: StreamSetBuffer(BufferKind::ExternalFileBuffer, b, type, resolveStreamSetType(b, type), 0, AddressSpace) {
    468 
     472    mUniqueID = "E";
     473    if (AddressSpace > 0) mUniqueID += "@" + std::to_string(AddressSpace);
    469474}
    470475
    471476ExtensibleBuffer::ExtensibleBuffer(IDISA::IDISA_Builder * b, Type * type, size_t bufferBlocks, unsigned AddressSpace)
    472477: StreamSetBuffer(BufferKind::ExtensibleBuffer, b, type, StructType::get(b->getSizeTy(), resolveStreamSetType(b, type)->getPointerTo(), nullptr), bufferBlocks, AddressSpace) {
    473 
     478    mUniqueID = "XT" + std::to_string(bufferBlocks);
     479    if (AddressSpace > 0) mUniqueID += "@" + std::to_string(AddressSpace);
    474480}
    475481
    476482CircularBuffer::CircularBuffer(IDISA::IDISA_Builder * b, Type * type, size_t bufferBlocks, unsigned AddressSpace)
    477483: StreamSetBuffer(BufferKind::CircularBuffer, b, type, resolveStreamSetType(b, type), bufferBlocks, AddressSpace) {
     484    mUniqueID = "C" + std::to_string(bufferBlocks);
     485    if (AddressSpace > 0) mUniqueID += "@" + std::to_string(AddressSpace);
    478486
    479487}
     
    481489CircularCopybackBuffer::CircularCopybackBuffer(IDISA::IDISA_Builder * b, Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned AddressSpace)
    482490: StreamSetBuffer(BufferKind::CircularCopybackBuffer, b, type, resolveStreamSetType(b, type), bufferBlocks, AddressSpace), mOverflowBlocks(overflowBlocks) {
    483 
     491    mUniqueID = "CC" + std::to_string(bufferBlocks);
     492    if (mOverflowBlocks != 1) mUniqueID += "_" + std::to_string(mOverflowBlocks);
     493    if (AddressSpace > 0) mUniqueID += "@" + std::to_string(AddressSpace);
    484494}
    485495
     
    487497: StreamSetBuffer(BufferKind::ExpandableBuffer, b, type, resolveExpandableStreamSetType(b, type), bufferBlocks, AddressSpace)
    488498, mInitialCapacity(type->getArrayNumElements()) {
    489 
     499    mUniqueID = "XP" + std::to_string(bufferBlocks);
     500    if (AddressSpace > 0) mUniqueID += "@" + std::to_string(AddressSpace);
    490501}
    491502
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5390 r5395  
    2323    BufferKind getBufferKind() const {
    2424        return mBufferKind;
     25    }
     26   
     27    std::string getUniqueID() const {
     28        return mUniqueID;
    2529    }
    2630
     
    8690    llvm::Value *                   mStreamSetBufferPtr;
    8791    llvm::Type * const              mBaseType;
     92    std::string                     mUniqueID;
    8893};   
    8994
Note: See TracChangeset for help on using the changeset viewer.