Alexandru Duțu has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/53603 )

Change subject: arch-vega,arch-gcn3: Implement S_MEMTIME instruction
......................................................................

arch-vega,arch-gcn3: Implement S_MEMTIME instruction

Change-Id: I3e286eb6ff8af4097ad03d4066be79f73d938cea
---
M src/arch/amdgpu/vega/insts/instructions.cc
M src/gpu-compute/gpu_static_inst.hh
M src/arch/amdgpu/gcn3/insts/instructions.cc
3 files changed, 28 insertions(+), 2 deletions(-)



diff --git a/src/arch/amdgpu/gcn3/insts/instructions.cc b/src/arch/amdgpu/gcn3/insts/instructions.cc
index bb15957..9bc0369 100644
--- a/src/arch/amdgpu/gcn3/insts/instructions.cc
+++ b/src/arch/amdgpu/gcn3/insts/instructions.cc
@@ -5318,6 +5318,11 @@
     Inst_SMEM__S_MEMTIME::Inst_SMEM__S_MEMTIME(InFmt_SMEM *iFmt)
         : Inst_SMEM(iFmt, "s_memtime")
     {
+ // Unlike other SMEM instructions, S_MEMTIME does not actually issue a + // request to memory. To simplify the implementation, we model it as an
+        // ALU instruction.
+        unsetFlag(SMEM);
+        setFlag(ALU);
     } // Inst_SMEM__S_MEMTIME

     Inst_SMEM__S_MEMTIME::~Inst_SMEM__S_MEMTIME()
@@ -5328,7 +5333,10 @@
     void
     Inst_SMEM__S_MEMTIME::execute(GPUDynInstPtr gpuDynInst)
     {
-        panicUnimplemented();
+        ScalarOperandU64 sdst(gpuDynInst, instData.SDATA);
+        sdst = (ScalarRegU64) curTick() /
+                              gpuDynInst->computeUnit()->clockPeriod();
+        sdst.write();
     }

     Inst_SMEM__S_MEMREALTIME::Inst_SMEM__S_MEMREALTIME(InFmt_SMEM *iFmt)
diff --git a/src/arch/amdgpu/vega/insts/instructions.cc b/src/arch/amdgpu/vega/insts/instructions.cc
index 1e07f0b..4650aa8 100644
--- a/src/arch/amdgpu/vega/insts/instructions.cc
+++ b/src/arch/amdgpu/vega/insts/instructions.cc
@@ -5841,6 +5841,11 @@
     Inst_SMEM__S_MEMTIME::Inst_SMEM__S_MEMTIME(InFmt_SMEM *iFmt)
         : Inst_SMEM(iFmt, "s_memtime")
     {
+ // Unlike other SMEM instructions, S_MEMTIME does not actually issue a + // request to memory. To simplify the implementation, we model it as an
+        // ALU instruction.
+        unsetFlag(SMEM);
+        setFlag(ALU);
     } // Inst_SMEM__S_MEMTIME

     Inst_SMEM__S_MEMTIME::~Inst_SMEM__S_MEMTIME()
@@ -5852,7 +5857,10 @@
     void
     Inst_SMEM__S_MEMTIME::execute(GPUDynInstPtr gpuDynInst)
     {
-        panicUnimplemented();
+        ScalarOperandU64 sdst(gpuDynInst, instData.SDATA);
+        sdst = (ScalarRegU64) curTick() /
+                              gpuDynInst->computeUnit()->clockPeriod();
+        sdst.write();
     } // execute
     // --- Inst_SMEM__S_MEMREALTIME class methods ---

diff --git a/src/gpu-compute/gpu_static_inst.hh b/src/gpu-compute/gpu_static_inst.hh
index 8de6c89..a15e912 100644
--- a/src/gpu-compute/gpu_static_inst.hh
+++ b/src/gpu-compute/gpu_static_inst.hh
@@ -262,6 +262,7 @@
             executed_as = enums::SC_ARG;
         }
     }
+    void unsetFlag(Flags flag) { _flags[flag] = false; }
     const std::string& opcode() const { return _opcode; }

     const std::vector<OperandInfo>& srcOperands() const { return srcOps; }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53603
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: I3e286eb6ff8af4097ad03d4066be79f73d938cea
Gerrit-Change-Number: 53603
Gerrit-PatchSet: 1
Gerrit-Owner: Alexandru Duțu <[email protected]>
Gerrit-CC: Michael Boyer <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to