コード例 #1
0
        public static void tick()
        {
            RowStat.AccessInfo temp;
            ulong rowkey;

            rowkey = RowStat.KeyGen(Row_Migration_Policies.target_req);

            if (!RowStat.NVMDict.ContainsKey(rowkey))
            {
                return;
            }

            temp = RowStat.NVMDict[rowkey];

            if (temp.addlist)
            {
                return;
            }

            if ((temp.ReadMiss + temp.WriteMiss * weight > MissThresh) && (!Migration.migrationlist.Contains(rowkey)))
            {
                Migration.migrationlist.Add(rowkey);
                Migration.migrationlistPID.Add(temp.pid);
                migration_num++;
                temp.addlist            = true;
                RowStat.NVMDict[rowkey] = temp;
            }
        }
コード例 #2
0
        private void MigrationDecision()
        {        //Determine which row should be migrated and send row numbers to Migration
            Migration.migrationlist.Clear();
            Migration.migrationlistPID.Clear();
            RowStat.UpdateAccessPerInterval();
            //Console.WriteLine("--------------Majid");
            //Console.WriteLine(Config.proc.cache_insertion_policy);
            switch (Config.proc.cache_insertion_policy)
            {
            case "RBLA":
                RBLA.decision();
                break;

            case "PFA":
                if (Cycles == Interval)
                {
                    PFA.assignE0();
                }
                else
                {
                    PFA.decision();
                }
                break;

            default:
                Console.WriteLine("Row Migration Policy Error");
                break;
            }
        }
コード例 #3
0
        public static void tick()
        {
            RowStat.AccessInfo temp;
            ulong rowkey;

            rowkey = RowStat.KeyGen(Row_Migration_Policies.target_req);

            if (!RowStat.NVMDict.ContainsKey(rowkey))
            {
                return;
            }

            temp = RowStat.NVMDict[rowkey];

            if (temp.addlist)
            {
                return;
            }

            //               double utility = (temp.ReadMiss * RowStat.t_rd_miss_diff * temp.ReadMLPnum + weight * temp.WriteMiss * RowStat.t_wr_miss_diff * temp.WriteMLPnum)  * ThreadWeight[temp.pid];

            double utility = (temp.ReadMiss * diff_read_cost * temp.ReadMLPnum + temp.WriteMiss * diff_write_cost * temp.WriteMLPnum) * ThreadWeight[temp.pid];



            //               if (temp.effectiveness > RowStat.eff[temp.pid])
            if ((utility > eff_thresh) && (!Migration.migrationlist.Contains(rowkey)))
            {
                Migration.migrationlist.Add(rowkey);
                Migration.migrationlistPID.Add(temp.pid);
                migration_num++;
                temp.addlist            = true;
                RowStat.NVMDict[rowkey] = temp;
            }
        }
コード例 #4
0
        public int tick()
        {        //Clock in RBLA, make decision when Cycles is multiples of Interval
            //If Migration



            if (target)
            {
                //	Console.WriteLine("Info------------");
                //	Console.WriteLine(target_req.addr.bid);
                //Console.WriteLine(target_req.addr.cid);
                BankStat bank_stat = Stat.banks2[target_req.addr.cid, target_req.addr.rid, target_req.addr.bid];

                //Console.WriteLine(bank_stat.access.Count);
            }



            if (Cycles == 0)
            {
                if (Config.proc.cache_insertion_policy == "RBLA")
                {
                    RBLA.initialize();
                }
                else if (Config.proc.cache_insertion_policy == "PFA")
                {
                    PFA.initialize();
                }
            }
            else
            {
                if (Cycles % Interval == 0)
                {
                    MigrationDecision();
                }
                if (target)
                {
                    target = false;
                    if (Config.proc.cache_insertion_policy == "RBLA")
                    {
                        RBLA.tick();
                    }
                    else if (Config.proc.cache_insertion_policy == "PFA" && Cycles >= Interval)
                    {
                        PFA.tick();
                    }
                }
                if (Cycles % Interval == 0)
                {
                    RowStat.ClearPerInterval();
                }
            }
            Migration.tick();
            Cycles++;
            return(0);
        }
コード例 #5
0
        public int tick()
        {        //Clock in RBLA, make decision when Cycles is multiples of Interval
                 //If Migration

            if (Cycles == 0)
            {
                if (Config.proc.cache_insertion_policy == "RBLA")
                {
                    RBLA.initialize();
                }
                else if (Config.proc.cache_insertion_policy == "PFA")
                {
                    PFA.initialize();
                }
                else if (Config.proc.cache_insertion_policy == "AC")
                {
                    AC.initialize();
                }
            }
            else
            {
                if (Cycles % Interval == 0)
                {
                    MigrationDecision();
                }

                if (target)
                {
                    target = false;
                    if (Config.proc.cache_insertion_policy == "RBLA")
                    {
                        RBLA.tick();
                    }
                    else if (Config.proc.cache_insertion_policy == "PFA" && Cycles >= Interval)
                    {
                        PFA.tick();
                    }
                    else if (Config.proc.cache_insertion_policy == "AC" && Cycles >= Interval)
                    {
                        AC.tick();
                    }
                }

                if (Cycles % Interval == 0)
                {
                    RowStat.ClearPerInterval();
                }
            }
            Migration.tick();
            Cycles++;
            return(0);
        }
コード例 #6
0
        public static void tick()
        {
            //Console.WriteLine("AC policy tick() called\n");
            RowStat.AccessInfo temp;
            ulong rowkey;

            rowkey = RowStat.KeyGen(Row_Migration_Policies.target_req);

            if (!RowStat.NVMDict.ContainsKey(rowkey))
            {
                return;
            }

            temp = RowStat.NVMDict[rowkey];

            if (temp.addlist)
            {
                return;
            }

            uint   c_value = temp.counter;
            double c_n     = Math.Pow(2, c_value);
            double c_n1    = Math.Pow(2, c_value + 1);

            int    rand_num = randm.Next(0, 99);
            double prob_val = 100 / (c_n1 - c_n);

            if (rand_num < prob_val)
            {
                temp.counter++;
            }

            c_value = temp.counter;
            //double utility = (temp.ReadMiss * diff_read_cost * temp.ReadMLPnum + temp.WriteMiss * diff_write_cost * temp.WriteMLPnum)  * ThreadWeight[temp.pid];


            if ((c_value >= 7) && (!Migration.migrationlist.Contains(rowkey)))
            {
                Migration.migrationlist.Add(rowkey);
                Migration.migrationlistPID.Add(temp.pid);
                migration_num++;
                temp.addlist            = true;
                temp.counter            = 0;
                RowStat.NVMDict[rowkey] = temp;
            }
        }
コード例 #7
0
        new public void __dequeue_req(Req req)
        {
            req.ts_departure = cycles;
            Dbg.Assert(req.ts_departure - req.ts_arrival > 0);

            if ((!req.migrated_request) && (Config.proc.cache_insertion_policy == "PFA"))
            {
                RowStat.UpdateMLP(RowStat.DramDict, req);
                Measurement.mem_num_dec(req);
//                   Measurement.DramServiceTimeUpdate (req);
//                   Measurement.DramCoreReqNumDec (req);
            }
            if (Config.proc.cache_insertion_policy == "PFA")
            {
                Measurement.DramCoreReqNumDec(req);
            }

            /*            if (Config.proc.cache_insertion_policy == "RBLAMLP" || Config.proc.cache_insertion_policy == "PFA")
             *                Measurement.DramSetCorePrevRowid (req);
             */
            //sched
            meta_mctrl.dequeue_req(req);

            //load stat management
            if (!req.migrated_request)
            {
                if (req.type == ReqType.RD)
                {
                    rload--;
                    rload_per_proc[req.pid]--;
                    rload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid]--;
                    Dbg.Assert(rload >= 0);
                    Dbg.Assert(rload_per_proc[req.pid] >= 0);
                    Dbg.Assert(rload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid] >= 0);
                }
                else
                {
                    wload--;
                    wload_per_proc[req.pid]--;
                    wload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid]--;
                    Dbg.Assert(wload >= 0);
                    Dbg.Assert(wload_per_proc[req.pid] >= 0);
                    Dbg.Assert(wload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid] >= 0);
                    //                RequestPool.CacheWrite--;
                }
            }
            else
            {
                if (req.type == ReqType.RD)
                {
                    rload--;
                }
                else
                {
                    wload--;
                }
            }

/*            //dequeue proper
 *          if (req.type == ReqType.RD) {
 *              //traverse crossbar
 *              //Sim.xbar.enqueue(req);
 *
 *              Callback cb = req.cache_callback;
 *              cb(req);
 *
 *
 *          }
 *          else {
 *              bool removeok = mctrl_writeq.Remove(req);
 *              Dbg.Assert(removeok);
 *              req.latency = (int)(req.ts_departure - req.ts_arrival);
 *
 *              Callback cb = req.cache_callback;
 *              cb(req);
 *
 *
 *              RequestPool.enpool(req);
 *         }*/


//yang:
            //dequeue proper
            if (req.type == ReqType.RD)
            {
                Callback cb = req.cache_callback;
                cb(req);
            }
            else
            {
                bool removeok = mctrl_writeq.Remove(req);
                Dbg.Assert(removeok);
                req.latency = (int)(req.ts_departure - req.ts_arrival);
                Callback cb = req.cache_callback;
                cb(req);

                /*            Callback cb1 = req.callback;
                 *          if (cb1!=null)
                 *          {
                 *             Console.WriteLine("Position3");
                 *                  RequestPool.CacheWrite--;
                 *          }*/
            }
        }
コード例 #8
0
        new public void tick()
        {
            //must be the very first thing that's done
            cycles++;
            meta_mctrl.tick(cid);
            wbthrottle.tick();
            mwbmode.tick(cid);

            //load stats
            for (int p = 0; p < Config.N; p++)
            {
                //read load
                if (rload_per_proc[p] > 0)
                {
                    Stat.mctrls2[cid].rbinaryloadtick_per_proc[p].Collect();
                }
                Stat.mctrls2[cid].rloadtick_per_proc[p].Collect(rload_per_proc[p]);

                //write load
                if (wload_per_proc[p] > 0)
                {
                    Stat.mctrls2[cid].wbinaryloadtick_per_proc[p].Collect();
                }
                Stat.mctrls2[cid].wloadtick_per_proc[p].Collect(wload_per_proc[p]);
            }

            //busy/idle stats
            if (rload > 0)
            {
                read_loaded_time++;
                if (read_unloaded_time > 0)
                {
                    //Stat.mctrls2[cid].read_unloaded_time.Collect(read_unloaded_time);
                }
                read_unloaded_time = 0;
            }
            else
            {
                read_unloaded_time++;
                if (read_loaded_time > 0)
                {
                    //Stat.mctrls2[cid].read_loaded_time.Collect(read_loaded_time);
                }
                read_loaded_time = 0;
            }

            /*** writeback mode ***/
            update_wb_mode();

            /*
             * if (wb_mode && cid == 0) {
             *  Console.WriteLine("==={0}==============================================", cycles);
             *  Console.WriteLine("Reads to Drain:  {0}", reads_to_drain);
             *  Console.WriteLine("Writes Serviced: {0}", ((DecoupledWBFullServeN) mwbmode).serve_cnt[0]);
             *  uint r = 0;
             *  for (uint b = 0; b < bmax; b++) {
             *      Console.Write("{0}\t", b);
             *      foreach (Cmd cmd in cmdqs[r, b]) {
             *          Console.Write("{0} {1}\t", cmd.type.ToString(), can_schedule_cmd(cmd));
             *      }
             *      Console.WriteLine();
             *  }
             * }
             */

            /*** clock factor ***/
            if (cycles % Config.mem.clock_factor != 0)
            {
                return;
            }

            if ((Config.proc.cache_insertion_policy == "PFA") && (cycles % (6 * Config.mem.clock_factor) == 0))
            {
                int indexi, indexj;
                for (indexi = 0; indexi < rmax; indexi++)
                {
                    for (indexj = 0; indexj < bmax; indexj++)
                    {
                        Measurement.read_MLP_cal(ref readqs[indexi, indexj]);
                        Measurement.write_MLP_cal(ref writeqs[indexi, indexj]);
                        Measurement.MLP_cal(ref inflightqs[indexi, indexj]);
                    }
                }
            }

            /*** serve completed request ***/
            if (bus_q.Count > 0 && bus_q[0].ts <= cycles)
            {
                MemAddr addr = bus_q[0].addr;
                bus_q.RemoveAt(0);

                List <Req> inflight_q = inflightqs[addr.rid, addr.bid];


                Dbg.Assert(inflight_q.Count > 0);

                Dbg.Assert(addr == inflight_q[0].addr);
                Req req = inflight_q[0];
                inflight_q.RemoveAt(0);

                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    Measurement.DramBankPidDeUpdate(req);
                }

                dequeue_req(req);
            }

            Cmd best_cmd = find_best_cmd();
            Req best_req = find_best_req();

            //nothing to issue
            if (best_cmd == null && best_req == null)
            {
                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    CheckBusConflict();
                }
                return;
            }

            //arbitrate between command and request
            bool is_issue_req = false;

            if (best_req != null && best_cmd == null)
            {
                is_issue_req = true;
            }
            else if (best_req == null && best_cmd != null)
            {
                is_issue_req = false;
            }
            else
            {
                if (best_req == __better_req(best_cmd.req, best_req))
                {
                    is_issue_req = true;
                }
                else
                {
                    is_issue_req = false;
                }
            }

            //issue command or request
            if (is_issue_req)
            {
                if (!best_req.migrated_request)
                {
                    if (Config.proc.cache_insertion_policy == "RBLA")
                    {
                        RowStat.UpdateDict(RowStat.DramDict, best_req, this);
                    }
                    else if (Config.proc.cache_insertion_policy == "PFA")
                    {
                        RowStat.UpdateDict(RowStat.DramDict, best_req, this);
//                       Measurement.DramBankPidEnUpdate(best_req);
                    }
//                    if (Config.proc.cache_insertion_policy == "PFA")
//                        Measurement.DramBankPidEnUpdate(best_req);
                }

                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    Measurement.DramBankPidEnUpdate(best_req);
                }

                issue_req(best_req);
            }
            else
            {
                issue_cmd(best_cmd);
            }

            if (Config.proc.cache_insertion_policy == "PFA")
            {
                CheckBusConflict();
            }
        }
コード例 #9
0
        public void __dequeue_req(Req req)
        {
            req.ts_departure = cycles;
            Dbg.Assert(req.ts_departure - req.ts_arrival > 0);


            if (!req.migrated_request)
            {
                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    RowStat.UpdateMLP(RowStat.NVMDict, req);
                    Measurement.mem_num_dec(req);
//                    Measurement.NVMServiceTimeUpdate (req);
//                    Measurement.NVMCoreReqNumDec (req);
                    Row_Migration_Policies.target     = true;
                    Row_Migration_Policies.target_req = req;
                }
                else if (Config.proc.cache_insertion_policy == "RBLA")
                {
                    Row_Migration_Policies.target     = true;
                    Row_Migration_Policies.target_req = req;
                }
            }
            if (Config.proc.cache_insertion_policy == "PFA")
            {
                Measurement.NVMCoreReqNumDec(req);
            }

/*            if (Config.proc.cache_insertion_policy == "PFA")
 *          {
 *                 Measurement.NVMSetCorePrevRowid (req);
 *          }
 */
            //sched
            meta_mctrl.dequeue_req(req);

            //load stat management
            if (!req.cache_wb)
            {
                if (req.type == ReqType.RD)
                {
                    rload--;
                    rload_per_proc[req.pid]--;
                    rload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid]--;
                    Dbg.Assert(rload >= 0);
                    Dbg.Assert(rload_per_proc[req.pid] >= 0);
                    Dbg.Assert(rload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid] >= 0);
                }
                else
                {
                    wload--;
                    wload_per_proc[req.pid]--;
                    wload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid]--;
                    Dbg.Assert(wload >= 0);
                    Dbg.Assert(wload_per_proc[req.pid] >= 0);
                    Dbg.Assert(wload_per_procrankbank[req.pid, req.addr.rid, req.addr.bid] >= 0);
                }
            }
            else
            {
                if (req.type == ReqType.RD)
                {
                    rload--;
                }
                else
                {
                    wload--;
                }
            }

/*           //dequeue proper
 *         if (req.type == ReqType.RD) {
 *              //traverse crossbar
 *            Sim.xbar.enqueue(req);
 *
 *              //cache
 *             Sim.caches[Sim.get_cache(req.pid)].meta_insert(req);
 *          }
 *          else {
 *              bool removeok = mctrl_writeq.Remove(req);
 *              Dbg.Assert(removeok);
 *              req.latency = (int)(req.ts_departure - req.ts_arrival);
 *
 *              Callback cb = req.callback;
 *              cb(req);
 *
 *              if (!req.cache_wb) {
 *                  //cache
 *                  switch (Config.proc.cache_write_policy) {
 *                      case "WriteThrough":
 *                          // do nothing
 *                          break;
 *                      case "WriteBack":
 *                            Sim.caches[Sim.get_cache(req.pid)].meta_insert(req);
 *                          break;
 *                  }
 *              }
 *              else
 *                  RequestPool.enpool(req);
 *          }
 */


            if (req.type == ReqType.RD)
            {
                if (!Sim.caches[Sim.get_cache(req.pid)].is_cached(req))
                {
                    Sim.caches[Sim.get_cache(req.pid)].meta_insert(req);
                }
                //      if (req.callback != null)
                Sim.xbar.enqueue(req);
                //      else
                //           RequestPool.enpool(req);
            }
            else
            {
                bool removeok = mctrl_writeq.Remove(req);
                Dbg.Assert(removeok);
                req.latency = (int)(req.ts_departure - req.ts_arrival);
                Callback cb = req.callback;
                if (!req.cache_wb)
                {
                    switch (Config.proc.cache_write_policy)
                    {
                    case "WriteThrough":
                        break;

                    case "WriteBack":
                        if (!Sim.caches[Sim.get_cache(req.pid)].is_cached(req))
                        {
                            Sim.caches[Sim.get_cache(req.pid)].meta_insert(req);
                        }
                        break;
                    }
                    if (cb != null)
                    {
                        cb(req);
                    }
                    //           else
                    //             RequestPool.enpool(req);
                }
                else
                {
                    RequestPool.enpool(req);
                }
            }
        }