From: Tony Gutierrez Date: Thu, 27 Oct 2016 02:47:47 +0000 (-0400) Subject: gpu-compute: use System cache line size in the GPU X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aa7364276f16bbe6aa300b43bc57ff1b73be42a7;p=gem5.git gpu-compute: use System cache line size in the GPU --- diff --git a/src/gpu-compute/compute_unit.cc b/src/gpu-compute/compute_unit.cc index f05ecc1b2..93cffbe1e 100644 --- a/src/gpu-compute/compute_unit.cc +++ b/src/gpu-compute/compute_unit.cc @@ -75,7 +75,8 @@ ComputeUnit::ComputeUnit(const Params *p) : MemObject(p), fetchStage(p), req_tick_latency(p->mem_req_latency * p->clk_domain->clockPeriod()), resp_tick_latency(p->mem_resp_latency * p->clk_domain->clockPeriod()), _masterId(p->system->getMasterId(name() + ".ComputeUnit")), - lds(*p->localDataStore), globalSeqNum(0), wavefrontSize(p->wfSize), + lds(*p->localDataStore), _cacheLineSize(p->system->cacheLineSize()), + globalSeqNum(0), wavefrontSize(p->wfSize), kernelLaunchInst(new KernelLaunchStaticInst()) { /** diff --git a/src/gpu-compute/compute_unit.hh b/src/gpu-compute/compute_unit.hh index 2187bec38..4a1c09c27 100644 --- a/src/gpu-compute/compute_unit.hh +++ b/src/gpu-compute/compute_unit.hh @@ -390,6 +390,8 @@ class ComputeUnit : public MemObject int32_t getRefCounter(const uint32_t dispatchId, const uint32_t wgId) const; + int cacheLineSize() const { return _cacheLineSize; } + bool sendToLds(GPUDynInstPtr gpuDynInst) __attribute__((warn_unused_result)); @@ -767,6 +769,7 @@ class ComputeUnit : public MemObject uint64_t getAndIncSeqNum() { return globalSeqNum++; } private: + const int _cacheLineSize; uint64_t globalSeqNum; int wavefrontSize; GPUStaticInst *kernelLaunchInst; diff --git a/src/gpu-compute/fetch_unit.cc b/src/gpu-compute/fetch_unit.cc index 1b19a3223..9a059f7fc 100644 --- a/src/gpu-compute/fetch_unit.cc +++ b/src/gpu-compute/fetch_unit.cc @@ -132,10 +132,10 @@ FetchUnit::initiateFetch(Wavefront *wavefront) // Since this is an instruction prefetch, if you're split then just finish // out the current line. - unsigned block_size = RubySystem::getBlockSizeBytes(); + int block_size = computeUnit->cacheLineSize(); // check for split accesses Addr split_addr = roundDown(vaddr + block_size - 1, block_size); - unsigned size = block_size; + int size = block_size; if (split_addr > vaddr) { // misaligned access, just grab the rest of the line diff --git a/src/gpu-compute/shader.cc b/src/gpu-compute/shader.cc index d02f95d29..e47edce2c 100644 --- a/src/gpu-compute/shader.cc +++ b/src/gpu-compute/shader.cc @@ -224,7 +224,7 @@ void Shader::doFunctionalAccess(RequestPtr req, MemCmd cmd, void *data, bool suppress_func_errors, int cu_id) { - unsigned block_size = RubySystem::getBlockSizeBytes(); + int block_size = cuList.at(cu_id)->cacheLineSize(); unsigned size = req->getSize(); Addr tmp_addr; @@ -342,7 +342,7 @@ Shader::AccessMem(uint64_t address, void *ptr, uint32_t size, int cu_id, { uint8_t *data_buf = (uint8_t*)ptr; - for (ChunkGenerator gen(address, size, RubySystem::getBlockSizeBytes()); + for (ChunkGenerator gen(address, size, cuList.at(cu_id)->cacheLineSize()); !gen.done(); gen.next()) { Request *req = new Request(0, gen.addr(), gen.size(), 0, cuList[0]->masterId(), 0, 0, 0);