Skip to content

Create platform-specific targets in benchmark suites - #9237

Merged
pzread merged 11 commits into
iree-org:mainfrom
pzread:split-bench-suite
Jun 1, 2022
Merged

pzread merged 11 commits into
iree-org:mainfrom
pzread:split-bench-suite

Conversation

@pzread

@pzread pzread commented May 27, 2022 •

Copy link
Copy Markdown
Contributor

As the benchmark suites keeps growing , it wastes time and disk space to build all benchmarks just to run on a specific platform.

This change creates small benchmark suite targets iree-benchmark-suites-<platform>-<architecture> for each platform and architecture, which only include the related benchmarks. For x86_64 benchmark pipeline, it reduces the module artifact size from 1.27GB to 131MB.

It also aligns with the upcoming refactoring for the benchmark framework.

@pzread pzread changed the title Create platform-specific targets for benchmark suites Create platform-specific targets in benchmark suites May 27, 2022
@iree-github-actions-bot

iree-github-actions-bot commented May 27, 2022 •

Copy link
Copy Markdown
Contributor

Abbreviated x86_64 Benchmark Summary (experimental)

@ commit f54f354d9da592a55b3fa0bf2229a4f093f92171 (vs. base 73f5cc76bea6b0935e63b2ca9f64638e1026fbdc)

Improved Benchmarks 🎉

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileNetV2 [fp32,imagenet] (TFLite) 8-thread,full-inference,default-flags with IREE-Dylib @ GCP-c2-standard-16 (CPU-x86\_64-CascadeLake) 6 (vs. 7, 14.29%↓) 6 0

For more information:

@pzread
pzread force-pushed the split-bench-suite branch from a28bb97 to 01ba93d Compare May 27, 2022 20:04
@pzread
pzread marked this pull request as ready for review May 27, 2022 20:05
Comment on lines 137 to 142
# Add benchmarks for all platforms. #
################################################################################
include(android-arm64-v8a.cmake)
include(android-adreno.cmake)
include(android-mali.cmake)
include(linux-x86_64.cmake)

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.

Nice cleanup! :D

@iree-github-actions-bot

iree-github-actions-bot commented May 27, 2022 •

Copy link
Copy Markdown
Contributor

@pzread
pzread requested a review from ScottTodd May 30, 2022 13:41
@ScottTodd ScottTodd added the infrastructure/benchmark Relating to benchmarking infrastructure label May 31, 2022
@pzread
pzread force-pushed the split-bench-suite branch 2 times, most recently from 0c516e9 to 2ef8bcf Compare June 1, 2022 13:29

@antiagainst antiagainst 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.

Super nice! Thanks for cleaning this up! I do have a question inlined. Assuming it works then LGTM!

set(_COMPILATION_FLAGFILE "${_RUN_SPEC_DIR}/compilation_flagfile")
add_custom_command(
OUTPUT "${_COMPILATION_FLAGFILE}"
COMMAND ${CMAKE_COMMAND} -E echo -e -- ${_BENCHMARK_COMPILATION_FLAGS} > "${_COMPILATION_FLAGFILE}"

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.

Hmm, does this actually work properly to generate multi-line files? I used to run into issues previously: #8181 (comment). Is the trick at L302 does it?

@pzread pzread Jun 1, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

L302 transforms the list of flags into <flag1>\\n<flag2>\\n..., echo -e will then turn \n into the real newlines. This should be fine as long as each flag is only one line (no newline character in the flag).

The reason we can't use configure_file or file here is because they will always generate the files regardless of the targets. So it will create the incomplete benchmark suite directories if we only compile for one architecture.

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.

It seems weird to include -- in the flagfile

Also please add a comment noting why we're not using file

@pzread pzread Jun 1, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah.. I thought cmake -E echo is like echo, but it's not, so this trick doesn't work (it doesn't interpret the newline character). Let me find something else..

@pzread pzread Jun 1, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Eventually added a small python script for this. Let me know if you prefer other ways.

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.

Well I'd really prefer that CMake allowed you to easily do simple things, but alas that will never be

@GMNGeoffrey GMNGeoffrey 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.

I still don't like the amount of CMake here, but this definitely seems like an improvement.

Comment thread benchmarks/TFLite/android-mali.cmake Resolved
# INTERNAL; VK_ERROR_DEVICE_LOST; vkQueueSubmit; while invoking native function
# hal.ex.submit_and_wait; while calling import;
# ```
# With current kernel performance and timeouts on Adreno Pixel 4, this means we

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.

Didn't we stop benchmarking on Pixel 4 and switch to another Adreno GPU? Not this PR, but we should see if these can be enabled. @antiagainst

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.

Ah, good catch. Yes, I just turned off Pixel 4 Vulkan benchmarking in #8018. We still benchmark adreno + Vulkan on Moto Edge X30. We can revisit what this comment says, probably after this refactoring PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I prefer not to change the benchmark configs in this PR. We can revisit this later.

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.

Oh yeah, for sure. I just noticed it as a separate thing while reviewing this

# `iree-benchmark-module`.
#
# Parameters:
# SUITE_NAME: A group name this benchmark will join. Each group has its own

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.

It's confusing to have this called "SUITE_NAME" when the cmake function is also called "suite". It would suggest that these are one-to-one, whereas really a suite can be made up of multiple iree_benchmark_suite calls. Can we rename one or the other?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed to GROUP_NAME, hope this one is clearer : )

set(_COMPILATION_FLAGFILE "${_RUN_SPEC_DIR}/compilation_flagfile")
add_custom_command(
OUTPUT "${_COMPILATION_FLAGFILE}"
COMMAND ${CMAKE_COMMAND} -E echo -e -- ${_BENCHMARK_COMPILATION_FLAGS} > "${_COMPILATION_FLAGFILE}"

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.

It seems weird to include -- in the flagfile

Also please add a comment noting why we're not using file

@pzread
pzread force-pushed the split-bench-suite branch from 5634c98 to f54f354 Compare June 1, 2022 22:09
@pzread
pzread merged commit c59155f into iree-org:main Jun 1, 2022
@GMNGeoffrey GMNGeoffrey added the infrastructure Relating to build systems, CI, or testing label Jul 19, 2022
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 infrastructure Relating to build systems, CI, or testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants