AIBench: Memory profiling on Android 10+ devices using Perfetto#484
AIBench: Memory profiling on Android 10+ devices using Perfetto#484KarlSimonsen wants to merge 2 commits into
Conversation
Summary: Pull Request resolved: facebook#483 Add large timeout to main Benchmark runs Differential Revision: D35197481 fbshipit-source-id: 3e9ba606ecee543c6ad1c68e12abb1aefd7132fe
Summary: Use perfetto (built into all Android devices from os 10 on) to generate a native heap profile for analysis. This feature extends the existing SimplePerf cpu-profiling feature by adding a type (cpu vs memory) and optional options field to the config / AIBenchAPI. Options may need to be specified to get useful results for a given benchmark type. Also, results are more interesting on devices running Android OS 12 or at least 11. It does not work at all on devices running less than Android OS 10. For now, we substitute a perfetto_config file for the perfetto_report link instead of the intended flamegraph output link. Output can be observed by downloading the perfetto_data link and importing it into https://ui.perfetto.dev. __Caveats__: 1. Currently, the Perfetto Report link does not bring up the flamegraph directly. See workaround under test cases. 2. More tuning is needed on the default profile options based on the run size and duration. 3. User guidance needs to be documented for how to override the default options when necessary. __AIBenchAPI changes__: Amended the existing aibenchAPI profile argument to use a single bool || dict argument. For example, for a test case below, here is the input: ``` profile={ "profiler": "perfetto", "types": ["memory"], "options": { "shmem_size_bytes": "33554432", "sampling_interval_bytes": "2048", "buffer_size_kb": "262144", "buffer_size2_kb": "2048", "max_file_size_bytes": "200000000" } } ``` And here is what this translates to in the benchmark_config: ``` "profiler": { "enabled": true, "profiler": "perfetto", "types": [ "memory" ], "options": { "shmem_size_bytes": "33554432", "sampling_interval_bytes": "2048", "buffer_size_kb": "262144", "buffer_size2_kb": "2048", "max_file_size_bytes": "200000000" } } ``` In this case, the profiler flavor is redundant since if left unspecified, it will default to "perfetto" unless "cpu" (or nothing) is specified for types. For simpleperf profiling, this argument can simply be ``` profile=True ``` or ``` profile={ "types": ["cpu"] } ``` or ``` profile={ "profiler": "simpleperf" } ``` Reviewed By: axitkhurana Differential Revision: D31508439 fbshipit-source-id: fa1b9b56239e28e8d625fc3916c49700b99f28bb
|
This pull request was exported from Phabricator. Differential Revision: D31508439 |
|
Hi @KarlSimonsen! Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention. You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Summary:
Use perfetto (built into all Android devices from os 10 on) to generate a native heap profile for analysis.
This feature extends the existing SimplePerf cpu-profiling feature by adding a type (cpu vs memory) and optional options field to the config / AIBenchAPI.
Options may need to be specified to get useful results for a given benchmark type. Also, results are more interesting on devices running Android OS 12 or at least 11. It does not work at all on devices running less than Android OS 10.
For now, we substitute a perfetto_config file for the perfetto_report link instead of the intended flamegraph output link.
Output can be observed by downloading the perfetto_data link and importing it into https://ui.perfetto.dev.
Caveats:
AIBenchAPI changes:
Amended the existing aibenchAPI profile argument to use a single bool || dict argument.
For example, for a test case below, here is the input:
And here is what this translates to in the benchmark_config:
In this case, the profiler flavor is redundant since if left unspecified, it will default to "perfetto" unless "cpu" (or nothing) is specified for types.
For simpleperf profiling, this argument can simply be
or
or
Reviewed By: axitkhurana
Differential Revision: D31508439