testers,gpu-compute,mem: replace ACQUIRE and RELEASE request flags

This patch replaces ACQUIRE and RELEASE flags which are HSA-specific.
ACQUIRE flag becomes INV_L1 in VIPER protocol. RELEASE flag is removed.
Future protocols may support extra cache coherence flags like INV_L2 and
WB_L2.

Change-Id: I3d60c9d3625c898f4110a12d81742b6822728533
diff --git a/src/cpu/testers/gpu_ruby_test/GpuWavefront.cc b/src/cpu/testers/gpu_ruby_test/GpuWavefront.cc
index 33625e6..f95098a 100644
--- a/src/cpu/testers/gpu_ruby_test/GpuWavefront.cc
+++ b/src/cpu/testers/gpu_ruby_test/GpuWavefront.cc
@@ -251,7 +251,7 @@
                                    0);
     acq_req->setPaddr(0);
     acq_req->setReqInstSeqNum(tester->getActionSeqNum());
-    acq_req->setFlags(Request::ACQUIRE);
+    acq_req->setCacheCoherenceFlags(Request::INV_L1);
     // set protocol-specific flags
     setExtraRequestFlags(acq_req);
 
diff --git a/src/gpu-compute/compute_unit.cc b/src/gpu-compute/compute_unit.cc
index a8e86ba..adbffee 100644
--- a/src/gpu-compute/compute_unit.cc
+++ b/src/gpu-compute/compute_unit.cc
@@ -762,9 +762,9 @@
         // here (simdId=-1, wfSlotId=-1)
         if (gpuDynInst->isKernelLaunch()) {
             // for kernel launch, the original request must be both kernel-type
-            // and acquire
+            // and INV_L1
             assert(pkt->req->isKernel());
-            assert(pkt->req->isAcquire());
+            assert(pkt->req->isInvL1());
 
             // one D-Cache inv is done, decrement counter
             dispatcher.updateInvCounter(gpuDynInst->kern_id);
@@ -781,32 +781,33 @@
         // Check if we are waiting on Kernel End Release
         if (w->getStatus() == Wavefront::S_RETURNING
             && gpuDynInst->isEndOfKernel()) {
-            // for kernel end, the original request must be both kernel-type
-            // and release
-            assert(pkt->req->isKernel());
-            assert(pkt->req->isRelease());
-
-            // one wb done, decrement counter, and return whether all wbs are
-            // done for the kernel
-            bool isWbDone = dispatcher.updateWbCounter(gpuDynInst->kern_id);
-
-            // not all wbs are done for the kernel, just release pkt
-            // resources
-            if (!isWbDone) {
-                delete pkt->senderState;
-                delete pkt->req;
-                delete pkt;
-                return true;
-            }
-
-            // all wbs are completed for the kernel, do retirement work
-            // for the workgroup
-            DPRINTF(GPUDisp, "CU%d: WF[%d][%d][wv=%d]: WG %d completed\n",
-                    computeUnit->cu_id, w->simdId, w->wfSlotId,
-                    w->wfDynId, w->wgId);
-
-            dispatcher.notifyWgCompl(w);
-            w->setStatus(Wavefront::S_STOPPED);
+            // TODO does CU still wait for kernel end response?
+//            // for kernel end, the original request must be both kernel-type
+//            // and release
+//            assert(pkt->req->isKernel());
+//            assert(pkt->req->isRelease());
+//
+//            // one wb done, decrement counter, and return whether all wbs are
+//            // done for the kernel
+//            bool isWbDone = dispatcher.updateWbCounter(gpuDynInst->kern_id);
+//
+//            // not all wbs are done for the kernel, just release pkt
+//            // resources
+//            if (!isWbDone) {
+//                delete pkt->senderState;
+//                delete pkt->req;
+//                delete pkt;
+//                return true;
+//            }
+//
+//            // all wbs are completed for the kernel, do retirement work
+//            // for the workgroup
+//            DPRINTF(GPUDisp, "CU%d: WF[%d][%d][wv=%d]: WG %d completed\n",
+//                    computeUnit->cu_id, w->simdId, w->wfSlotId,
+//                    w->wfDynId, w->wgId);
+//
+//            dispatcher.notifyWgCompl(w);
+//            w->setStatus(Wavefront::S_STOPPED);
         }
 
         if (!pkt->req->isKernel()) {
@@ -1213,7 +1214,7 @@
 
     if (kernelMemSync) {
         if (gpuDynInst->isKernelLaunch()) {
-            req->setCacheCoherenceFlags(Request::ACQUIRE);
+            req->setCacheCoherenceFlags(Request::INV_L1);
             req->setReqInstSeqNum(gpuDynInst->seqNum());
             req->setFlags(Request::KERNEL);
             pkt = new Packet(req, MemCmd::MemSyncReq);
@@ -1229,23 +1230,25 @@
 
             schedule(mem_req_event, curTick() + req_tick_latency);
         } else {
-            assert(gpuDynInst->isEndOfKernel());
-
-            req->setCacheCoherenceFlags(Request::RELEASE);
-            req->setReqInstSeqNum(gpuDynInst->seqNum());
-            req->setFlags(Request::KERNEL);
-            pkt = new Packet(req, MemCmd::MemSyncReq);
-            pkt->pushSenderState(
-               new ComputeUnit::DataPort::SenderState(gpuDynInst, 0, nullptr));
-
-            EventFunctionWrapper *mem_req_event =
-              memPort[0]->createMemReqEvent(pkt);
-
-            DPRINTF(GPUPort, "CU%d: WF[%d][%d]: index %d, addr %#x scheduling "
-                    "a release\n", cu_id, gpuDynInst->simdId,
-                    gpuDynInst->wfSlotId, 0, pkt->req->getPaddr());
-
-            schedule(mem_req_event, curTick() + req_tick_latency);
+            // TODO Does CU still send kernel end request to CU?
+            // Should it wait on wait_cnt instead?
+//          assert(gpuDynInst->isEndOfKernel());
+//
+//          req->setCacheCoherenceFlags(Request::RELEASE);
+//          req->setReqInstSeqNum(gpuDynInst->seqNum());
+//          req->setFlags(Request::KERNEL);
+//          pkt = new Packet(req, MemCmd::MemSyncReq);
+//          pkt->pushSenderState(
+//             new ComputeUnit::DataPort::SenderState(gpuDynInst, 0, nullptr));
+//
+//          EventFunctionWrapper *mem_req_event =
+//            memPort[0]->createMemReqEvent(pkt);
+//
+//          DPRINTF(GPUPort, "CU%d: WF[%d][%d]: index %d, addr %#x scheduling "
+//                  "a release\n", cu_id, gpuDynInst->simdId,
+//                  gpuDynInst->wfSlotId, 0, pkt->req->getPaddr());
+//
+//          schedule(mem_req_event, curTick() + req_tick_latency);
         }
     } else {
         gpuDynInst->setRequestFlags(req);
diff --git a/src/gpu-compute/gpu_dyn_inst.hh b/src/gpu-compute/gpu_dyn_inst.hh
index ebe335b..33c6f40 100644
--- a/src/gpu-compute/gpu_dyn_inst.hh
+++ b/src/gpu-compute/gpu_dyn_inst.hh
@@ -403,7 +403,7 @@
             assert(!isEndOfKernel());
 
             // must be wbinv inst if not kernel launch/end
-            req->setCacheCoherenceFlags(Request::ACQUIRE);
+            req->setCacheCoherenceFlags(Request::INV_L1);
         }
     }
 
diff --git a/src/mem/request.hh b/src/mem/request.hh
index 0a4be1a..4c9f150 100644
--- a/src/mem/request.hh
+++ b/src/mem/request.hh
@@ -155,10 +155,8 @@
         PF_EXCLUSIVE                = 0x02000000,
         /** The request should be marked as LRU. */
         EVICT_NEXT                  = 0x04000000,
-        /** The request should be marked with ACQUIRE. */
-        ACQUIRE                     = 0x00020000,
-        /** The request should be marked with RELEASE. */
-        RELEASE                     = 0x00040000,
+        /** The request is a L1 cache invalidation request */
+        INV_L1                      = 0x00020000,
 
         /** The request is an atomic that returns data. */
         ATOMIC_RETURN_OP            = 0x40000000,
@@ -788,7 +786,6 @@
     bool isMmappedIpr() const { return _flags.isSet(MMAPPED_IPR); }
     bool isSecure() const { return _flags.isSet(SECURE); }
     bool isPTWalk() const { return _flags.isSet(PT_WALK); }
-    bool isRelease() const { return _flags.isSet(RELEASE); }
     bool isKernel() const { return _flags.isSet(KERNEL); }
     bool isAtomicReturn() const { return _flags.isSet(ATOMIC_RETURN_OP); }
     bool isAtomicNoReturn() const { return _flags.isSet(ATOMIC_NO_RETURN_OP); }
@@ -811,16 +808,13 @@
     bool isToPOC() const { return _flags.isSet(DST_POC); }
     Flags getDest() const { return _flags & DST_BITS; }
 
-    bool isAcquire() const { return _cacheCoherenceFlags.isSet(ACQUIRE); }
-
     /**
      * Accessor functions for the memory space configuration flags and used by
      * GPU ISAs such as the Heterogeneous System Architecture (HSA). Note that
      * these are for testing only; setting extraFlags should be done via
      * setCacheCoherenceFlags().
      */
-    bool isSLC() const { return _cacheCoherenceFlags.isSet(SLC_BIT); }
-    bool isGLC() const { return _cacheCoherenceFlags.isSet(GLC_BIT); }
+    bool isInvL1() const { return _cacheCoherenceFlags.isSet(INV_L1); }
 
     /**
      * Accessor functions to determine whether this request is part of
diff --git a/src/mem/ruby/system/VIPERCoalescer.cc b/src/mem/ruby/system/VIPERCoalescer.cc
index e164e76..0c00597 100644
--- a/src/mem/ruby/system/VIPERCoalescer.cc
+++ b/src/mem/ruby/system/VIPERCoalescer.cc
@@ -83,20 +83,19 @@
 VIPERCoalescer::makeRequest(PacketPtr pkt)
 {
     // VIPER only supports following memory request types
-    //    MemSyncReq & Acquire: TCP cache invalidation
+    //    MemSyncReq & INV_L1 : TCP cache invalidation
     //    ReadReq             : cache read
     //    WriteReq            : cache write
     //    AtomicOp            : cache atomic
     //
     // VIPER does not expect MemSyncReq & Release since in GCN3, compute unit
     // does not specify an equivalent type of memory request.
-    // TODO: future patches should rename Acquire and Release
-    assert((pkt->cmd == MemCmd::MemSyncReq && pkt->req->isAcquire()) ||
+    assert((pkt->cmd == MemCmd::MemSyncReq && pkt->req->isInvL1()) ||
             pkt->cmd == MemCmd::ReadReq ||
             pkt->cmd == MemCmd::WriteReq ||
             pkt->isAtomicOp());
 
-    if (pkt->req->isAcquire() && m_cache_inv_pkt) {
+    if (pkt->req->isInvL1() && m_cache_inv_pkt) {
         // In VIPER protocol, the coalescer is not able to handle two or
         // more cache invalidation requests at a time. Cache invalidation
         // requests must be serialized to ensure that all stale data in
@@ -107,8 +106,8 @@
 
     GPUCoalescer::makeRequest(pkt);
 
-    if (pkt->req->isAcquire()) {
-        // In VIPER protocol, a compute unit sends a MemSyncReq with Acquire
+    if (pkt->req->isInvL1()) {
+        // In VIPER protocol, a compute unit sends a MemSyncReq with INV_L1
         // flag to invalidate TCP. Upon receiving a request of this type,
         // VIPERCoalescer starts a cache walk to invalidate all valid entries
         // in TCP. The request is completed once all entries are invalidated.
@@ -223,7 +222,7 @@
 }
 
 /**
-  * Invalidate TCP (Acquire)
+  * Invalidate TCP
   */
 void
 VIPERCoalescer::invTCP()