Skip to content

Add support for collecting statistics in the benchmark pipeline - #8271

Closed
antiagainst wants to merge 3 commits into
iree-org:mainfrom
antiagainst:compilation-statistics
Closed

antiagainst wants to merge 3 commits into
iree-org:mainfrom
antiagainst:compilation-statistics

Conversation

@antiagainst

@antiagainst antiagainst commented Feb 8, 2022 •

Copy link
Copy Markdown
Member

This commit wires up compilation statistics support in the benchmark
pipeline. We emit additional files during compilation to record compilation
statistics and then pick those files up for displaying either on pull request
or dashboard.

Progress towards #6161 & #7972

@antiagainst antiagainst added infrastructure/benchmark Relating to benchmarking infrastructure buildkite:benchmark labels Feb 8, 2022
@iree-github-actions-bot

iree-github-actions-bot commented Feb 9, 2022 •

Copy link
Copy Markdown
Contributor

@antiagainst
antiagainst force-pushed the compilation-statistics branch 2 times, most recently from 854c671 to 859380c Compare March 7, 2022 19:59
@antiagainst
antiagainst force-pushed the compilation-statistics branch from 859380c to 426d36e Compare March 8, 2022 12:48
@antiagainst
antiagainst marked this pull request as ready for review March 8, 2022 18:39

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scanned through, haven't yet reviewed all files.

Comment on lines 204 to 220
add_custom_command(
OUTPUT "${_VMFB_FILE}"
OUTPUT "${_VMFB_FILE}" "${_VMFB_STAT_FILE}"
COMMAND
"$<TARGET_FILE:iree::tools::iree-translate>"
${_TRANSLATION_ARGS}
${_STATS_FLAGS}
"--mlir-print-op-on-diagnostic=false"
"${_MODULE_SOURCE}"
-o "${_VMFB_FILE}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always generates stats, even if collection (COLLECT_COMPILATION_STATISTICS) is not enabled?
Could add a comment if that's intentional (e.g. "stats generation is cheap, so always perform it, even if not collecting the stats")

Comment on lines +41 to +42
# COLLECT_COMPILATION_STATISTICS: Indidate whether to collect compilation
# statistics.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on what collection actually does? (writes a JSON file to disk when the target is built? Updates a database entry when a binary is ran?)

Comment on lines +72 to 74
"COLLECT_COMPILATION_STATISTICS"
"DRIVER;TARGET_BACKEND;TARGET_ARCHITECTURE"
"BENCHMARK_MODES;BENCHMARK_TOOL;MODULES;TRANSLATION_FLAGS;RUNTIME_FLAGS"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we decouple compilation and compilation statistics collection from execution time benchmarking? It looks like this PR offers no way to track offline statistics for a configuration without tightly coupling that same configuration to an execution time benchmark.

(I have a feeling the answer will be "maybe in the future", but these sorts of infrastructure configurations are harder to split apart once they settle)

@@ -10,6 +10,7 @@ steps:
- label: "Build"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated, but isn't it about time to rename this benchmark.yml instead of benchmark2.yml? :P

Comment on lines +338 to +340
for statistic_index in range(len(statistic_results.statistics)):
statistic_case = statistic_results.statistics[statistic_index]
statistic_info = statistic_case.statistic_info

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If statistic_results.statistics is a list / typical iterable data type, can't you simplify this?

Suggested change
for statistic_index in range(len(statistic_results.statistics)):
statistic_case = statistic_results.statistics[statistic_index]
statistic_info = statistic_case.statistic_info
for statistic_case in statistic_results.statistics:
statistic_info = statistic_case.statistic_info

same above with

for benchmark_index in range(len(benchmark_results.benchmarks)):
    benchmark_case = benchmark_results.benchmarks[benchmark_index]

if you need the index, the pythonic way to iterate is https://stackoverflow.com/a/522578

for idx, val in enumerate(ints):
    print(idx, val)

Comment on lines 197 to +200
RUNTIME_FLAGS
"--task_topology_group_count=1"

COLLECT_COMPILATION_STATISTICS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be a lot of statistics. Is each statistic for each benchmark configuration a new series?

The PR comment shows "[Top 3 out of 332 statistic results showed]". Isn't that going to be really difficult to sift through on the dashboard?

Can we group the statistics or prune the set of configurations that track them?

(Writing to a database then querying that database will offer much more flexibility than continuing to push adhoc updates to https://github.com/google/dana IMO)

@benvanik

benvanik commented Jul 1, 2022

Copy link
Copy Markdown
Collaborator

Closing as obsolete. I believe @pzread has been wiring this up.

@benvanik benvanik closed this Jul 1, 2022
@antiagainst
antiagainst deleted the compilation-statistics branch September 28, 2023 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure/benchmark Relating to benchmarking infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants