Ignore:
Timestamp:
Apr 24, 2018, 2:57:34 PM (17 months ago)
Author:
nmedfort
Message:

Restructured MultiBlock? kernel. Removal of Swizzled buffers. Inclusion of PopCount? rates / non-linear access. Modifications to several kernels to better align them with the kernel and pipeline changes.

File:
1 edited

Legend:

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

    r5782 r5985  
    2828
    2929    enum class KindId {
    30         Fixed, Bounded, Unknown, Relative, PopCount
     30        Fixed, Bounded, Unknown, Relative, PopCount, NegatedPopCount
    3131    };
    3232
     
    3636
    3737    RateValue getRate() const {
    38         assert (isFixed() || isRelative());
    3938        return mLowerBound;
    4039    }
    4140
    4241    RateValue getLowerBound() const {
    43         assert (isFixed() || isBounded() || isUnknown());
    4442        return mLowerBound;
    4543    }
    4644
    4745    RateValue getUpperBound() const {
    48         assert (isFixed() || isBounded());
    49         assert (isFixed() ? mUpperBound == mLowerBound : mUpperBound > mLowerBound);
    5046        return mUpperBound;
    5147    }
    5248
    5349    const std::string & getReference() const {
    54         assert (isRelative());
     50        assert (hasReference());
    5551        return mReference;
    5652    }
     
    7268    }
    7369
     70    bool isNegatedPopCount() const {
     71        return mKind == KindId::NegatedPopCount;
     72    }
     73
    7474    bool isUnknown() const {
    7575        return mKind == KindId::Unknown;
    7676    }
    7777
     78    bool hasReference() const {
     79        return isRelative() || isPopCount() || isNegatedPopCount();
     80    }
     81
    7882    bool isDerived() const {
    79         return isRelative(); // isFixed() ||
     83        return isRelative();
    8084    }
    8185
     
    9296    friend ProcessingRate UnknownRate(const unsigned);
    9397    friend ProcessingRate RateEqualTo(std::string);
    94     friend ProcessingRate PopcountOf(std::string, const ProcessingRate::RateValue);
     98    friend ProcessingRate PopcountOf(std::string);
     99    friend ProcessingRate PopcountOfNot(std::string);
    95100
    96101    ProcessingRate(ProcessingRate &&) = default;
     
    99104
    100105protected:   
    101     ProcessingRate(const KindId k, const unsigned n, const unsigned m, const std::string && ref = "") : mKind(k), mLowerBound(n), mUpperBound(m), mReference(ref) {}
    102     ProcessingRate(const KindId k, const RateValue n, const RateValue m, const std::string && ref = "") : mKind(k), mLowerBound(n), mUpperBound(m), mReference(ref) {}
     106    ProcessingRate(const KindId k, const RateValue lb, const RateValue ub, const std::string && ref = "")
     107    : mKind(k)
     108    , mLowerBound(lb)
     109    , mUpperBound(ub)
     110    , mReference(ref) {
     111        assert (isFixed() ? mUpperBound == mLowerBound : (isBounded() ? mUpperBound > mLowerBound :  mUpperBound >= mLowerBound));
     112    }
    103113private:
    104     KindId mKind;
    105     RateValue mLowerBound;
    106     RateValue mUpperBound;
    107     std::string mReference;
     114    const KindId mKind;
     115    const RateValue mLowerBound;
     116    const RateValue mUpperBound;
     117    const std::string mReference;
    108118};
    109119
     
    131141
    132142inline ProcessingRate RateEqualTo(std::string ref) {
    133     return ProcessingRate(ProcessingRate::KindId::Relative, 1, 0, std::move(ref));
     143    return ProcessingRate(ProcessingRate::KindId::Relative, 1, 1, std::move(ref));
    134144}
    135145
    136 inline ProcessingRate PopcountOf(std::string ref, const ProcessingRate::RateValue ratio = ProcessingRate::RateValue{1}) {
    137     return ProcessingRate(ProcessingRate::KindId::PopCount, ratio, ProcessingRate::RateValue{0}, std::move(ref));
     146inline ProcessingRate PopcountOf(std::string ref) {
     147    return ProcessingRate(ProcessingRate::KindId::PopCount, 0, 1, std::move(ref));
     148}
     149
     150inline ProcessingRate PopcountOfNot(std::string ref) {
     151    return ProcessingRate(ProcessingRate::KindId::NegatedPopCount, 0, 1, std::move(ref));
    138152}
    139153
Note: See TracChangeset for help on using the changeset viewer.