Kyle Roarty has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/35135 )
Change subject: configs,tests: Add tokens to GPU VIPER tester
......................................................................
configs,tests: Add tokens to GPU VIPER tester
WIP patch to add token management to the VIPER tester.
This patch adds a GMTokenPort to the tester, and has the tester acquire
tokens for requests that use tokens, and check for available tokens
before issuing any requests.
Currently, the actual hooking up of the token ports is iffy and could
probably be done better. I believe token checking is done properly.
Change-Id: Id317d703e4765dd5fa7de0d16f5eb595aab7096c
---
M configs/example/ruby_gpu_random_test.py
M src/cpu/testers/gpu_ruby_test/ProtocolTester.py
M src/cpu/testers/gpu_ruby_test/gpu_thread.cc
M src/cpu/testers/gpu_ruby_test/gpu_thread.hh
M src/cpu/testers/gpu_ruby_test/protocol_tester.cc
M src/cpu/testers/gpu_ruby_test/protocol_tester.hh
6 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/configs/example/ruby_gpu_random_test.py
b/configs/example/ruby_gpu_random_test.py
index d32a201..891b4d1 100644
--- a/configs/example/ruby_gpu_random_test.py
+++ b/configs/example/ruby_gpu_random_test.py
@@ -303,6 +303,7 @@
tester.cpu_ports = ruby_port.slave
elif i < (n_CPUs + n_CUs):
tester.cu_vector_ports = ruby_port.slave
+ tester.cu_token_ports = ruby_port.gmTokenPort
elif i < (n_CPUs + n_CUs + n_SQCs):
tester.cu_sqc_ports = ruby_port.slave
else:
diff --git a/src/cpu/testers/gpu_ruby_test/ProtocolTester.py
b/src/cpu/testers/gpu_ruby_test/ProtocolTester.py
index 74ff6dc..39ec172 100644
--- a/src/cpu/testers/gpu_ruby_test/ProtocolTester.py
+++ b/src/cpu/testers/gpu_ruby_test/ProtocolTester.py
@@ -41,6 +41,7 @@
cu_vector_ports = VectorRequestPort("Vector ports for GPUs")
cu_sqc_ports = VectorRequestPort("SQC ports for GPUs")
cu_scalar_ports = VectorRequestPort("Scalar ports for GPUs")
+ cu_token_ports = VectorRequestPort("Token ports for GPU")
cus_per_sqc = Param.Int(4, "Number of CUs per SQC")
cus_per_scalar = Param.Int(4, "Number of CUs per scalar cache")
diff --git a/src/cpu/testers/gpu_ruby_test/gpu_thread.cc
b/src/cpu/testers/gpu_ruby_test/gpu_thread.cc
index f24bb1a..bc41285 100644
--- a/src/cpu/testers/gpu_ruby_test/gpu_thread.cc
+++ b/src/cpu/testers/gpu_ruby_test/gpu_thread.cc
@@ -135,11 +135,13 @@
void
GpuThread::attachGpuThreadToPorts(ProtocolTester *_tester,
ProtocolTester::SeqPort *_port,
+ ProtocolTester::GMTokenPort *_tokenPort,
ProtocolTester::SeqPort *_scalarPort,
ProtocolTester::SeqPort *_sqcPort)
{
tester = _tester;
port = _port;
+ tokenPort = _tokenPort;
scalarPort = _scalarPort;
sqcPort = _sqcPort;
@@ -173,7 +175,8 @@
// to complete
if (pendingLdStCount == 0 &&
pendingFenceCount == 0 &&
- pendingAtomicCount == 0) {
+ pendingAtomicCount == 0 &&
+ tokenPort->haveTokens(1)) {
return true;
}
@@ -208,7 +211,7 @@
assert(pendingAtomicCount == 0);
// can't issue if there is a pending fence
- if (pendingFenceCount > 0) {
+ if (pendingFenceCount > 0 || !tokenPort->haveTokens(1)) {
return false;
}
@@ -251,6 +254,7 @@
{
switch(curAction->getType()) {
case Episode::Action::Type::ATOMIC:
+ tokenPort->acquireTokens(1);
issueAtomicOps();
break;
case Episode::Action::Type::ACQUIRE:
@@ -260,9 +264,11 @@
issueReleaseOp();
break;
case Episode::Action::Type::LOAD:
+ tokenPort->acquireTokens(1);
issueLoadOps();
break;
case Episode::Action::Type::STORE:
+ tokenPort->acquireTokens(1);
issueStoreOps();
break;
default:
diff --git a/src/cpu/testers/gpu_ruby_test/gpu_thread.hh
b/src/cpu/testers/gpu_ruby_test/gpu_thread.hh
index 4ed4a5e..03940cc 100644
--- a/src/cpu/testers/gpu_ruby_test/gpu_thread.hh
+++ b/src/cpu/testers/gpu_ruby_test/gpu_thread.hh
@@ -42,6 +42,7 @@
#include "cpu/testers/gpu_ruby_test/episode.hh"
#include "cpu/testers/gpu_ruby_test/protocol_tester.hh"
#include "gpu-compute/gpu_dyn_inst.hh"
+#include "mem/token_port.hh"
#include "sim/clocked_object.hh"
class GpuThread : public ClockedObject
@@ -61,6 +62,7 @@
void attachGpuThreadToPorts(ProtocolTester *_tester,
ProtocolTester::SeqPort *_port,
+ ProtocolTester::GMTokenPort *_tokenPort =
nullptr,
ProtocolTester::SeqPort *_sqcPort = nullptr,
ProtocolTester::SeqPort *_scalarPort =
nullptr);
@@ -136,6 +138,7 @@
AddressManager *addrManager;
ProtocolTester::SeqPort *port; // main data port (GPU-vector
data)
+ ProtocolTester::GMTokenPort *tokenPort;
ProtocolTester::SeqPort *scalarPort; // nullptr for CPU
ProtocolTester::SeqPort *sqcPort; // nullptr for CPU
diff --git a/src/cpu/testers/gpu_ruby_test/protocol_tester.cc
b/src/cpu/testers/gpu_ruby_test/protocol_tester.cc
index 9168f2a..c883267 100644
--- a/src/cpu/testers/gpu_ruby_test/protocol_tester.cc
+++ b/src/cpu/testers/gpu_ruby_test/protocol_tester.cc
@@ -53,6 +53,7 @@
numVectorPorts(p->port_cu_vector_ports_connection_count),
numSqcPorts(p->port_cu_sqc_ports_connection_count),
numScalarPorts(p->port_cu_scalar_ports_connection_count),
+ numTokenPorts(p->port_cu_token_ports_connection_count),
numCusPerSqc(p->cus_per_sqc),
numCusPerScalar(p->cus_per_scalar),
numWfsPerCu(p->wavefronts_per_cu),
@@ -107,6 +108,14 @@
idx++;
}
+ for (int i = 0; i < numTokenPorts; ++i) {
+ cuTokenPorts.push_back(new GMTokenPort(csprintf("%s-cuTokenPort%d",
+ name(), i),
+ this, i));
+ cuTokenManagers.push_back(new TokenManager(4));
+ cuTokenPorts[i]->setTokenManager(cuTokenManagers[i]);
+ }
+
// create an address manager
addrManager = new AddressManager(numAtomicLocs,
numNormalLocsPerAtomic);
@@ -194,6 +203,7 @@
wfId = cu_id * numWfsPerCu + i;
wfs[wfId]->attachGpuThreadToPorts(this,
static_cast<SeqPort*>(cuVectorPorts[vectorPortId]),
+ cuTokenPorts[vectorPortId],
static_cast<SeqPort*>(cuSqcPorts[sqcPortId]),
static_cast<SeqPort*>(cuScalarPorts[scalarPortId]));
wfs[wfId]->scheduleWakeup();
@@ -206,7 +216,8 @@
ProtocolTester::getPort(const std::string &if_name, PortID idx)
{
if (if_name != "cpu_ports" && if_name != "cu_vector_ports" &&
- if_name != "cu_sqc_ports" && if_name != "cu_scalar_ports") {
+ if_name != "cu_sqc_ports" && if_name != "cu_scalar_ports" &&
+ if_name != "cu_token_ports") {
// pass along to super class
return ClockedObject::getPort(if_name, idx);
} else {
@@ -222,6 +233,10 @@
if (idx > numSqcPorts)
panic("ProtocolTester: unknown cu sqc port %d\n", idx);
return *cuSqcPorts[idx];
+ } else if (if_name == "cu_token_ports") {
+ if (idx > numTokenPorts)
+ panic("ProtocolTester: unknown cu token port %d\n", idx);
+ return *cuTokenPorts[idx];
} else {
assert(if_name == "cu_scalar_ports");
if (idx > numScalarPorts)
diff --git a/src/cpu/testers/gpu_ruby_test/protocol_tester.hh
b/src/cpu/testers/gpu_ruby_test/protocol_tester.hh
index 2b4e0ce..8b4c47f 100644
--- a/src/cpu/testers/gpu_ruby_test/protocol_tester.hh
+++ b/src/cpu/testers/gpu_ruby_test/protocol_tester.hh
@@ -58,6 +58,7 @@
#include "cpu/testers/gpu_ruby_test/address_manager.hh"
#include "mem/packet.hh"
#include "mem/ruby/system/RubyPort.hh"
+#include "mem/token_port.hh"
#include "params/ProtocolTester.hh"
class GpuThread;
@@ -81,6 +82,20 @@
{ panic("%s does not expect a retry\n", name()); }
};
+ class GMTokenPort : public TokenRequestPort
+ {
+ public:
+ GMTokenPort(const std::string& name, ProtocolTester *_tester,
+ PortID id = InvalidPortID)
+ : TokenRequestPort(name, _tester, id)
+ {}
+ ~GMTokenPort() {}
+
+ protected:
+ bool recvTimingResp(PacketPtr) { return false; }
+ void recvReqRetry() {}
+ };
+
struct SenderState : public Packet::SenderState
{
GpuThread* th;
@@ -131,6 +146,7 @@
int numVectorPorts;
int numSqcPorts;
int numScalarPorts;
+ int numTokenPorts;
int numCusPerSqc;
int numCusPerScalar;
int numWfsPerCu;
@@ -150,6 +166,8 @@
std::vector<RequestPort*> cuVectorPorts; // ports to GPU vector cache
std::vector<RequestPort*> cuSqcPorts; // ports to GPU inst cache
std::vector<RequestPort*> cuScalarPorts; // ports to GPU scalar cache
+ std::vector<TokenManager*> cuTokenManagers;
+ std::vector<GMTokenPort*> cuTokenPorts;
// all CPU and GPU threads
std::vector<CpuThread*> cpuThreads;
std::vector<GpuWavefront*> wfs;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35135
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: Id317d703e4765dd5fa7de0d16f5eb595aab7096c
Gerrit-Change-Number: 35135
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty <[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