Skip to content

Adding initial executable library benchmarking tool. - #5604

Merged
benvanik merged 1 commit into
mainfrom
benvanik-executable-benchmark
Apr 28, 2021
Merged

benvanik merged 1 commit into
mainfrom
benvanik-executable-benchmark

Conversation

@benvanik

@benvanik benvanik commented Apr 25, 2021 •

Copy link
Copy Markdown
Collaborator

Lots of improvements for configurability are possible; this is the bare minimum.
This tool lets you take an executable library and invoke a single entry point with a flag-defined set of parameters.
Note that it's intentionally low level: you must specify all of the push constant/binding parameters precisely as
they are expected by the executable. iree-benchmark-module is the user-friendly version while this favors
direct access to the executables (bypassing all of the IREE VM, HAL APIs, task system, etc).

An example flagfile:

--executable_format=EX_ELF
--executable_file=D:\Dev\iree\iree\hal\local\elf\testdata\simple_mul_dispatch_x86_64.so
--entry_point=0
--workgroup_count_x=1
--workgroup_count_y=1
--workgroup_count_z=1
--workgroup_size_x=1
--workgroup_size_y=1
--workgroup_size_z=1
--binding=4xf32=1,2,3,4
--binding=4xf32=100,200,300,400
--binding=4xf32=0,0,0,0

And invocation:
iree/hal/local/executable_library_benchmark --flagfile=simple.txt

Yields:

------------------------------------------------------------------------------------------------
Benchmark                                      Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------------------
BM_dispatch/process_time/real_time      0.018 us        0.018 us     39893973 items_per_second=57.0845M/s

Executable libraries can be found in your temp path when compiling with -iree-llvm-keep-linker-artifacts. The parameters used can be inferred from the hal.interface. In the future we could spit out these flagfiles automatically from the compiler for each entry point x each dispatch, but for now hand-constructing them is at least something. It'd also be nice to specify an output path for the executables/flagfiles/etc so that generating a directory of benchmarks for each entry point was easier.

Fixes #5564.

@benvanik benvanik added performance ⚡ Performance/optimization related work across the compiler and runtime hal/cpu Runtime Host/CPU-based HAL backend runtime/tools IREE's runtime tooling (iree-run-module, iree-benchmark-module, etc) labels Apr 25, 2021
@google-cla google-cla Bot added the cla: yes label Apr 25, 2021
@benvanik
benvanik force-pushed the benvanik-executable-benchmark branch from d6ec0be to e01cebc Compare April 25, 2021 18:41
@benvanik
benvanik marked this pull request as ready for review April 25, 2021 18:42
Comment thread iree/testing/benchmark_full.cc Resolved
@benvanik
benvanik force-pushed the benvanik-executable-benchmark branch from e01cebc to ebe489d Compare April 26, 2021 15:11
@benvanik
benvanik force-pushed the benvanik-executable-benchmark branch from ebe489d to 23cd4d5 Compare April 26, 2021 17:54
Base automatically changed from benvanik-flags to main April 28, 2021 17:41
Lots of improvements for configurability are possible; this is the
bare minimum.

Fixes #5564.
@benvanik
benvanik force-pushed the benvanik-executable-benchmark branch from 23cd4d5 to fd5621f Compare April 28, 2021 17:43
@benvanik
benvanik merged commit cb54341 into main Apr 28, 2021
@benvanik
benvanik deleted the benvanik-executable-benchmark branch April 28, 2021 18:01
simon-camp pushed a commit to simon-camp/iree that referenced this pull request Apr 29, 2021
Lots of improvements for configurability are possible; this is the
bare minimum.

Fixes iree-org#5564.
copybara-service Bot pushed a commit that referenced this pull request Apr 29, 2021
* 36522d9 Rotating instead of shifting to deal with overflow. (#5674)
* e130e79 Merge pull request #5671 from ThomasRaoux/handle_vectorization
* 011ffe0 Merge google -> main (#5663)
* 6e16e38 Add vector transfer canonicalization patterns (#5664)
* 95b3030 Add mobilenet_v3 to slim_vision_model_test.py (#5650)
* 0c30c12 Fixing iree_cc_test android goo to use the proper executable name. (#5660)
* cb54341 Adding initial executable benchmarking tool. (#5604)
* 1de68ee Adding iree_task_executor_create_from_flags. (#5616)
* db7f611 Merge pull request #5602 from google/benvanik-flags

COPYBARA_INTEGRATE_REVIEW=#5673 from ThomasRaoux:main-to-google c08d5bd
PiperOrigin-RevId: 371123718
iree-github-actions-bot pushed a commit that referenced this pull request Apr 29, 2021
* 36522d9 Rotating instead of shifting to deal with overflow. (#5674)
* e130e79 Merge pull request #5671 from ThomasRaoux/handle_vectorization
* 011ffe0 Merge google -> main (#5663)
* 6e16e38 Add vector transfer canonicalization patterns (#5664)
* 95b3030 Add mobilenet_v3 to slim_vision_model_test.py (#5650)
* 0c30c12 Fixing iree_cc_test android goo to use the proper executable name. (#5660)
* cb54341 Adding initial executable benchmarking tool. (#5604)
* 1de68ee Adding iree_task_executor_create_from_flags. (#5616)
* db7f611 Merge pull request #5602 from google/benvanik-flags

PiperOrigin-RevId: 371123718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hal/cpu Runtime Host/CPU-based HAL backend performance ⚡ Performance/optimization related work across the compiler and runtime runtime/tools IREE's runtime tooling (iree-run-module, iree-benchmark-module, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a benchmark tool for executable libraries.

4 participants