Ejemplo n.º 1
0
        override public void fetch(Request r, ulong address, bool isWrite, bool isReady) {

            //Console.WriteLine("proc {0}: fetch addr {1:X}, write {2}, isReady {3}",
            //        m_cpu.ID, address, isWrite, isReady);

            if (load < Config.proc.GPUWindowSize) {
                load++;
                addresses[next] = address;
                writes[next] = isWrite;
                ready[next] = isReady;
                requests[next] = r;
                issueT[next] = Simulator.CurrentRound;
                headT[next] = Simulator.CurrentRound;

//                index = next;
                next++;
//                if (!isWrite && !isLoad)
//                    Console.WriteLine("NonMem GPU addr = {0}", address);
//                else
//                    Console.WriteLine("!!!!Mem GPU addr = {0}", address);
                if (!isReady) outstandingReqs++;
                if (next == Config.proc.GPUWindowSize) next = 0;
            }
            else throw new Exception("GPU Instruction Window is full!");

        }
Ejemplo n.º 2
0
        public GPUWindow(CPU cpu) : base(cpu) {
            m_cpu = cpu;
            next = oldest = 0;
            addresses = new ulong[Config.proc.GPUWindowSize];
            writes = new bool[Config.proc.GPUWindowSize];
            requests = new Request[Config.proc.GPUWindowSize];
            issueT = new ulong[Config.proc.GPUWindowSize];
            headT = new ulong[Config.proc.GPUWindowSize];
            ready = new bool[Config.proc.GPUWindowSize];

            for (int i = 0; i < Config.proc.GPUWindowSize; i++) {
                addresses[i] = NULL_ADDRESS;
                writes[i] = false;
                ready[i] = true;
                requests[i] = null;
            }

            outstandingReqs = 0;

            readLog = writeLog = false;

#if LOG
            if (Simulator.sources.soloMode && Simulator.sources.solo.ID == procID)
            {
                sw = new StreamWriter ("insn.log");
                sw.WriteLine("# cycle instrNr req_seq bank netlat injlat");
            }
            else
                sw = null;
#endif

        }
Ejemplo n.º 3
0
		public Interference ()
		{
			_txn = null;
			_request = null;
			_requesterID = 0;
			valid = false;
			interference_cycle = 0;
		}
Ejemplo n.º 4
0
		public Interference (Packet pkt)
		{
			_txn = pkt.txn;
			_mshr = pkt.txn.mshr;
			_request = pkt.request;
			_requesterID = pkt.requesterID;
			valid = true;
			interference_cycle = pkt.intfCycle;
		}
Ejemplo n.º 5
0
 public int getChannel(int input, ulong numChan, Request req)
 {
     int val;
     if(mapping.TryGetValue(input,out val))
         return val;
     else
     {
         int chan = mappingFunction(input, numChan, req);
         mapping.Add(input,chan);
         return chan;
     }
 }
Ejemplo n.º 6
0
        public MemoryRequest(Request req, Simulator.Ready cb)
        {
            this.cb = cb;
            request = req;
            req.beenToMemory = true;

            mapAddr(req.blockAddress, out m_index, out b_index, out r_index, out glob_b_index);

            //scheduling related
            //sched = Config.memory.mem[m_index].sched;
            sched = null;
            isMarked = false;
        }
Ejemplo n.º 7
0
 virtual public int mappingFunction(int input, ulong numChan, Request req)
 {
 //random for now
     return rand.Next((int)numChan);
 }
Ejemplo n.º 8
0
 public void setRequest(Request req)
 {
     _request = req;
     req.setCarrier(this);
 }
Ejemplo n.º 9
0
        public void fetch(Request r, ulong address, bool isWrite, bool isReady) {

            //Console.WriteLine("pr{0}: fetch addr {1:X}, write {2}, isReady {3}, next {4}",
            //        m_cpu.ID, address, isWrite, isReady, next);

            if (load < Config.proc.instWindowSize) {
                load++;
                addresses[next] = address;
                writes[next] = isWrite;
                ready[next] = isReady;
                requests[next] = r;
                issueT[next] = Simulator.CurrentRound;
                headT[next] = Simulator.CurrentRound;
                if (isReady && r != null) r.service();
                //Console.WriteLine("pr{0}: new req in slot {1}: addr {2}, write {3} ready {4}", m_cpu.ID, next, address, isWrite, isReady);
                next++;
                if (!isReady) outstandingReqs++;
                //Console.WriteLine("pr{0}: outstanding reqs now at {1}", m_cpu.ID, outstandingReqs);
                if (next == Config.proc.instWindowSize) next = 0;
            }
            else throw new Exception("Instruction Window is full!");

        }
Ejemplo n.º 10
0
		bool checkWAR (Request req)
		{
			for (int i = 0; i < m_mshrs.Length; i++)
				if (m_mshrs[i].block == req.blockAddress && m_mshrs[i].valid == true)
				{
					if (req.write && !m_mshrs [i].write)  //by Xiyue: Prevent Write After Read hazard???
					  return true;
				}
			return false;

		}
Ejemplo n.º 11
0
Archivo: CPU.cs Proyecto: hirous/test
	/* HWA CODE */
//        void issueReq(Request req)
        void issueReq(Request req, int windowID)
	/* HWA CODE END */
        {
        // Issue Req from a CPU node
            if(!m_is_GPU)
            {
		//Console.WriteLine("core:{3} issueReq: block {0:X}, write {1} at cyc {2}", req.blockAddress, req.write, Simulator.CurrentRound, m_ID);

            for (int i = 0; i < m_mshrs.Length; i++)
                if ((m_mshrs[i].block == req.blockAddress) && m_mshrs[i].valid )
                {
                    if (req.write && !m_mshrs[i].write)
                        m_mshrs[i].pending_write = true;

//                    if (m_ID == 0) Console.WriteLine("P0 issueReq: found req in MSHR {0}", i);

                    return;
                }

//            Console.WriteLine("In issueReq, before resolving MSHR");
            int mshr = -1;
            for (int i = 0; i < m_mshrs.Length; i++)
                if (!m_mshrs[i].valid)
                {
                    mshr = i;
                    break;
                }
            Debug.Assert(mshr != -1);

            mshrs_free--;

            m_mshrs[mshr].valid = true;
            m_mshrs[mshr].block = req.blockAddress;
            m_mshrs[mshr].write = req.write;

            // Use these to determine if any mem req returns while there are other L2 misses out there
            m_mshrs[mshr].reqTime = Simulator.CurrentRound;
            m_mshrs[mshr].addr = req.address;

//	    if( m_is_HWA ) Console.WriteLine("ID:{2} Issue Req addr:{0:X}, write:{1}", req.address, req.write,ID);
//            Console.WriteLine("In issueReq, after resolving MSHR");
            _issueReq(mshr, req.address, req.write, Simulator.CurrentRound, windowID);
            }
        // Issue Req from a GPU node
            else
            {
                int mem_slice = Simulator.controller.mapMC(req.requesterID, req.address >> Config.cache_block);
                m_MemoryCoalescing.issueReq(mem_slice,req, delegate() { reqDone(req.address, -1, req.write);});
            }
        }
Ejemplo n.º 12
0
        /*
        public void receivePacket(MemoryPacket p)
        {
            Simulator.Ready cb;
            
            //receive WB or request from memory        
            if(p.type == MemoryRequestType.RD)
            {
                cb = delegate()
                    {
                        MemoryPacket mp = new MemoryPacket(
                            p.request, p.block,
                            MemoryRequestType.DAT, p.dest, p.src);

                        node.queuePacket(mp);
                    };                
            }
            else
            {
                // WB don't need a callback
                cb = delegate(){};
            }
                        
            access(p.request, cb);
        }
        */

        public void access(Request req, Simulator.Ready cb)
        {
            MemoryRequest mreq = new MemoryRequest(req, cb);
            sched.issue_req(mreq);
            bank[mreq.b_index].outstandingReqs_perapp[req.requesterID]++;
            bank[mreq.b_index].outstandingReqs++;
        }
Ejemplo n.º 13
0
        // Called by CPU.cs to issue a request to the MemoryCoalescing
        // This just places the request in the appropriate client queue
        // This cannot be used when we model the network
        public void issueReq(int targetID, Request req, Simulator.Ready cb)
        {
//            Console.WriteLine("In MemoryCoalescing, issueReq is called requester {0}, addr = {1} at cycle {2}", req.requesterID, req.address, Simulator.CurrentRound);
            MemoryRequest mreq = new MemoryRequest(req, cb);
            mreq.from_GPU = true;
            //Console.WriteLine("Get a GPU Request {0}", req.from_GPU);
            int c = (int)req.client;
            int w = req.write?1:0;
            if(Config.useMemoryCoalescing)
            {
//            Console.WriteLine("In MemoryCoalescing, enqueue to the client queue requester {0}, addr = {1} at cycle {2}", req.requesterID, req.address, Simulator.CurrentRound);
                clientQueue[c,w].Enqueue(new Tuple3(targetID,Simulator.CurrentRound,mreq));
            }
            else
            {
                bool l1hit = false, l1upgr = false, l1ev = false, l1wb = false;
                bool l2access = false, l2hit = false, l2ev = false, l2wb = false, c2c = false;
                Simulator.network.cache.access(req.requesterID, req.address, req.write, cb, out l1hit, out l1upgr, out l1ev, out l1wb, out l2access, out l2hit, out l2ev, out l2wb, out c2c);
            }
        }
Ejemplo n.º 14
0
        void issueReq(Request req)
        {
//            if (m_ID == 0) Console.WriteLine("P0 issueReq: block {0:X}, write {1} at cyc {2}", req.blockAddress, req.write, Simulator.CurrentRound);

            for (int i = 0; i < m_mshrs.Length; i++)
                if (m_mshrs[i].block == req.blockAddress)
                {
                    if (req.write && !m_mshrs[i].write)
                        m_mshrs[i].pending_write = true;

//                    if (m_ID == 0) Console.WriteLine("P0 issueReq: found req in MSHR {0}", i);

                    return;
                }

            int mshr = -1;
            for (int i = 0; i < m_mshrs.Length; i++)
                if (!m_mshrs[i].valid)
                {
                    mshr = i;
                    break;
                }
            Debug.Assert(mshr != -1);

            mshrs_free--;

            m_mshrs[mshr].valid = true;
            m_mshrs[mshr].block = req.blockAddress;
            m_mshrs[mshr].write = req.write;

            _issueReq(mshr, req.address, req.write);
        }
Ejemplo n.º 15
0
		// construct a multicast packet
		// TODO: it may be merged in network. 
		public Packet(Request request, ulong block, int nrOfFlits, Coord source, List <Coord> _destList)
		{
			_request = request;
			if (_request != null)
				_request.beenToNetwork = true;
			_block = block; // may not come from request (see above)
			_src = source;
			destList = new List <Coord>(_destList);
			nrMCPacket = _destList.Count;
			nrArrivedMCPacket = 0;
			nrOfArrivedFlitsMC = new int [Config.N]; // for safety, although mc_degree may not reach N
			creationTimeMC = new ulong[Config.N]; // index the destination node ID
			if (request != null)
				request.setCarrier (this);
			requesterID = -1;
			hsFlowID = -1;
			mc = true;
			gather = false;
			initialize (Simulator.CurrentRound, nrOfFlits);// Flitization of each packet;
		}
Ejemplo n.º 16
0
        public MemoryRequest(Request req, Simulator.Ready cb)
        {
            this.cb = cb;
            request = req;
            isWrite = req.write;
            req.beenToMemory = true;

//            mapAddr(req.blockAddress, out shift_row, out mem_index, out channel_index,
//                    out rank_index, out bank_index, out row_index);
            mapAddr(req.requesterID, req.blockAddress, out shift_row, out mem_index, out channel_index,
                    out rank_index, out bank_index, out row_index);

//	    Console.WriteLine("Address:{0:x}, shift_row:{1:x}", req.address, shift_row );

            //scheduling related
            isMarked = false;
	    
	    /* HWA CODE */ // Bug Fix??
	    this.from_GPU = req.from_GPU;
        }
Ejemplo n.º 17
0
		// regular packet
		public Packet(Request request, ulong block, int nrOfFlits, Coord source, Coord dest)
     		   {
          		  _request = request;
            if (_request != null)
                _request.beenToNetwork = true;
            _block = block; // may not come from request (see above)
            _src = source;
            _dest = dest;
            if (request != null)
                request.setCarrier(this);
            requesterID = -1;
			mc = false;
			gather = false;
            initialize(Simulator.CurrentRound, nrOfFlits);
        }
Ejemplo n.º 18
0
		int allocMSHR(Request req)
        {
			
            int mshr = -1;
            for (int i = 0; i < m_mshrs.Length; i++)
                if (!m_mshrs[i].valid)
                {
                    mshr = i;
                    break;
                }
			
            Debug.Assert(mshr != -1);

            mshrs_free--;

            m_mshrs[mshr].valid = true;
            m_mshrs[mshr].block = req.blockAddress;
            m_mshrs[mshr].write = req.write;

			return mshr;

        }
Ejemplo n.º 19
0
		//by Xiyue:

		// TODO: this is the packet generated by the processor
		public Packet(Request request, ulong block, int nrOfFlits, Coord source, Coord dest, CmpCache_Txn txn, bool critical)
		{
			_request = request;
			if (_request != null)
				_request.beenToNetwork = true;
			_block = block; // may not come from request (see above)
			_src = source;
			_dest = dest;
			_intfCycle = 0;
			if (request != null)
				request.setCarrier(this);
			requesterID = -1;
			initialize(Simulator.CurrentRound, nrOfFlits);
			this.txn = txn;
			this.critical = critical;
			this.rank = Controller_QoSThrottle.app_rank[txn.node];
			this.app_type = Controller_QoSThrottle.app_type[txn.node];
			this.most_mem_inten = Controller_QoSThrottle.most_mem_inten[txn.node];
			this.slowdown = Simulator.stats.estimated_slowdown [txn.node].LastPeriodValue; // TODO: by Xiyue: this is equivalent to have N ranking levels.
		}
Ejemplo n.º 20
0
        void access_mem(int requestor, ulong addr, bool write, Simulator.Ready cb)
        {
            Request req = new Request(requestor, addr, write);

            int node = map_addr_mem(requestor, addr);
            Simulator.network.nodes[node].mem.access(req, cb);
        }
Ejemplo n.º 21
0
Archivo: Mem.cs Proyecto: hirous/test
 public void access(Request req, Simulator.Ready cb)
 {
     MemoryRequest mreq = new MemoryRequest(req, cb);
     ReceivePacket(mreq);
 }