Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/45519 )
Change subject: cpu: Stop using macros for constants in the
multiperpsective_perceptron.
......................................................................
cpu: Stop using macros for constants in the multiperpsective_perceptron.
Enums work just as well and respect namespaces and scopes.
Change-Id: If726ff325be7114c9a749f5f4e1a193552a24c2b
---
M src/cpu/pred/multiperspective_perceptron.cc
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/cpu/pred/multiperspective_perceptron.cc
b/src/cpu/pred/multiperspective_perceptron.cc
index f46241b..5c07c9a 100644
--- a/src/cpu/pred/multiperspective_perceptron.cc
+++ b/src/cpu/pred/multiperspective_perceptron.cc
@@ -672,18 +672,21 @@
train(tid, *bi, taken);
}
-#define RECORD_FILTERED_IMLI 1
-#define RECORD_FILTERED_GHIST 2
-#define RECORD_FILTERED_PATH 4
-#define RECORD_FILTERED_ACYCLIC 8
-#define RECORD_FILTERED_MOD 16
-#define RECORD_FILTERED_BLURRY 32
-// should never record a filtered local branch - duh!
-#define RECORD_FILTERED_LOCAL 64
-#define RECORD_FILTERED_RECENCY 128
+ enum RecordFiltered
+ {
+ Imli = 1,
+ Ghist = 2,
+ Path = 4,
+ Acyclic = 8,
+ Mod = 16,
+ Blurry = 32,
+ // Should never record a filtered local branch - duh!
+ Local = 64,
+ Recency = 128
+ };
// four different styles of IMLI
- if (!bi->filtered || (record_mask & RECORD_FILTERED_IMLI)) {
+ if (!bi->filtered || (record_mask & Imli)) {
unsigned int target = corrTarget;
if (target < bi->getPC()) {
if (taken) {
@@ -713,7 +716,7 @@
bool hashed_taken = hash_taken ? (taken ^ !!(bi->getPC() & (1<<pcbit)))
: taken;
// record into ghist
- if (!bi->filtered || (record_mask & RECORD_FILTERED_GHIST)) {
+ if (!bi->filtered || (record_mask & Ghist)) {
bool ab = hashed_taken;
assert(threadData[tid]->ghist_words.size() > 0);
for (int i = 0; i < ghist_length / blockSize + 1; i += 1) {
@@ -728,7 +731,7 @@
}
// record into path history
- if (!bi->filtered || (record_mask & RECORD_FILTERED_PATH)) {
+ if (!bi->filtered || (record_mask & Path)) {
assert(threadData[tid]->path_history.size() > 0);
memmove(&threadData[tid]->path_history[1],
&threadData[tid]->path_history[0],
@@ -737,12 +740,12 @@
}
// record into acyclic history
- if (!bi->filtered || (record_mask & RECORD_FILTERED_ACYCLIC)) {
+ if (!bi->filtered || (record_mask & Acyclic)) {
threadData[tid]->updateAcyclic(hashed_taken, bi->getHPC());
}
// record into modulo path history
- if (!bi->filtered || (record_mask & RECORD_FILTERED_MOD)) {
+ if (!bi->filtered || (record_mask & Mod)) {
for (int ii = 0; ii < modpath_indices.size(); ii += 1) {
int i = modpath_indices[ii];
if (bi->getHPC() % (i + 2) == 0) {
@@ -755,7 +758,7 @@
}
// update blurry history
- if (!bi->filtered || (record_mask & RECORD_FILTERED_BLURRY)) {
+ if (!bi->filtered || (record_mask & Blurry)) {
std::vector<std::vector<unsigned int>> &blurrypath_histories =
threadData[tid]->blurrypath_histories;
@@ -775,7 +778,7 @@
}
// record into modulo pattern history
- if (!bi->filtered || (record_mask & RECORD_FILTERED_MOD)) {
+ if (!bi->filtered || (record_mask & Mod)) {
for (int ii = 0; ii < modhist_indices.size(); ii += 1) {
int i = modhist_indices[ii];
if (bi->getHPC() % (i + 2) == 0) {
@@ -790,13 +793,13 @@
// insert this PC into the recency stack
if (doing_recency) {
- if (!bi->filtered || (record_mask & RECORD_FILTERED_RECENCY)) {
+ if (!bi->filtered || (record_mask & Recency)) {
threadData[tid]->insertRecency(bi->getPC2(), assoc);
}
}
// record into a local history
- if (!bi->filtered || (record_mask & RECORD_FILTERED_LOCAL)) {
+ if (!bi->filtered || (record_mask & Local)) {
threadData[tid]->localHistories.update(bi->getPC(), hashed_taken);
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45519
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: If726ff325be7114c9a749f5f4e1a193552a24c2b
Gerrit-Change-Number: 45519
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[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