changeset d1ad31187fa5 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=d1ad31187fa5
description:
        gpu-compute: use System cache line size in the GPU

diffstat:

 src/gpu-compute/compute_unit.cc |  3 ++-
 src/gpu-compute/compute_unit.hh |  3 +++
 src/gpu-compute/fetch_unit.cc   |  4 ++--
 src/gpu-compute/shader.cc       |  4 ++--
 4 files changed, 9 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r c63431b7bbeb -r d1ad31187fa5 src/gpu-compute/compute_unit.cc
--- a/src/gpu-compute/compute_unit.cc   Wed Oct 26 22:47:43 2016 -0400
+++ b/src/gpu-compute/compute_unit.cc   Wed Oct 26 22:47:47 2016 -0400
@@ -75,7 +75,8 @@
     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 -r c63431b7bbeb -r d1ad31187fa5 src/gpu-compute/compute_unit.hh
--- a/src/gpu-compute/compute_unit.hh   Wed Oct 26 22:47:43 2016 -0400
+++ b/src/gpu-compute/compute_unit.hh   Wed Oct 26 22:47:47 2016 -0400
@@ -390,6 +390,8 @@
     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 @@
     uint64_t getAndIncSeqNum() { return globalSeqNum++; }
 
   private:
+    const int _cacheLineSize;
     uint64_t globalSeqNum;
     int wavefrontSize;
     GPUStaticInst *kernelLaunchInst;
diff -r c63431b7bbeb -r d1ad31187fa5 src/gpu-compute/fetch_unit.cc
--- a/src/gpu-compute/fetch_unit.cc     Wed Oct 26 22:47:43 2016 -0400
+++ b/src/gpu-compute/fetch_unit.cc     Wed Oct 26 22:47:47 2016 -0400
@@ -132,10 +132,10 @@
 
     // 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 -r c63431b7bbeb -r d1ad31187fa5 src/gpu-compute/shader.cc
--- a/src/gpu-compute/shader.cc Wed Oct 26 22:47:43 2016 -0400
+++ b/src/gpu-compute/shader.cc Wed Oct 26 22:47:47 2016 -0400
@@ -224,7 +224,7 @@
 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 @@
 {
     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);
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to