Beispiel #1
0
        void doUpdate()
        {
            double netu = avg_netutil.average();

            if (Config.selftuned_bangbang)
            {
                m_rate = (netu > m_target) ? 1.00 : 0.00;
            }
            else
            {
                if (netu > m_target + Config.selftuned_netutil_tolerance)
                {
                    if (m_rate < 1.00)
                    {
                        m_rate += Config.selftuned_rate_delta;
                    }
                }
                if (netu < m_target - Config.selftuned_netutil_tolerance)
                {
                    if (m_rate > 0.00)
                    {
                        m_rate -= Config.selftuned_rate_delta;
                    }
                }

#if DEBUG
                Console.WriteLine("cycle {0}: netu {1}, target {2}, rate {3}",
                                  Simulator.CurrentRound, netu, m_target, m_rate);
#endif
            }
        }
Beispiel #2
0
        void doUpdate()
        {
            double netu = avg_netutil.average();

            if (Config.selftuned_bangbang)
            {
                m_rate = (netu > m_target) ? 1.00 : 0.00;
            }
            else
            {
                // ACT - throttling rate adjustment
                double stepSize = Config.selftuned_rate_delta;
                if (m_rate >= 0.0 && m_rate < 0.7)
                {
                    stepSize = 0.1;
                }
                else if (m_rate >= 0.7 && m_rate < 0.9)
                {
                    stepSize = 0.02;
                }

                if (netu > m_target)
                {
                    if ((m_rate + stepSize) <= Config.selftuned_throttle_rate_cap)
                    {
                        m_rate += Config.selftuned_rate_delta;
                    }
                    else
                    {
                        m_rate = Config.selftuned_throttle_rate_cap;
                    }
                }
                else
                {
                    if ((m_rate - stepSize) >= 0.0)
                    {
                        m_rate -= Config.selftuned_rate_delta;
                    }
                    else
                    {
                        m_rate = 0.0;
                    }
                }

                //if (netu > m_target + Config.selftuned_netutil_tolerance)
                //    if (m_rate < 1.00) m_rate += Config.selftuned_rate_delta;
                //if (netu < m_target - Config.selftuned_netutil_tolerance)
                //    if (m_rate > 0.00) m_rate -= Config.selftuned_rate_delta;

#if DEBUG2
                Console.WriteLine("cycle {0}: netu {1}, target {2}, rate {3}",
                                  Simulator.CurrentRound, netu, m_target, m_rate);
#endif
            }
        }
Beispiel #3
0
        void doUpdate()
        {
            double netu = avg_netutil.average();

            m_starved = false;
            double avg_Q = 0;

            for (int i = 0; i < Config.N; i++)
            {
                double qlen = avg_qlen[i].average();
                avg_Q += qlen;

                double srate = (double)m_starve_total[i] / Config.hotnets_starve_window;

                double starve_thresh = Math.Min(Config.hotnets_starve_max,
                                                Config.hotnets_starve_min + Config.hotnets_starve_scale / m_ipf[i]);

#if DEBUG2
                Console.WriteLine("router {0} starve_thresh {1} starvation rate {2} starved {3}",
                                  i, starve_thresh, srate, srate > starve_thresh);
#endif

                if (srate > starve_thresh)
                {
                    m_starved = true;
                }
            }
            avg_Q /= Config.N;

            for (int i = 0; i < Config.N; i++)
            {
                if (Simulator.CurrentRound > 0)
                {
                    //m_throttled[i] = m_starved && (m_ipf[i] < m_avg_ipf);
                    m_throttled[i] = m_starved && (avg_qlen[i].average() > avg_Q);
                }
                else
                {
                    m_throttled[i] = false;
                }

#if DEBUG
                Console.WriteLine("cycle {0} node {1} ipf {2} (avg {3}) throttle {4}",
                                  Simulator.CurrentRound, i, m_ipf[i], avg_ipf, m_throttled[i]);
#endif
            }

            if (netu > m_target + Config.selftuned_netutil_tolerance)
            {
                if (m_rate < 1.00)
                {
                    m_rate += Config.selftuned_rate_delta;
                }
            }
            if (netu < m_target - Config.selftuned_netutil_tolerance)
            {
                if (m_rate > 0.00)
                {
                    m_rate -= Config.selftuned_rate_delta;
                }
            }

#if DEBUG
            Console.WriteLine("cycle {0}: netu {1}, target {2}, rate {3}",
                              Simulator.CurrentRound, netu, m_target, m_rate);
#endif
        }
Beispiel #4
0
        // Hill climb net utilization to find the maximum throughput = netutil / net latency
        public void climbMountain()
        {
            double _netutil = Simulator.stats.mshrThrottle_netutil.Avg;
            double _netLat  = Simulator.stats.mshrThrottle_flit_net_latency.Avg;

            if (Config.bClimbIPC && Config.bClimbMPKC)
            {
                throw new Exception("Want to climb both IPC and MPKC. WHICH ONE THEN?");
            }
            double _throughput = (Config.bClimbIPC) ? avg_ipc.average() : _netutil / _netLat;

            if (Config.bClimbMPKC)
            {
                _throughput = m_avg_L1_misses.average() * 1000; // MPKC
            }
            double _target = Config.mshrTh_netutil_target;

#if hillClimb
            Console.WriteLine("Last throughput {0} :: New throughput {1}", m_lastThroughput, _throughput);
#endif

            // Record the maximum throughput and target pair
            if (_throughput > m_maxThroughput)
            {
                m_maxThroughput = _throughput;
                m_maxTarget     = _target;
            }
            // If throughput drops too much, reset hill
            else if ((m_maxThroughput - _throughput) / m_maxThroughput > Config.resetHillThreshold)
            {
                m_resetCount++;

                _target = m_maxTarget;
                // If reset count exceeds some threshold, start finding max again
                if (m_resetCount >= 3 && Config.bResetCount)
                {
                    m_maxThroughput = 0.0;
                    m_maxTarget     = 0.0;
                    m_resetCount    = 0;
                    _target         = m_initialTarget;
#if hillClimb
                    Console.WriteLine("Reset to find new max throughput.");
#endif
                }
#if hillClimb
                Console.WriteLine("Reset netutil target {0}:: max th {1}", _target, m_maxThroughput);
#endif
                goto Reset;
            }
            // Make sure it's consecutive reset
            m_resetCount = 0;

            if (_throughput > 0)
            {
                if (_throughput >= m_lastThroughput)
                {
                    if ((_target - Config.decStep) > 0)
                    {
                        _target -= Config.decStep;
                    }
                }
                else if ((m_lastThroughput - _throughput) / m_lastThroughput >= Config.dropThreshold)
                {
                    if ((_target + Config.incStep) < 1.0)
                    {
                        _target += Config.incStep;
                    }
                }
            }
#if hillClimb
            Console.WriteLine("old target {0} -> new target {1}", Config.mshrTh_netutil_target, _target);
#endif

Reset:
            Config.mshrTh_netutil_target = _target;
            m_lastThroughput             = _throughput;
            // Reset for next quantum stats collection
            Simulator.stats.mshrThrottle_netutil.Reset();
            Simulator.stats.mshrThrottle_flit_net_latency.Reset();

            Simulator.stats.netutilTarget.Add(_target);
        }
        void GoClimbAMountain()
        {
            double pkt      = avg_pkt.average();
            double last_pkt = m_lastPkt;

            m_lastPkt = pkt;

            // Too many max reset count
            if (maxResetCount > Config.buffer_selftuned_reset_count)
            {
                max_pkt       = 0.0;
                maxResetCount = 0;
            }

            // Keep track of max point
            if (pkt > max_pkt)
            {
                max_target = m_target;
                max_netu   = avg_netutil.average();
                max_pkt    = pkt;
            }
            else
            {
                // Drop from the maximum recorded threshold. Reset max target
                if (max_pkt > 0 && pkt / max_pkt < Config.buffer_selftuned_max_drop)
                {
                    if (max_netu > max_target)
                    {
                        m_target = max_target;
                    }
                    else
                    {
                        m_target = max_netu;
                    }

                    maxResetCount++;
                    // already adjust the target
                    return;
                }
            }
            maxResetCount = 0;
#if DEBUG
            Console.WriteLine("cycle {0}: last pkt {1}, cur pkt {2}, cur target {3}",
                              Simulator.CurrentRound, last_pkt, pkt, m_target);
#endif

            // Self-Tuned Congestion Networks, Table 1 (p. 6)
            if (last_pkt > 0 && pkt / last_pkt < Config.buffer_selftuned_drop_threshold) // drop > 25% from last period?
            {
                if ((m_target - Config.buffer_selftuned_target_decrease) > 0.0)
                {
                    m_target -= Config.buffer_selftuned_target_decrease;
                }
#if DEBUG
                Console.WriteLine("--> decrease to {0}", (int)m_target);
#endif
            }
            else
            {
                if (m_rate > 0.0) // increase when it's throttling
                {
                    // no significant drop. increase if target is < 1.0.
                    if ((m_target + Config.buffer_selftuned_target_increase) < 1.0)
                    {
                        m_target += Config.buffer_selftuned_target_increase;
                    }
                }
#if DEBUG
                Console.WriteLine("--> increase to {0}", m_target);
#endif
            }
        }