Ignore:
Timestamp:
Jun 21, 2017, 1:23:59 PM (2 years ago)
Author:
cameron
Message:

Fixes for processing rates; multiblock kernel builder

File:
1 edited

Legend:

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

    r5501 r5522  
    5454    std::tie(port, index) = mKernel->getStreamPort(name);
    5555    assert (port == Kernel::Port::Output);
    56     const auto rate = mKernel->getStreamOutput(index).rate;
    57     if (rate.isExact()) {
    58         const auto & refSet = rate.referenceStreamSet();
    59         std::string principalField;
    60         if (refSet.empty()) {
    61             if (mKernel->getStreamInputs().empty()) {
    62                 principalField = mKernel->getStreamOutput(0).name + Kernel::PRODUCED_ITEM_COUNT_SUFFIX;
    63             } else {
    64                 principalField = mKernel->getStreamInput(0).name + Kernel::PROCESSED_ITEM_COUNT_SUFFIX;
    65             }
     56    const auto & rate = mKernel->getStreamOutput(index).rate;
     57    const auto & refSet = rate.referenceStreamSet();
     58    if ((refSet != name) && rate.isExact()) {
     59        Value * principalCount;
     60        std::tie(port, index) = mKernel->getStreamPort(refSet);
     61        if (port == Kernel::Port::Input) {
     62            principalCount = getProcessedItemCount(refSet);
    6663        } else {
    67             std::tie(port, index) = mKernel->getStreamPort(refSet);
    68             if (port == Kernel::Port::Input) {
    69                principalField = refSet + Kernel::PROCESSED_ITEM_COUNT_SUFFIX;
    70             } else {
    71                principalField = refSet + Kernel::PRODUCED_ITEM_COUNT_SUFFIX;
    72             }
    73         }
    74         Value * const principleCount = getScalarField(principalField);
    75         return rate.CreateRatioCalculation(this, principleCount, doFinal);
     64            principalCount = getProducedItemCount(refSet);
     65        }
     66        return rate.CreateRatioCalculation(this, principalCount, doFinal);
    7667    }
    7768    return getScalarField(name + Kernel::PRODUCED_ITEM_COUNT_SUFFIX);
     
    8374    assert (port == Kernel::Port::Input);
    8475    const auto & rate = mKernel->getStreamInput(index).rate;
    85     if (rate.isExact()) {
    86         std::string refSet = rate.referenceStreamSet();
    87         if (refSet.empty()) {
    88             refSet = mKernel->getStreamInput(0).name;
    89         }
    90         Value * const principleCount = getScalarField(refSet + Kernel::PROCESSED_ITEM_COUNT_SUFFIX);
    91         return rate.CreateRatioCalculation(this, principleCount);
     76    const auto & refSet = rate.referenceStreamSet();
     77    if ((refSet != name) && rate.isExact()) {
     78        Value * const principalCount = getProcessedItemCount(refSet);
     79        return rate.CreateRatioCalculation(this, principalCount);
    9280    }
    9381    return getScalarField(name + Kernel::PROCESSED_ITEM_COUNT_SUFFIX);
Note: See TracChangeset for help on using the changeset viewer.