Ignore:
Timestamp:
Feb 27, 2018, 3:16:46 PM (19 months ago)
Author:
nmedfort
Message:

MustExplicitlyTerminate? attribute for Xiangyu

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/attributes.h

    r5882 r5883  
    215215        // Indicates that this kernel can call setTerminationSignal() to terminate the
    216216        // kernel prior to processing all of its input streams.
     217
     218        MustExplicitlyTerminate,
     219
     220        // This kernel terminates *only* after the programmer calls setTerminationSignal()
     221        // and will be called even when there is no new input data when the prior kernels
     222        // in the pipeline have also terminated.
    217223
    218224    };
     
    270276    friend Attribute Swizzled();
    271277    friend Attribute CanTerminateEarly();
     278    friend Attribute MustExplicitlyTerminate();
    272279
    273280    Attribute(const KindId kind, const unsigned k) : mKind(kind), mAmount(k) { }
     
    366373}
    367374
     375inline Attribute MustExplicitlyTerminate() {
     376    return Attribute(Attribute::KindId::MustExplicitlyTerminate, 0);
     377}
     378
    368379inline Attribute Swizzled() {
    369380    return Attribute(Attribute::KindId::Swizzled, 0);
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5882 r5883  
    11691169    //  actual buffers.  If this isn't the final block, loop back for more multiblock processing.
    11701170    BasicBlock * const segmentDone = b->CreateBasicBlock("SegmentDone");
    1171     if (canTerminateEarly()) {
     1171
     1172    if (hasAttribute(Attribute::KindId::MustExplicitlyTerminate) || hasAttribute(Attribute::KindId::CanTerminateEarly)) {
    11721173        mIsFinal = b->CreateOr(mIsFinal, b->getTerminationSignal());
    11731174    }
     1175
    11741176    b->CreateCondBr(mIsFinal, segmentDone, strideDone);
    11751177
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5856 r5883  
    203203
    204204    std::string getCacheName(const std::unique_ptr<KernelBuilder> & idb) const;
    205 
    206     bool canTerminateEarly() const { return hasAttribute(Attribute::KindId::CanTerminateEarly); }
    207205
    208206protected:
  • icGREP/icgrep-devel/icgrep/kernels/source_kernel.cpp

    r5856 r5883  
    304304, mCodeUnitWidth(codeUnitWidth)
    305305, mFileSizeFunction(nullptr) {
    306     addAttribute(CanTerminateEarly());
     306    addAttribute(MustExplicitlyTerminate());
    307307}
    308308
     
    316316, {Binding{b->getIntNTy(codeUnitWidth)->getPointerTo(), "buffer"}})
    317317, mCodeUnitWidth(codeUnitWidth) {
    318     addAttribute(CanTerminateEarly());
     318    addAttribute(MustExplicitlyTerminate());
    319319}
    320320
     
    329329, mCodeUnitWidth(codeUnitWidth)
    330330, mFileSizeFunction(nullptr) {
    331     addAttribute(CanTerminateEarly());
     331    addAttribute(MustExplicitlyTerminate());
    332332}
    333333
     
    338338    {Binding{cast<PointerType>(type), "fileSource"}, Binding{kb->getSizeTy(), "fileSize"}}, {}, {})
    339339, mCodeUnitWidth(codeUnitWidth) {
    340     addAttribute(CanTerminateEarly());
    341 }
    342 
    343 }
     340    addAttribute(MustExplicitlyTerminate());
     341}
     342
     343}
  • icGREP/icgrep-devel/icgrep/toolchain/pipeline.cpp

    r5882 r5883  
    766766    b->createDoSegmentCall(args);
    767767
    768     if (inputs.empty() || kernel->canTerminateEarly()) {
    769         isFinal = b->CreateOr(isFinal, b->getTerminationSignal());
    770     }
    771     b->setTerminationSignal(isFinal);
     768    if (kernel->hasAttribute(kernel::Attribute::KindId::MustExplicitlyTerminate)) {
     769        isFinal = b->getTerminationSignal();
     770    } else {
     771        if (kernel->hasAttribute(kernel::Attribute::KindId::CanTerminateEarly)) {
     772            isFinal = b->CreateOr(isFinal, b->getTerminationSignal());
     773        }
     774        b->setTerminationSignal(isFinal);
     775    }
     776
    772777  //  b->CallPrintInt(kernel->getName() + "_finished", isFinal);
    773778    final->addIncoming(isFinal, b->GetInsertBlock());
Note: See TracChangeset for help on using the changeset viewer.