42#include "debug/ProtocolTest.hh"
52 _requestorId(
p.
system->getRequestorId(this)),
53 numCpuPorts(
p.port_cpu_ports_connection_count),
54 numDmaPorts(
p.port_dma_ports_connection_count),
55 numVectorPorts(
p.port_cu_vector_ports_connection_count),
56 numSqcPorts(
p.port_cu_sqc_ports_connection_count),
57 numScalarPorts(
p.port_cu_scalar_ports_connection_count),
58 numTokenPorts(
p.port_cu_token_ports_connection_count),
59 numCusPerSqc(
p.cus_per_sqc),
60 numCusPerScalar(
p.cus_per_scalar),
61 numWfsPerCu(
p.wavefronts_per_cu),
62 numWisPerWf(
p.workitems_per_wavefront),
63 numCuTokens(
p.max_cu_tokens),
64 numAtomicLocs(
p.num_atomic_locations),
65 numNormalLocsPerAtomic(
p.num_normal_locs_per_atomic),
66 episodeLength(
p.episode_length),
67 maxNumEpisodes(
p.max_num_episodes),
68 debugTester(
p.debug_tester),
69 cpuThreads(
p.cpu_threads),
70 dmaThreads(
p.dma_threads),
81 DPRINTF(ProtocolTest,
"Creating %s\n",
90 DPRINTF(ProtocolTest,
"Creating %s\n",
99 DPRINTF(ProtocolTest,
"Creating %s\n",
108 DPRINTF(ProtocolTest,
"Creating %s\n",
117 DPRINTF(ProtocolTest,
"Creating %s\n",
139 warn(
"Data race check is not enabled\n");
146 if (
p.random_seed != 0) {
147 rng->init(
p.random_seed);
150 "If `random_seed == 0` (or `random_seed` is unset) "
151 "ProtocolTester does not seed the RNG. This will NOT result in "
152 "the RNG generating different results each run. In this case the "
153 "RNG is seeded by a default value. This differs from behavior in "
154 "previous versions of gem5. Setting `random_seed` to a non-zero "
155 "value is strongly recommended."
166 std::stringstream
ss;
167 ss <<
"GPU Ruby test's configurations" << std::endl
168 <<
"\tNumber of CPUs: " <<
numCpus << std::endl
169 <<
"\tNumber of DMAs: " <<
numDmas << std::endl
170 <<
"\tNumber of CUs: " <<
numCus << std::endl
171 <<
"\tNumber of wavefronts per CU: " <<
numWfsPerCu << std::endl
172 <<
"\tWavefront size: " <<
numWisPerWf << std::endl
173 <<
"\tNumber of atomic locations: " <<
numAtomicLocs << std::endl
174 <<
"\tNumber of non-atomic locations: "
179 <<
"\tRandom seed: " <<
p.random_seed
207 DPRINTF(ProtocolTest,
"Attach threads to ports\n");
210 for (
int cpu_id = 0; cpu_id <
numCpus; ++cpu_id) {
211 cpuThreads[cpu_id]->attachTesterThreadToPorts(
this,
214 cpuThreads[cpu_id]->scheduleDeadlockCheckEvent();
218 for (
int dma_id = 0; dma_id <
numDmas; ++dma_id) {
219 dmaThreads[dma_id]->attachTesterThreadToPorts(
this,
222 dmaThreads[dma_id]->scheduleDeadlockCheckEvent();
227 int vectorPortId = 0;
229 int scalarPortId = 0;
231 for (
int cu_id = 0; cu_id <
numCus; ++cu_id) {
232 vectorPortId = cu_id;
238 wfs[wfId]->attachTesterThreadToPorts(
this,
243 wfs[wfId]->scheduleWakeup();
244 wfs[wfId]->scheduleDeadlockCheckEvent();
252 if (if_name !=
"cpu_ports" && if_name !=
"dma_ports" &&
253 if_name !=
"cu_vector_ports" && if_name !=
"cu_sqc_ports" &&
254 if_name !=
"cu_scalar_ports" && if_name !=
"cu_token_ports") {
258 if (if_name ==
"cpu_ports") {
260 panic(
"ProtocolTester: unknown cpu port %d\n", idx);
262 }
else if (if_name ==
"dma_ports") {
264 panic(
"ProtocolTester: unknown dma port %d\n", idx);
266 }
else if (if_name ==
"cu_vector_ports") {
268 panic(
"ProtocolTester: unknown cu vect port %d\n", idx);
270 }
else if (if_name ==
"cu_sqc_ports") {
272 panic(
"ProtocolTester: unknown cu sqc port %d\n", idx);
274 }
else if (if_name ==
"cu_token_ports") {
276 panic(
"ProtocolTester: unknown cu token port %d\n", idx);
279 assert(if_name ==
"cu_scalar_ports");
281 panic(
"ProtocolTester: unknown cu scal port %d\n", idx);
311 if (!th->checkDRF(atomic_loc, loc, isStore))
316 if (!th->checkDRF(atomic_loc, loc, isStore))
321 if (!th->checkDRF(atomic_loc, loc, isStore))
335 t->printAllOutstandingReqs(
ss);
339 t->printAllOutstandingReqs(
ss);
343 t->printAllOutstandingReqs(
ss);
353 panic(
"GPU Ruby Tester: Failed!\n");
362 safe_cast<ProtocolTester::SenderState*>(pkt->
senderState);
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
virtual std::string name() const
void close(OutputStream *file)
Closes an output file and free the corresponding OutputFile.
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
std::ostream * stream() const
Get the output underlying output stream.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * senderState
This packet's sender state.
Ports are used to interface objects to each other.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
ProtocolTester(const Params &p)
std::vector< GpuWavefront * > wfs
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
std::vector< RequestPort * > cuVectorPorts
AddressManager * addrManager
AddressManager::Location Location
std::vector< RequestPort * > cuSqcPorts
ProtocolTesterParams Params
std::vector< DmaThread * > dmaThreads
bool checkDRF(Location atomic_loc, Location loc, bool isStore) const
std::vector< GMTokenPort * > cuTokenPorts
int numNormalLocsPerAtomic
std::vector< CpuThread * > cpuThreads
std::vector< RequestPort * > cuScalarPorts
std::vector< RequestPort * > dmaPorts
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
std::vector< TokenManager * > cuTokenManagers
std::vector< RequestPort * > cpuPorts
void dumpErrorLog(std::stringstream &ss)
virtual void hitCallback(PacketPtr pkt)=0
#define panic(...)
This implements a cprintf based panic() function.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Copyright (c) 2024 Arm Limited All rights reserved.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
std::string csprintf(const char *format, const Args &...args)
void ccprintf(cp::Print &print)
Declaration of a request, the overall memory request consisting of the parts of the request that are ...