-
Notifications
You must be signed in to change notification settings - Fork 59
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
Provide a way to append arch-specific stats to report definitions #508
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: "Summary Performance Report" | ||
style: | ||
decimal_places: 2 | ||
content: | ||
cycles : Total cycles consumed | ||
simple-arch-content: | ||
cpu.core*.rob.stats.total_number_retired : Total Instructions Retired | ||
other-arch-content: | ||
cpu.core*.rob.stats.ipc : IPC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
top.cpu: | ||
core0: | ||
alu0: | ||
extension.difficulty: | ||
color_: "black" | ||
shape_: "diamond" | ||
alu1: | ||
extension.difficulty: | ||
color_: "green" | ||
shape_: "circle" | ||
params: | ||
foo: 555 | ||
top.cpu.core*.alu*.params.ignore_inst_execute_time: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,14 @@ class ReportFileParserYAML | |
*/ | ||
std::stack<bool> in_content_stack_; | ||
|
||
/*! | ||
* \brief Are we accepting the stats inside the current content block? | ||
* An example of when we do not accept stats is when we are parsing | ||
* a content block for an arch that does not match the --arch at the | ||
* command line. | ||
*/ | ||
bool skip_content_leaves_ = false; | ||
|
||
// Did we find an 'ignore' block? | ||
bool in_ignore_ = false; | ||
|
||
|
@@ -302,6 +310,12 @@ class ReportFileParserYAML | |
<< "\" and key \"" << assoc_key << "\" in report " << *r << std::endl; | ||
|
||
if(in_content){ | ||
if(skip_content_leaves_){ | ||
verbose() << indent_() << "Skipping content due to arch mismatch (" | ||
<< assoc_key << " : " << value << ")" << std::endl; | ||
return; | ||
} | ||
|
||
std::string full_name = value; | ||
if(getSubstituteForStatName(full_name, n, captures)){ | ||
r->add(n, full_name); | ||
|
@@ -577,6 +591,10 @@ class ReportFileParserYAML | |
} | ||
|
||
bool isReservedKey_(const std::string& key) const override { | ||
if (key.find("-arch-content") != std::string::npos) { | ||
return true; | ||
} | ||
|
||
return (key == KEY_REPORT | ||
|| key == KEY_SUBREPORT | ||
|| key == KEY_CONTENT | ||
|
@@ -600,6 +618,7 @@ class ReportFileParserYAML | |
|
||
bool handleEnterMap_(const std::string& key, | ||
NavVector& context) override { | ||
|
||
bool in_content = in_content_stack_.top(); | ||
//Report* const r = report_stack_.top(); | ||
sparta_assert(report_stack_.size() > 0); | ||
|
@@ -731,6 +750,52 @@ class ReportFileParserYAML | |
in_content_stack_.push(false); | ||
return false; | ||
}else{ | ||
const auto idx = key.find("-arch-content"); | ||
if (idx != std::string::npos) { | ||
app::Simulation *sim = nullptr; | ||
if (base_report_) { | ||
if (auto ctx = base_report_->getContext()) { | ||
sim = ctx->getSimulation(); | ||
} | ||
} | ||
|
||
if (!sim) { | ||
throw SpartaException("Could not get the app::Simulation to parse key: ") << key; | ||
} | ||
|
||
if (auto sim_config = sim->getSimulationConfiguration()) { | ||
skip_content_leaves_ = true; | ||
bool dash_arch_given = false; | ||
for (const auto &kvp : sim_config->getRunMetadata()) { | ||
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. Might be handy to have sim config to enable a search of a key. |
||
if (kvp.first == "arch") { | ||
dash_arch_given = true; | ||
if (kvp.second + "-arch-content" == key) { | ||
skip_content_leaves_ = false; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (!dash_arch_given) { | ||
skip_content_leaves_ = false; | ||
verbose() << indent_() << "WARNING: You should consider using --arch at " | ||
<< "the command line together with the *-arch-content blocks " | ||
<< "in your report definition YAML file. This content block " | ||
<< "will be treated as normal (not filtered for --arch)." | ||
<< std::endl; | ||
} | ||
|
||
if (skip_content_leaves_) { | ||
verbose() << indent_() << "Skipping '" << key << "' block since it does " | ||
<< "not match the --arch given at the command line."; | ||
} | ||
|
||
in_content_stack_.push(true); | ||
return false; | ||
} else { | ||
throw SpartaException("Could not get the app::SimulationConfiguration to parse key: ") << key; | ||
} | ||
} | ||
|
||
//std::stringstream ss; | ||
//ss << "Unexpected map start (key = \"" << key << "\") outside of a \"content\" section"; | ||
|
@@ -878,6 +943,12 @@ class ReportFileParserYAML | |
} | ||
} | ||
trigger_defn_.reset(); | ||
}else{ | ||
const auto idx = key.find("-arch-content"); | ||
if (idx != std::string::npos) { | ||
skip_content_leaves_ = false; | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wonder if there's value in adding
arch-content
as a constexpr string (keyword) likecontent
:KEY_ARCH_CONTENT
. Of course, you still need to perform thefind
operation as expected