Skip to content

Commit

Permalink
add hw prefetchers to prefetch factory
Browse files Browse the repository at this point in the history
swap memory and core initialization to stop seg fault in prefetch init
  • Loading branch information
mgoldstein322 committed Jul 18, 2024
1 parent 37ef1cb commit 8136d00
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/macsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,12 @@ void macsim_c::initialize(int argc, char** argv) {
new manifold::kernel::Clock(1); // clock has to be global or static
#endif

// initialize cores
init_cores(m_num_sim_cores);

// init memory
init_memory();

// initialize cores
init_cores(m_num_sim_cores);

// initialize some of my output streams to the standards */
init_output_streams();

Expand Down
17 changes: 17 additions & 0 deletions src/memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,23 @@ int dcu_c::access(uop_c* uop) {
else if (req_type == MRT_DPRF) {
return m_latency;
}

// // TODO: insert hardware prefetch code here? -- need to init somewhere
// if (*m_simBase->m_knobs->KNOB_PREF_2DC_ON) {
// //
// }

// if (*m_simBase->m_knobs->KNOB_PREF_STREAM_ON) {
// //
// }

// if (*m_simBase->m_knobs->KNOB_PREF_STRIDE_ON) {
// //
// }

// if (*m_simBase->m_knobs->KNOB_PREF_GHB_ON) {
// //
// }
} // !cache_hit

return -1; // cache miss
Expand Down
26 changes: 24 additions & 2 deletions src/pref_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,35 @@ POSSIBILITY OF SUCH DAMAGE.
#include "pref_factory.h"
#include "assert.h"
#include "pref_stride.h"
#include "all_knobs.h"
#include "hw_prefetcher/pref_2dc.h"
#include "hw_prefetcher/pref_ghb.h"
#include "hw_prefetcher/pref_stream.h"
#include "hw_prefetcher/pref_stridepc.h"

///////////////////////////////////////////////////////////////////////////////////////////////

void pref_factory(vector<pref_base_c *> &pref_table, hwp_common_c *hcc,
Unit_Type type, macsim_c *simBase) {
pref_base_c *pref_stride = new pref_stride_c(hcc, type, simBase);
pref_table.push_back(pref_stride);
pref_base_c *pref = nullptr;
if (*simBase->m_knobs->KNOB_PREF_2DC_ON) {
pref = new pref_2dc_c(hcc, type, simBase);
}

if (*simBase->m_knobs->KNOB_PREF_GHB_ON) {
pref = new pref_ghb_c(hcc, type, simBase);
}

if (*simBase->m_knobs->KNOB_PREF_STREAM_ON) {
pref = new pref_stream_c(hcc, type, simBase);
}

if (*simBase->m_knobs->KNOB_PREF_STRIDEPC_ON) {
pref = new pref_stridepc_c(hcc, type, simBase);
}

assert(pref != nullptr);
pref_table.push_back(pref);
}

// Singleton pointer to pref_factory_c
Expand Down

0 comments on commit 8136d00

Please sign in to comment.