-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i#7291: support large pages in TLB #7292
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,11 +147,11 @@ namespace drmemtrace { | |
#endif | ||
|
||
static inline int | ||
compute_log2(int value) | ||
compute_log2(long int value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ditto throughout the PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to add an issue replace uses of types with compiler defined sizes in general? I usually prefer to use only stdint types and |
||
{ | ||
int i; | ||
for (i = 0; i < 31; i++) { | ||
if (value == 1 << i) | ||
for (i = 0; i < 63; i++) { | ||
if (value == 1l << i) | ||
return i; | ||
} | ||
// returns -1 if value is not a power of 2. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,10 +52,10 @@ namespace drmemtrace { | |
class snoop_filter_t; | ||
|
||
bool | ||
cache_t::init(int associativity, int line_size, int total_size, caching_device_t *parent, | ||
caching_device_stats_t *stats, prefetcher_t *prefetcher, | ||
cache_inclusion_policy_t inclusion_policy, bool coherent_cache, int id, | ||
snoop_filter_t *snoop_filter, | ||
cache_t::init(int associativity, long int line_size, int total_size, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't total_size, plus the local num_lines below, also need to be 64-bit? Ditto below. |
||
caching_device_t *parent, caching_device_stats_t *stats, | ||
prefetcher_t *prefetcher, cache_inclusion_policy_t inclusion_policy, | ||
bool coherent_cache, int id, snoop_filter_t *snoop_filter, | ||
const std::vector<caching_device_t *> &children) | ||
{ | ||
// Check line_size to avoid divide-by-0. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,12 +54,11 @@ class cache_fifo_t : public cache_t { | |
{ | ||
} | ||
bool | ||
init(int associativity, int line_size, int total_size, caching_device_t *parent, | ||
init(int associativity, long int block_size, int total_size, caching_device_t *parent, | ||
caching_device_stats_t *stats, prefetcher_t *prefetcher = nullptr, | ||
cache_inclusion_policy_t inclusion_policy = | ||
cache_inclusion_policy_t::NON_INC_NON_EXC, | ||
bool coherent_cache = false, int id_ = -1, | ||
snoop_filter_t *snoop_filter_ = nullptr, | ||
bool coherent_cache = false, int id = -1, snoop_filter_t *snoop_filter = nullptr, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a clang-format change across clang-format versions or something? |
||
const std::vector<caching_device_t *> &children = {}) override; | ||
|
||
std::string | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,9 +41,9 @@ | |
#include <utility> | ||
#include <vector> | ||
|
||
#include "memref.h" | ||
#include "caching_device_block.h" | ||
#include "caching_device_stats.h" | ||
#include "memref.h" | ||
#include "prefetcher.h" | ||
#include "snoop_filter.h" | ||
#include "trace_entry.h" | ||
|
@@ -74,7 +74,7 @@ caching_device_t::~caching_device_t() | |
} | ||
|
||
bool | ||
caching_device_t::init(int associativity, int block_size, int num_blocks, | ||
caching_device_t::init(int associativity, long int block_size, int num_blocks, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we widen num_blocks while at it or we are certain 32-bit is plenty? |
||
caching_device_t *parent, caching_device_stats_t *stats, | ||
prefetcher_t *prefetcher, | ||
cache_inclusion_policy_t inclusion_policy, bool coherent_cache, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,12 +63,11 @@ class prefetcher_t; | |
|
||
// NON_INC_NON_EXC = Non-Inclusive Non-Exclusive, aka NINE. | ||
enum class cache_inclusion_policy_t { NON_INC_NON_EXC, INCLUSIVE, EXCLUSIVE }; | ||
|
||
class caching_device_t { | ||
public: | ||
explicit caching_device_t(const std::string &name = "caching_device"); | ||
virtual bool | ||
init(int associativity, int block_size, int num_blocks, caching_device_t *parent, | ||
init(int associativity, long int block_size, int num_blocks, caching_device_t *parent, | ||
caching_device_stats_t *stats, prefetcher_t *prefetcher = nullptr, | ||
cache_inclusion_policy_t inclusion_policy = | ||
cache_inclusion_policy_t::NON_INC_NON_EXC, | ||
|
@@ -110,6 +109,11 @@ class caching_device_t { | |
{ | ||
return parent_; | ||
} | ||
void | ||
set_parent(caching_device_t *parent) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems unrelated to this PR. |
||
{ | ||
parent_ = parent; | ||
} | ||
inline double | ||
get_loaded_fraction() const | ||
{ | ||
|
@@ -143,7 +147,7 @@ class caching_device_t { | |
{ | ||
return associativity_; | ||
} | ||
virtual int | ||
virtual long int | ||
get_block_size() const | ||
{ | ||
return block_size_; | ||
|
@@ -245,8 +249,8 @@ class caching_device_t { | |
init_blocks() = 0; | ||
|
||
int associativity_; | ||
int block_size_; // Also known as line length. | ||
int num_blocks_; // Total number of lines in cache = size / block_size. | ||
long int block_size_; // Also known as line length. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may need a mention in api/docs/release.dox (line 127) as it could break or require changes in third-party code deriving from this: we don't consider non-interface changes as breaking enough to go bump the major version so I would add a new list in between the two existing lists of "minor compatibility changes" (as was done for prior releases below in that file: e.g. line 574). |
||
int num_blocks_; // Total number of lines in cache = size / block_size. | ||
bool coherent_cache_; | ||
// This is an index into snoop filter's array of caches. | ||
int id_; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,15 +115,27 @@ tlb_simulator_t::tlb_simulator_t(const tlb_simulator_knobs_t &knobs) | |
|
||
if (!itlbs_[i]->init(knobs_.TLB_L1I_assoc, (int)knobs_.page_size, | ||
knobs_.TLB_L1I_entries, lltlbs_[i], | ||
new tlb_stats_t((int)knobs_.page_size)) || | ||
!dtlbs_[i]->init(knobs_.TLB_L1D_assoc, (int)knobs_.page_size, | ||
new tlb_stats_t((int)knobs_.page_size))) { | ||
error_string_ = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Since the field change is a minor compatibility break it might be nicer to isolate it and move these unrelated changes to a separate PR; but not going to fight for it. This review system doesn't have a "non-strongly-requested" option so using parentheses; will leave up to you.) |
||
"Usage error: failed to initialize itlbs_. Ensure entry number, " | ||
"page size and associativity are powers of 2."; | ||
success_ = false; | ||
return; | ||
} | ||
if (!dtlbs_[i]->init(knobs_.TLB_L1D_assoc, (int)knobs_.page_size, | ||
knobs_.TLB_L1D_entries, lltlbs_[i], | ||
new tlb_stats_t((int)knobs_.page_size)) || | ||
!lltlbs_[i]->init(knobs_.TLB_L2_assoc, (int)knobs_.page_size, | ||
new tlb_stats_t((int)knobs_.page_size))) { | ||
error_string_ = | ||
"Usage error: failed to initialize dtlbs_. Ensure entry number, " | ||
"page size and associativity are powers of 2."; | ||
success_ = false; | ||
return; | ||
} | ||
if (!lltlbs_[i]->init(knobs_.TLB_L2_assoc, (int)knobs_.page_size, | ||
knobs_.TLB_L2_entries, NULL, | ||
new tlb_stats_t((int)knobs_.page_size))) { | ||
error_string_ = | ||
"Usage error: failed to initialize TLbs_. Ensure entry number, " | ||
"Usage error: failed to initialize lltlbs_. Ensure entry number, " | ||
"page size and associativity are powers of 2."; | ||
success_ = false; | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit:
s/i7291/i#7291/