Skip to content

Add an "executable tutorial" going from zero to tracy on android - #3664

Merged
bjacob merged 6 commits into
iree-org:mainfrom
bjacob:android-tracy-runnable-tutorial
Nov 2, 2020
Merged

bjacob merged 6 commits into
iree-org:mainfrom
bjacob:android-tracy-runnable-tutorial

Conversation

@bjacob

@bjacob bjacob commented Oct 30, 2020 •

Copy link
Copy Markdown
Collaborator

Draft, comments welcome.

The idea is that a beginner would run it a few times, then it'd be
mostly useful as a tutorial to read steps from, not intended to be used
long term as a black box tool.

Just try running it (on a Debian linux desktop, with and Android device attached by ADB). It'll complain a bit that you need to define
environment variables IREE_ROOT and ANDROID_NDK, and once you do that,
it should figure all the rest, including building tracy UI, going
through the whole steps of compiling an android benchmark workload,
running that in tracy, setting up port forwarding, and finally telling
you to run a command to run your (newly built) tracy UI to connect
and show the trace.

benchmark.

Draft, comments welcome.

The idea is that a beginner would run it a few times, then it'd be
mostly useful as a tutorial to read steps from, not intended to be used
long term as a black box tool.

Just try running it. It'll complain a bit that you need to define
environment variables IREE_ROOT and ANDROID_NDK, and once you do that,
it should figure all the rest, including building tracy UI, going
through the whole steps of compiling an android benchmark workload,
running that in tracy, setting up port forwarding, and finally telling
you to run a command to run your (newly built) tracy UI to connect
and show the trace.
@google-cla google-cla Bot added the cla: yes label Oct 30, 2020
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DIREE_BUILD_COMPILER=OFF \
-DIREE_BUILD_SAMPLES=OFF \
-DIREE_HOST_C_COMPILER=`which clang` \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do you want to use the $CXX you define above?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thanks!

@ScottTodd ScottTodd added the platform/android 🤖 Android-specific build, execution, benchmarking, and deployment label Oct 30, 2020
@bjacob
bjacob marked this pull request as ready for review October 30, 2020 19:42
# FUNCTION_INPUTS
# ENTRY_FUNCTION

DEFAULT_IREE_INPUT_MLIR="/tmp/iree/modules/MobileBertSquad/iree_input.mlir"

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.

Lots of Linux/Debian specific things in here. Maybe add a note in the top comment about not being Windows friendly.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

-DIREE_HOST_CXX_COMPILER=`which "$CXX"` \
-DIREE_ENABLE_RUNTIME_TRACING=ON

cmake --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.

Could pick a subset of targets to build instead of building all

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done


print_status "Compiling the input MLIR file into a IREE module..."

IREE_COMPILED_MODULE=/tmp/android_module.fbvm

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.

Suggested change
IREE_COMPILED_MODULE=/tmp/android_module.fbvm
IREE_COMPILED_MODULE=/tmp/android_module.vmfb

vmfb is the preferred extension for these files

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,238 @@
#!/bin/bash

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@bjacob
bjacob requested review from ScottTodd and benvanik October 30, 2020 20:54
echo

print_status "Pushing the IREE benchmarking program to the device..."
adb push "${IREE_BUILD_ANDROID}"/iree/tools/iree-benchmark-module /data/local/tmp

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.

Does this also need to be built (see the cmake --build . --target <targets> above)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

d'oh! thanks!

@bjacob
bjacob merged commit af73a4c into iree-org:main Nov 2, 2020
@hanhanW hanhanW mentioned this pull request Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/android 🤖 Android-specific build, execution, benchmarking, and deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants