Skip to content

Commit 24950db

Browse files
committed
add performance counters in mcp-cache, and update the kitfox configuration file
1 parent 296c9ab commit 24950db

File tree

10 files changed

+1685
-19
lines changed

10 files changed

+1685
-19
lines changed

models/cache/mcp-cache/L1_cache.cpp

+56
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,23 @@ void L1_cache :: process_processor_request (cache_req *request, bool first)
146146

147147
DBG_L1_CACHE_TICK_ID( cout, "###### " << " process_processor_request(): addr= " <<hex<< request->addr <<dec<< ((request->op_type==OpMemLd) ? " LD" : " ST") << "\n" );
148148

149+
#ifdef LIBKITFOX
150+
if(request->op_type==OpMemLd) {
151+
counter.cache.read += 3;
152+
counter.cache.search += 3;
153+
counter.cache.read_tag += 3;
154+
} else {
155+
counter.cache.write += 3;
156+
counter.cache.search += 3;
157+
counter.cache.read_tag += 3;
158+
counter.cache.write_tag += 3;
159+
}
160+
counter.tlb.search += 3;
161+
counter.tlb.read += 3;
162+
counter.tlb.write += 3;
163+
counter.tlb.read_tag += 3;
164+
#endif
165+
149166
/** This code may be modified in the future to enable parallel events while transient (read while waiting for previous read-unblock). For the time being, just assume no parallel events for a single address */
150167
if (mshr->has_match(request->addr))
151168
{
@@ -189,6 +206,17 @@ void L1_cache :: process_processor_request (cache_req *request, bool first)
189206
if (!my_table->has_match (request->addr)) {
190207
DBG_L1_CACHE(cout, " miss.\n");
191208

209+
#ifdef LIBKITFOX
210+
counter.missbuf.search += 3;
211+
counter.missbuf.read_tag += 3;
212+
counter.missbuf.write_tag += 3;
213+
counter.missbuf.write += 3;
214+
counter.prefetch.search += 3;
215+
counter.prefetch.read_tag += 3;
216+
counter.prefetch.write_tag += 3;
217+
counter.prefetch.write += 3;
218+
#endif
219+
192220
/** Check if an invalid block exists already or the LRU block can begin eviction. */
193221
hash_table_entry = my_table->reserve_block_for (request->addr);
194222

@@ -200,6 +228,16 @@ void L1_cache :: process_processor_request (cache_req *request, bool first)
200228
DBG_L1_CACHE(cout, " start eviction line= " <<hex<< my_table->get_replacement_entry(request->addr)->get_line_addr() <<dec<< "\n");
201229

202230
start_eviction (mshr_entry, request);
231+
232+
#ifdef LIBKITFOX
233+
counter.linefill.search += 3;
234+
counter.linefill.write_tag += 3;
235+
counter.linefill.write += 3;
236+
counter.writeback.search += 3;
237+
counter.writeback.write_tag += 3;
238+
counter.writeback.write += 3;
239+
#endif
240+
203241
}
204242
else {
205243
//the client for the victim is in transient, so it must have a stalled request in the
@@ -401,6 +439,24 @@ void L1_cache :: process_peer_and_manager_request(Coh_msg* request)
401439
stall request
402440
*/
403441

442+
#ifdef LIBKITFOX
443+
if(request->rw == 0) {
444+
counter.cache.read += 3;
445+
counter.cache.search += 3;
446+
counter.cache.read_tag += 3;
447+
} else {
448+
counter.cache.write += 3;
449+
counter.cache.search += 3;
450+
counter.cache.read_tag += 3;
451+
counter.cache.write_tag += 3;
452+
}
453+
454+
counter.tlb.search += 3;
455+
counter.tlb.read += 3;
456+
counter.tlb.write += 3;
457+
counter.tlb.read_tag += 3;
458+
#endif
459+
404460
if(request->type == Coh_msg::COH_RPLY) {
405461
DBG_L1_CACHE(cout, " it is a reply.\n");
406462

models/cache/mcp-cache/L2_cache.cpp

+39-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,15 @@ void L2_cache :: process_incoming_coh(Coh_msg* request)
116116
{
117117
DBG_L2_CACHE_TICK_ID(cout, "###### handle_incoming()_coh, srcID= " << request->src_id << " type= " << int(request->type) << " addr=(" <<hex<< request->addr <<dec<< ")" << endl);
118118

119-
119+
#ifdef LIBKITFOX
120+
counter.cache.read_tag += 100;
121+
counter.cache.search += 100;
122+
if (request->rw == 1) { //write
123+
counter.cache.write_tag += 100;
124+
counter.cache.write += 100;
125+
} else
126+
counter.cache.read += 100;
127+
#endif
120128

121129
if(request->type == Coh_msg :: COH_REQ) {
122130
stats_num_reqs++;
@@ -141,6 +149,15 @@ void L2_cache :: process_mem_resp (Mem_msg *request)
141149
{
142150
DBG_L2_CACHE_TICK_ID(cout, "######## process_mem_resp(), addr= " << hex << request->addr << dec << endl);
143151

152+
#ifdef LIBKITFOX
153+
counter.cache.read_tag += 100;
154+
counter.cache.search += 100;
155+
if (request->op_type == OpMemSt) { //write
156+
counter.cache.write_tag += 100;
157+
counter.cache.write += 100;
158+
} else
159+
counter.cache.read += 100;
160+
#endif
144161

145162
if(request->op_type == OpMemLd) {
146163
assert(l2_map);
@@ -225,6 +242,17 @@ void L2_cache::process_client_request (Coh_msg* request, bool first)
225242
{
226243
DBG_L2_CACHE(cout, " L2_cache: request is miss.\n");
227244

245+
#ifdef LIBKITFOX
246+
counter.missbuf.search += 35;
247+
counter.missbuf.read_tag += 35;
248+
counter.missbuf.write_tag += 35;
249+
counter.missbuf.write += 35;
250+
counter.prefetch.search += 35;
251+
counter.prefetch.read_tag += 35;
252+
counter.prefetch.write_tag += 35;
253+
counter.prefetch.write += 35;
254+
#endif
255+
228256
//first check if request is an invalidation request; a missed invalidation request should
229257
//be ignored.
230258
if(managers[0]->is_invalidation_request(request)) {
@@ -259,6 +287,16 @@ void L2_cache::process_client_request (Coh_msg* request, bool first)
259287
assert(mshr->has_match(victim->get_line_addr()) == false); //victim shouldn't have an mshr entry.
260288

261289
start_eviction(victim_manager, request);
290+
291+
#ifdef LIBKITFOX
292+
counter.linefill.search += 35;
293+
counter.linefill.write_tag += 35;
294+
counter.linefill.write += 35;
295+
counter.writeback.search += 35;
296+
counter.writeback.write_tag += 35;
297+
counter.writeback.write += 35;
298+
#endif
299+
262300
}
263301
else
264302
{

models/cache/mcp-cache/LLP_cache.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class LLP_cache : public L1_cache {
1515
public:
1616
friend class MuxDemux;
1717

18-
enum {PORT_LOCAL_L2=2};
18+
enum {PORT_LOCAL_L2=3};
1919

2020
// enum {LLP_ID=234, LLS_ID};
2121

models/cache/mcp-cache/LLS_cache.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class LLS_cache : public L2_cache {
1515
public:
1616
friend class MuxDemux;
1717

18-
enum {PORT_L1=0, PORT_LOCAL_L1};
18+
// enum {PORT_L1=0, PORT_LOCAL_L1=2};
19+
enum {PORT_LOCAL_L1=3};
1920

2021
LLS_cache (int nid, const cache_settings&, const L2_cache_settings&);
2122
~LLS_cache (void);

models/kitfox/proxy/kitfox_proxy.cc

+6
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,12 @@ void kitfox_proxy_t::calculate_power(manifold::uarch::cache_counter_t c, manifol
629629
assert(comp_id != INVALID_COMP_ID);
630630
kitfox->calculate_power(comp_id, t, m_clk->period, c.cache);
631631

632+
// tlb
633+
comp = prefix + ".tlb";
634+
comp_id = kitfox->get_component_id(comp);
635+
assert(comp_id != INVALID_COMP_ID);
636+
kitfox->calculate_power(comp_id, t, m_clk->period, c.cache);
637+
632638
// prefetch
633639
comp = prefix + ".prefetch";
634640
comp_id = kitfox->get_component_id(comp);

models/kitfox/proxy/kitfox_proxy.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,22 @@ void kitfox_proxy_t::handle_kitfox_proxy_response(int temp, kitfox_proxy_request
104104
assert(package_id != INVALID_COMP_ID);
105105
kitfox->calculate_temperature(package_id, Req->get_time(), m_clk->period);
106106

107-
for(unsigned int i = 0; i < manifold_node.size(); i++){
107+
for(unsigned int i = 0, core_id = 0, l1_id = 0, l2_id = 0; i < manifold_node.size(); i++){
108108
libKitFox::Kelvin t;
109109
string partition;
110110
libKitFox::Comp_ID par_id;
111111

112112
switch (manifold_node[i].second) {
113113
case manifold::uarch::KitFoxType::core_type: {
114-
partition = "package.core_die.core" + std::to_string(i);
114+
partition = "package.core_die.core" + std::to_string(core_id++);
115115
break;
116116
}
117117
case manifold::uarch::KitFoxType::l1cache_type: {
118-
partition = "package.core_die.l1cache" + std::to_string(i);
118+
partition = "package.core_die.l1cache" + std::to_string(l1_id++);
119119
break;
120120
}
121121
case manifold::uarch::KitFoxType::l2cache_type: {
122-
partition = "package.llc_die.cache" + std::to_string(i);
122+
partition = "package.llc_die.cache" + std::to_string(l2_id++);
123123
break;
124124
}
125125
default:

simulator/smp/common/sysBuilder_llp.cc

+1
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ void SysBuilder_llp :: connect_components()
666666
#ifdef LIBKITFOX
667667
if(m_kitfox_builder){
668668
m_proc_builder->connect_proc_kitfox_proxy(m_kitfox_builder);
669+
m_cache_builder->connect_cache_kitfox_proxy(m_kitfox_builder);
669670
}
670671
#endif
671672
}

simulator/smp/config/conf2x2_spx_t6p_llp.a64.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
simulation_stop = 5e6;
1+
simulation_stop = 50e6;
22
default_clock = 1e9;
33
qsim_interrupt_handler_clock = 1e3;
44
kitfox_config = "../config/kitfox-4core.config";

0 commit comments

Comments
 (0)