Changeset 5438 for icGREP/icgrepdevel/icgrep/kernels/interface.cpp
 Timestamp:
 May 9, 2017, 9:57:18 AM (2 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

icGREP/icgrepdevel/icgrep/kernels/interface.cpp
r5436 r5438 40 40 } 41 41 42 unsigned ProcessingRate::calculateRatio(unsigned referenceItems, bool doFinal) const { 43 if (mKind == ProcessingRate::ProcessingRateKind::FixedRatio  mKind == ProcessingRate::ProcessingRateKind::MaxRatio) { 44 if (mRatioNumerator == mRatioDenominator) { 45 return referenceItems; 46 } 47 unsigned strmItems = referenceItems * mRatioNumerator; 48 return (strmItems + mRatioDenominator  1) / mRatioDenominator; 49 } 50 if (mKind == ProcessingRate::ProcessingRateKind::RoundUp) { 51 return ((referenceItems + mRatioDenominator  1) / mRatioDenominator) * mRatioDenominator; 52 } 53 if (mKind == ProcessingRate::ProcessingRateKind::Add1) { 54 return doFinal ? referenceItems + 1 : referenceItems; 55 } 56 report_fatal_error("Processing rate calculation attempted for variable or unknown rate."); 57 } 58 42 59 Value * ProcessingRate::CreateRatioCalculation(IDISA::IDISA_Builder * const b, Value * referenceItems, Value * doFinal) const { 43 60 if (mKind == ProcessingRate::ProcessingRateKind::FixedRatio  mKind == ProcessingRate::ProcessingRateKind::MaxRatio) { … … 65 82 return referenceItems; 66 83 } 67 return nullptr; 84 report_fatal_error("Processing rate calculation attempted for variable or unknown rate."); 85 } 86 87 unsigned ProcessingRate::calculateMaxReferenceItems(unsigned outputItems, bool doFinal) const { 88 if (mKind == ProcessingRate::ProcessingRateKind::FixedRatio) { 89 if (mRatioNumerator == mRatioDenominator) { 90 return outputItems; 91 } 92 return (outputItems / mRatioNumerator) * mRatioDenominator; 93 } 94 if (mKind == ProcessingRate::ProcessingRateKind::RoundUp) { 95 return (outputItems / mRatioDenominator) * mRatioDenominator; 96 } 97 if (mKind == ProcessingRate::ProcessingRateKind::Add1) { 98 return doFinal ? outputItems  1 : outputItems; 99 } 100 report_fatal_error("Inverse processing rate calculation attempted for variable or unknown rate."); 68 101 } 69 102 … … 90 123 return b>CreateSub(outputItems, ConstantInt::get(T, 1)); 91 124 } 92 re turn nullptr;125 report_fatal_error("Inverse processing rate calculation attempted for variable or unknown rate."); 93 126 } 94 127
Note: See TracChangeset
for help on using the changeset viewer.