Matthew Poremba has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/56367 )

Change subject: gpu-compute: Fix default MTYPE initialization
......................................................................

gpu-compute: Fix default MTYPE initialization

The default MTYPE initialization in the emulated GPU driver is currently
doing a bitwise AND on an input integer param with other integers
instead of using a bitmask. Change this to use bitset and test the bit
positions corresponding to the values in the MTYPE enum that were
previously being used as an operand for bitwise AND.

This was causing invalid slicc transitions in some benchmarks for
combinations of request type and mtype that are undefined.

Change-Id: I93fee0eae1fff7141cd14c239c16d1d69925d08d
---
M src/gpu-compute/gpu_compute_driver.cc
M src/gpu-compute/gpu_compute_driver.hh
2 files changed, 27 insertions(+), 4 deletions(-)



diff --git a/src/gpu-compute/gpu_compute_driver.cc b/src/gpu-compute/gpu_compute_driver.cc
index e908f4e..7113e67 100644
--- a/src/gpu-compute/gpu_compute_driver.cc
+++ b/src/gpu-compute/gpu_compute_driver.cc
@@ -67,14 +67,18 @@

     // Convert the 3 bit mtype specified in Shader.py to the proper type
     // used for requests.
-    if (MtypeFlags::SHARED & p.m_type)
+    std::bitset<MtypeFlags::NUM_MTYPE_BITS> mtype(p.m_type);
+    if (mtype.test(MtypeFlags::SHARED)) {
         defaultMtype.set(Request::SHARED);
+    }

-    if (MtypeFlags::READ_WRITE & p.m_type)
+    if (mtype.test(MtypeFlags::READ_WRITE)) {
         defaultMtype.set(Request::READ_WRITE);
+    }

-    if (MtypeFlags::CACHED & p.m_type)
+    if (mtype.test(MtypeFlags::CACHED)) {
         defaultMtype.set(Request::CACHED);
+    }
 }

 const char*
diff --git a/src/gpu-compute/gpu_compute_driver.hh b/src/gpu-compute/gpu_compute_driver.hh
index 868ad1c..def40f4 100644
--- a/src/gpu-compute/gpu_compute_driver.hh
+++ b/src/gpu-compute/gpu_compute_driver.hh
@@ -168,7 +168,8 @@
     {
         SHARED                  = 0,
         READ_WRITE              = 1,
-        CACHED                  = 2
+        CACHED                  = 2,
+        NUM_MTYPE_BITS
     };

     Request::CacheCoherenceFlags defaultMtype;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56367
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I93fee0eae1fff7141cd14c239c16d1d69925d08d
Gerrit-Change-Number: 56367
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to