Пример #1
0
		// end Xiyue

        public CPU(Node n)
        {
            m_n = n;
            m_ID = m_n.coord.ID;
            m_ins = new InstructionWindow(this);
            if (m_sync == null)
                m_sync = new Syncer();

			m_group = Simulator.network.workload.getGroup(m_ID);

		    group_count = Simulator.network.workload.GroupCount;

            openTrace();
            m_trace_valid = false;

            m_mshrs = new MSHR[Config.mshrs];

            for (int i = 0; i < Config.mshrs; i++)
            {
                m_mshrs[i].valid = false;
                m_mshrs[i].block = 0;
                m_mshrs[i].write = false;
                m_mshrs[i].pending_write = false;
            }
            mshrs_free = Config.mshrs;
            m_stats_active = true;
            alone_t = ulong.MaxValue;
        }
Пример #2
0
        public CPU(Node n)
        {
            m_n   = n;
            m_ID  = m_n.coord.ID;
            m_ins = new InstructionWindow(this);
            if (m_sync == null)
            {
                m_sync = new Syncer();
            }

            m_group = Simulator.network.workload.getGroup(m_ID);
            //m_thdID = Simulator.network.workload.getThread(m_ID);
            group_count = Simulator.network.workload.GroupCount;

            openTrace();
            m_trace_valid = false;

            m_mshrs = new MSHR[Config.mshrs];

            for (int i = 0; i < Config.mshrs; i++)
            {
                m_mshrs[i].valid         = false;
                m_mshrs[i].block         = 0;
                m_mshrs[i].write         = false;
                m_mshrs[i].pending_write = false;
            }
            mshrs_free = Config.mshrs;

            m_stats_active = true;
            alone_t        = ulong.MaxValue;
        }
Пример #3
0
Файл: CPU.cs Проект: hirous/test
        public CPU(Node n)
        {
            m_n = n;
            m_ID = m_n.coord.ID;
            String filename = Simulator.network.workload.getFile(m_ID);
            //TODO: [Check this] detect if a node is a GPU here
            if(filename.Contains("GAME") || filename.Contains("BENCH")) // GPU
            {
            Console.WriteLine("core:{1} is a GPU", Simulator.CurrentRound, m_ID);
                m_ins = new GPUWindow(this);
                //m_sets = null;
                m_is_GPU = true;
                m_MemoryCoalescing = new MemoryCoalescing();
		/* HWA CODE */
		m_is_HWA = false; 
            }else if( filename.Contains("HWA")) // Accelerator
	       {
		 m_is_GPU = false;
		 m_is_HWA = true;
		 m_ins = new InstructionWindow(this);
		 m_MemoryCoalescing = null;
	       }
	    /* HWA CODE END */
            else // CPU
            {

                m_is_GPU = false;
                m_ins = new InstructionWindow(this);
                m_MemoryCoalescing = null;
		/* HWA CODE */
		m_is_HWA = false;
		/* HWA CODE END */
            }
            if (m_sync == null)
                m_sync = new Syncer();

            m_group = Simulator.network.workload.getGroup(m_ID);
            //m_thdID = Simulator.network.workload.getThread(m_ID);
            group_count = Simulator.network.workload.GroupCount;

            openTrace(m_is_GPU);
            m_trace_valid = false;

            // Allow different mshr size for different CPU
            int mshrSize = Config.mshrs;

            string [] mList = Config.mshrSizeList.Split(',');
            if (mList.Length == Config.N)
                mshrSize = Convert.ToInt32(mList[m_n.coord.ID]);
            else if (mList.Length > 1 && mList.Length < Config.N)
                throw new Exception(String.Format("Invalid mshrs list. Need to match # of nodes: {0}", Config.N));

            Console.WriteLine("Node {0} mshrs {1}", m_n.coord.ID, mshrSize);
            m_mshrs = new MSHR[mshrSize];
            if (Config.mshrsList == null)
                Config.mshrsList = new int[Config.N];
            Config.mshrsList[m_n.coord.ID] = mshrSize;

            for (int i = 0; i < mshrSize; i++)
            {
                m_mshrs[i].valid = false;
                m_mshrs[i].block = 0;
                m_mshrs[i].write = false;
                m_mshrs[i].pending_write = false;
                m_mshrs[i].addr = 0;
                m_mshrs[i].reqTime = 0;
            }
            mshrs_free = mshrSize;

            m_stats_active = true;
            alone_t = ulong.MaxValue;

	    /* HWA CODE */
	    deadLine = 0;
	    deadLineCnt = (ulong)Config.warmup_cyc;
	    deadLineReq = 0;
	    deadLineReqCnt = 0;
	    deadLineReqFetchCnt = 0;
	    deadLinePassNum = 0;
	    hwaStartOffset = 0;

	    if( m_is_HWA || m_is_GPU )
		{
		    string [] deadLineList = Config.hwaDeadLineList.Split(',');
		    if (deadLineList.Length == Config.N)
			deadLine = Convert.ToUInt64(deadLineList[m_n.coord.ID]);
		    else if (deadLineList.Length > 1 && deadLineList.Length < Config.N)
			throw new Exception(String.Format("Invalid deadline list. Need to match # of nodes: {0}", Config.N));

		    Console.WriteLine("Node {0} deadLine {1}", m_n.coord.ID, deadLine );

		    string [] deadLineReqCntList = Config.hwaDeadLineReqCntList.Split(',');
		    if (deadLineReqCntList.Length == Config.N)
			deadLineReq = Convert.ToUInt64(deadLineReqCntList[m_n.coord.ID]);
		    else if (deadLineReqCntList.Length > 1 && deadLineReqCntList.Length < Config.N)
			throw new Exception(String.Format("Invalid deadline list. Need to match # of nodes: {0}", Config.N));

		    Console.WriteLine("Node {0} deadLineReq {1}", m_n.coord.ID, deadLineReq );
		    if( deadLine == 0 )
		    {
			deadLineFromTrace_f = true;
		    }

		    string [] hwaStartOffsetList = Config.hwaStartOffsetList.Split(',');
		    if (hwaStartOffsetList.Length == Config.N)
			hwaStartOffset = Convert.ToUInt64(hwaStartOffsetList[m_n.coord.ID]);
		    else if (hwaStartOffsetList.Length > 1 && hwaStartOffsetList.Length < Config.N)
			throw new Exception(String.Format("Invalid deadline list. Need to match # of nodes: {0}", Config.N));

		    deadLineCnt += hwaStartOffset;

		    Console.WriteLine("Node {0} startOffset {1}", m_n.coord.ID, hwaStartOffset );

		    string [] emergentThList = Config.hwaEmergentThList.Split(',');
		    if (emergentThList.Length == Config.N)
			emergentTh = Convert.ToDouble(emergentThList[m_n.coord.ID]);
//		    else if (emergentThList.Length > 1 && emergentThList.Length < Config.N)
		    else
			emergentTh = -1.0;

		    Console.WriteLine("Node {0} emergent Threshold {1}", m_n.coord.ID, emergentTh );

		    string [] deadLineMultiStartList = Config.hwaDeadLineMultiStartList.Split(',');
		    string [] deadLineMultiNumList = Config.hwaDeadLineMultiNumList.Split(',');
		    string [] deadLineMultiAllList = Config.hwaDeadLineMultiAllList.Split(',');
		    string [] deadLineReqMultiAllList = Config.hwaDeadLineReqMultiAllList.Split(',');
		    if(( deadLineMultiStartList.Length == Config.N) &&
		       ( deadLineMultiNumList.Length == Config.N ))
		    {	
			uint deadLineMultiStartID = Convert.ToUInt32(deadLineMultiStartList[m_n.coord.ID]);
			deadLineMultiNum = Convert.ToUInt32(deadLineMultiNumList[m_n.coord.ID]);
			if( deadLineMultiNum > 1 )
			{
			    deadLineMulti_f = true;
			    deadLineMultiList = new ulong[deadLineMultiNum];
			    deadLineReqMultiList = new ulong[deadLineMultiNum];
			    for( uint d_line_id = deadLineMultiStartID; d_line_id < deadLineMultiStartID + deadLineMultiNum; d_line_id++ )
			    {
				deadLineMultiList[d_line_id-deadLineMultiStartID] = Convert.ToUInt64(deadLineMultiAllList[d_line_id]);
				deadLineReqMultiList[d_line_id-deadLineMultiStartID] = Convert.ToUInt64(deadLineReqMultiAllList[d_line_id]);
			    }
			    deadLine = deadLineMultiList[0];
			    deadLineReq = deadLineReqMultiList[0];
			    deadLineMultiCnt = 0;
			}
		    }
		    
		}
	    /* HWA_CODE END */
        }
Пример #4
0
        public CPU(Node n)
        {
            m_n  = n;
            m_ID = m_n.coord.ID;
            String filename = Simulator.network.workload.getFile(m_ID);

            //TODO: [Check this] detect if a node is a GPU here
            if (filename.Contains("GAME") || filename.Contains("BENCH")) // GPU
            {
                Console.WriteLine("core:{1} is a GPU", Simulator.CurrentRound, m_ID);
                m_ins = new GPUWindow(this);
                //m_sets = null;
                m_is_GPU           = true;
                m_MemoryCoalescing = new MemoryCoalescing();
                /* HWA CODE */
                m_is_HWA = false;
            }
            else if (filename.Contains("HWA"))  // Accelerator
            {
                m_is_GPU           = false;
                m_is_HWA           = true;
                m_ins              = new InstructionWindow(this);
                m_MemoryCoalescing = null;
            }
            /* HWA CODE END */
            else // CPU
            {
                m_is_GPU           = false;
                m_ins              = new InstructionWindow(this);
                m_MemoryCoalescing = null;
                /* HWA CODE */
                m_is_HWA = false;
                /* HWA CODE END */
            }
            if (m_sync == null)
            {
                m_sync = new Syncer();
            }

            m_group = Simulator.network.workload.getGroup(m_ID);
            //m_thdID = Simulator.network.workload.getThread(m_ID);
            group_count = Simulator.network.workload.GroupCount;

            openTrace(m_is_GPU);
            m_trace_valid = false;

            // Allow different mshr size for different CPU
            int mshrSize = Config.mshrs;

            string [] mList = Config.mshrSizeList.Split(',');
            if (mList.Length == Config.N)
            {
                mshrSize = Convert.ToInt32(mList[m_n.coord.ID]);
            }
            else if (mList.Length > 1 && mList.Length < Config.N)
            {
                throw new Exception(String.Format("Invalid mshrs list. Need to match # of nodes: {0}", Config.N));
            }

            Console.WriteLine("Node {0} mshrs {1}", m_n.coord.ID, mshrSize);
            m_mshrs = new MSHR[mshrSize];
            if (Config.mshrsList == null)
            {
                Config.mshrsList = new int[Config.N];
            }
            Config.mshrsList[m_n.coord.ID] = mshrSize;

            for (int i = 0; i < mshrSize; i++)
            {
                m_mshrs[i].valid         = false;
                m_mshrs[i].block         = 0;
                m_mshrs[i].write         = false;
                m_mshrs[i].pending_write = false;
                m_mshrs[i].addr          = 0;
                m_mshrs[i].reqTime       = 0;
            }
            mshrs_free = mshrSize;

            m_stats_active = true;
            alone_t        = ulong.MaxValue;

            /* HWA CODE */
            deadLine            = 0;
            deadLineCnt         = (ulong)Config.warmup_cyc;
            deadLineReq         = 0;
            deadLineReqCnt      = 0;
            deadLineReqFetchCnt = 0;
            deadLinePassNum     = 0;
            hwaStartOffset      = 0;

            if (m_is_HWA || m_is_GPU)
            {
                string [] deadLineList = Config.hwaDeadLineList.Split(',');
                if (deadLineList.Length == Config.N)
                {
                    deadLine = Convert.ToUInt64(deadLineList[m_n.coord.ID]);
                }
                else if (deadLineList.Length > 1 && deadLineList.Length < Config.N)
                {
                    throw new Exception(String.Format("Invalid deadline list. Need to match # of nodes: {0}", Config.N));
                }

                Console.WriteLine("Node {0} deadLine {1}", m_n.coord.ID, deadLine);

                string [] deadLineReqCntList = Config.hwaDeadLineReqCntList.Split(',');
                if (deadLineReqCntList.Length == Config.N)
                {
                    deadLineReq = Convert.ToUInt64(deadLineReqCntList[m_n.coord.ID]);
                }
                else if (deadLineReqCntList.Length > 1 && deadLineReqCntList.Length < Config.N)
                {
                    throw new Exception(String.Format("Invalid deadline list. Need to match # of nodes: {0}", Config.N));
                }

                Console.WriteLine("Node {0} deadLineReq {1}", m_n.coord.ID, deadLineReq);
                if (deadLine == 0)
                {
                    deadLineFromTrace_f = true;
                }

                string [] hwaStartOffsetList = Config.hwaStartOffsetList.Split(',');
                if (hwaStartOffsetList.Length == Config.N)
                {
                    hwaStartOffset = Convert.ToUInt64(hwaStartOffsetList[m_n.coord.ID]);
                }
                else if (hwaStartOffsetList.Length > 1 && hwaStartOffsetList.Length < Config.N)
                {
                    throw new Exception(String.Format("Invalid deadline list. Need to match # of nodes: {0}", Config.N));
                }

                deadLineCnt += hwaStartOffset;

                Console.WriteLine("Node {0} startOffset {1}", m_n.coord.ID, hwaStartOffset);

                string [] emergentThList = Config.hwaEmergentThList.Split(',');
                if (emergentThList.Length == Config.N)
                {
                    emergentTh = Convert.ToDouble(emergentThList[m_n.coord.ID]);
                }
//		    else if (emergentThList.Length > 1 && emergentThList.Length < Config.N)
                else
                {
                    emergentTh = -1.0;
                }

                Console.WriteLine("Node {0} emergent Threshold {1}", m_n.coord.ID, emergentTh);

                string [] deadLineMultiStartList  = Config.hwaDeadLineMultiStartList.Split(',');
                string [] deadLineMultiNumList    = Config.hwaDeadLineMultiNumList.Split(',');
                string [] deadLineMultiAllList    = Config.hwaDeadLineMultiAllList.Split(',');
                string [] deadLineReqMultiAllList = Config.hwaDeadLineReqMultiAllList.Split(',');
                if ((deadLineMultiStartList.Length == Config.N) &&
                    (deadLineMultiNumList.Length == Config.N))
                {
                    uint deadLineMultiStartID = Convert.ToUInt32(deadLineMultiStartList[m_n.coord.ID]);
                    deadLineMultiNum = Convert.ToUInt32(deadLineMultiNumList[m_n.coord.ID]);
                    if (deadLineMultiNum > 1)
                    {
                        deadLineMulti_f      = true;
                        deadLineMultiList    = new ulong[deadLineMultiNum];
                        deadLineReqMultiList = new ulong[deadLineMultiNum];
                        for (uint d_line_id = deadLineMultiStartID; d_line_id < deadLineMultiStartID + deadLineMultiNum; d_line_id++)
                        {
                            deadLineMultiList[d_line_id - deadLineMultiStartID]    = Convert.ToUInt64(deadLineMultiAllList[d_line_id]);
                            deadLineReqMultiList[d_line_id - deadLineMultiStartID] = Convert.ToUInt64(deadLineReqMultiAllList[d_line_id]);
                        }
                        deadLine         = deadLineMultiList[0];
                        deadLineReq      = deadLineReqMultiList[0];
                        deadLineMultiCnt = 0;
                    }
                }
            }
            /* HWA_CODE END */
        }