Ignore:
Timestamp:
May 17, 2018, 3:41:00 PM (11 months ago)
Author:
nmedfort
Message:

Major refactoring of buffer types. Static buffers replace Circular and CircularCopyback?. External buffers unify Source/External?.

File:
1 edited

Legend:

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

    r5985 r6047  
    616616
    617617/** ------------------------------------------------------------------------------------------------------------- *
    618  * @brief verifyBufferSize
    619  ** ------------------------------------------------------------------------------------------------------------- */
    620 bool Kernel::verifyBufferSize(const Binding & binding, const StreamSetBuffer * const buffer) const {
    621     if (LLVM_UNLIKELY(isa<SourceBuffer>(buffer) || isa<ExternalBuffer>(buffer))) {
    622         return true;
    623     }
    624     const ProcessingRate & rate = binding.getRate();
    625     if (requiresCopyBack(binding)) {
    626         const auto minOverflow = ceiling(rate.getUpperBound());
    627         if (LLVM_UNLIKELY(buffer->overflowSize() < minOverflow)) {
    628             report_fatal_error(getName() + ": " + binding.getName() + " requires " +
    629                                std::to_string(minOverflow) + " overflow blocks");
    630         }
    631     } else if (rate.isFixed() || binding.hasAttribute(Attribute::KindId::BlockSize)) {
    632         const auto r = rate.getUpperBound();
    633         if (LLVM_LIKELY(r.denominator() == 1)) {
    634             if (LLVM_UNLIKELY((buffer->getBufferBlocks() % r.numerator())) != 0) {
    635                 report_fatal_error(getName() + ": " + binding.getName() + " requires a multiple of " +
    636                                    std::to_string(r.numerator()) + " buffer blocks");
    637                 return false;
    638             }
    639         } else { // if (b % (n/d) != 0)
    640             const auto b = buffer->getBufferBlocks();
    641             const auto x = (b * r.denominator()) / r.numerator();
    642             if (LLVM_UNLIKELY((b * r.denominator()) != (r.numerator() * x))) {
    643                 report_fatal_error(getName() + ": " + binding.getName() + " requires a multiple of " +
    644                                    std::to_string(r.numerator()) + "/" + std::to_string(r.denominator()) + " buffer blocks");
    645                 return false;
    646             }
    647         }
    648     }
    649     return true;
    650 }
    651 
    652 
    653 /** ------------------------------------------------------------------------------------------------------------- *
    654618 * @brief requiresCopyBack
    655619 ** ------------------------------------------------------------------------------------------------------------- */
Note: See TracChangeset for help on using the changeset viewer.