iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.76k stars 600 forks source link

Add detailed documentation for small binary size runtime integration #13111

Open ScottTodd opened 1 year ago

ScottTodd commented 1 year ago

Background

I've had ideas floating around since #7116 for some sort of step-by-step documentation explaining how to achieve small binary sizes (and low overheads, etc.) with IREE's runtime. I'm leaning towards writing a blog post with an accompanying sample project/repo, but this could also involve extending and touching up our existing samples and code documentation.

We already have these resources, but I'd like something that includes explanations side by side with code:

Other pages I'm looking at for inspiration:

Note: while I'm focusing on "small binary size" in the framing here, I think this sort of documentation could be a good fit for answering questions like "how do I use and evaluate IREE?" à la #7116 too. The focus doesn't need to be on "how do I get the smallest possible binary?" - answering "what does IREE do? what is inside a compiled program?" will be useful for a general audience.

Outline

Demonstrate step by step how to start from a fully general application (e.g. iree-run-module or hello_world from iree/runtime/demo) and make incremental changes from that baseline to an optimized, deployment-ready program. Each incremental step should be accompanied with an analysis using tools and then an explanation of what changes to make and what their tradeoffs are.

Tools to run (include screenshots and/or text exports):

Work in progress

Sketch source code, screenshots, and notes are here

benvanik commented 1 year ago

https://binary.ninja/ is also fantastic - I've been using it more than cutter recently - it's full version supporting plugins/scripting is pretty expensive but the base one can do arm/x86 but doesn't support riscv yet.