local_memory_pipeline.hh revision 11308
16145Snate@binkert.org/* 26145Snate@binkert.org * Copyright (c) 2014-2015 Advanced Micro Devices, Inc. 36145Snate@binkert.org * All rights reserved. 46145Snate@binkert.org * 56145Snate@binkert.org * For use for simulation and test purposes only 66145Snate@binkert.org * 76145Snate@binkert.org * Redistribution and use in source and binary forms, with or without 86145Snate@binkert.org * modification, are permitted provided that the following conditions are met: 96145Snate@binkert.org * 106145Snate@binkert.org * 1. Redistributions of source code must retain the above copyright notice, 116145Snate@binkert.org * this list of conditions and the following disclaimer. 126145Snate@binkert.org * 136145Snate@binkert.org * 2. Redistributions in binary form must reproduce the above copyright notice, 146145Snate@binkert.org * this list of conditions and the following disclaimer in the documentation 156145Snate@binkert.org * and/or other materials provided with the distribution. 166145Snate@binkert.org * 176145Snate@binkert.org * 3. Neither the name of the copyright holder nor the names of its contributors 186145Snate@binkert.org * may be used to endorse or promote products derived from this software 196145Snate@binkert.org * without specific prior written permission. 206145Snate@binkert.org * 216145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 226145Snate@binkert.org * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 236145Snate@binkert.org * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 246145Snate@binkert.org * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 256145Snate@binkert.org * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 266145Snate@binkert.org * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 276145Snate@binkert.org * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 286145Snate@binkert.org * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 297832Snate@binkert.org * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 307832Snate@binkert.org * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 318645Snilay@cs.wisc.edu * POSSIBILITY OF SUCH DAMAGE. 327054Snate@binkert.org * 338232Snate@binkert.org * Author: Sooraj Puthoor 346154Snate@binkert.org */ 358229Snate@binkert.org 366154Snate@binkert.org#ifndef __LOCAL_MEMORY_PIPELINE_HH__ 377054Snate@binkert.org#define __LOCAL_MEMORY_PIPELINE_HH__ 386154Snate@binkert.org 396145Snate@binkert.org#include <queue> 407055Snate@binkert.org#include <string> 417055Snate@binkert.org 426145Snate@binkert.org#include "gpu-compute/misc.hh" 436145Snate@binkert.org#include "params/ComputeUnit.hh" 446145Snate@binkert.org#include "sim/stats.hh" 456145Snate@binkert.org 466145Snate@binkert.org/* 476145Snate@binkert.org * @file local_memory_pipeline.hh 486145Snate@binkert.org * 499499Snilay@cs.wisc.edu * The local memory pipeline issues newly created local memory packets 509230Snilay@cs.wisc.edu * from pipeline to the LDS. This stage also retires previously issued 519465Snilay@cs.wisc.edu * loads and stores that have returned from the LDS. 529230Snilay@cs.wisc.edu */ 536145Snate@binkert.org 548259SBrad.Beckmann@amd.comclass ComputeUnit; 557054Snate@binkert.orgclass Wavefront; 566145Snate@binkert.org 576145Snate@binkert.orgclass LocalMemPipeline 589499Snilay@cs.wisc.edu{ 599230Snilay@cs.wisc.edu public: 609465Snilay@cs.wisc.edu LocalMemPipeline(const ComputeUnitParams *params); 619230Snilay@cs.wisc.edu void init(ComputeUnit *cu); 626145Snate@binkert.org void exec(); 638259SBrad.Beckmann@amd.com 647054Snate@binkert.org template<typename c0, typename c1> void doSmReturn(GPUDynInstPtr m); 656145Snate@binkert.org 666145Snate@binkert.org std::queue<GPUDynInstPtr> &getLMReqFIFO() { return lmIssuedRequests; } 677054Snate@binkert.org std::queue<GPUDynInstPtr> &getLMRespFIFO() { return lmReturnedRequests; } 689499Snilay@cs.wisc.edu 699499Snilay@cs.wisc.edu bool 706145Snate@binkert.org isLMRespFIFOWrRdy() const 717054Snate@binkert.org { 727054Snate@binkert.org return lmReturnedRequests.size() < lmQueueSize; 736145Snate@binkert.org } 747832Snate@binkert.org 757054Snate@binkert.org bool 767054Snate@binkert.org isLMReqFIFOWrRdy(uint32_t pendReqs=0) const 778259SBrad.Beckmann@amd.com { 786145Snate@binkert.org return (lmIssuedRequests.size() + pendReqs) < lmQueueSize; 797054Snate@binkert.org } 806145Snate@binkert.org 819863Snilay@cs.wisc.edu const std::string& name() const { return _name; } 826145Snate@binkert.org void regStats(); 836145Snate@binkert.org 847054Snate@binkert.org private: 857454Snate@binkert.org ComputeUnit *computeUnit; 869508Snilay@cs.wisc.edu std::string _name; 876145Snate@binkert.org int lmQueueSize; 887054Snate@binkert.org Stats::Scalar loadVrfBankConflictCycles; 897054Snate@binkert.org // Local Memory Request Fifo: all shared memory requests 909508Snilay@cs.wisc.edu // are issued to this FIFO from the memory pipelines 917054Snate@binkert.org std::queue<GPUDynInstPtr> lmIssuedRequests; 926145Snate@binkert.org 936145Snate@binkert.org // Local Memory Response Fifo: all responses of shared memory 947054Snate@binkert.org // requests are sent to this FIFO from LDS 959508Snilay@cs.wisc.edu std::queue<GPUDynInstPtr> lmReturnedRequests; 966145Snate@binkert.org}; 977454Snate@binkert.org 987454Snate@binkert.org#endif // __LOCAL_MEMORY_PIPELINE_HH__ 997454Snate@binkert.org