Skip to content

Commit

Permalink
doc: add graphviz output for dot-product example
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenithalHourlyRate committed Dec 21, 2024
1 parent 276bc7c commit ff37d35
Show file tree
Hide file tree
Showing 2 changed files with 343 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/content/en/docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,22 @@ bazel run --noallow_analysis_cache_discard //tools:heir-opt -- \
--insert-rotate --cse --canonicalize --collapse-insertion-chains \
--canonicalize --cse /path/to/heir/tests/simd/box_blur_64x64.mlir
```

### Optional: Graphviz visualization of the IR

Getting a visualization of the IR during optimization/transformation might help
you understand what is going on more easily.

Still taking the `dot_product_8.mlir` as an example:

```bash
bazel run --ui_event_filters=-info,-debug,-warning,-stderr,-stdout --noshow_progress --logging=0 //tools:heir-opt -- --wrap-generic --heir-simd-vectorizer $PWD/tests/Examples/openfhe/dot_product_8.mlir --view-op-graph 2> dot_product_8.dot
dot -Tpdf dot_product_8.dot > dot_product_8.pdf
# open pdf in your favorite pdf viewer
```

The diagram is also shown below. It demonstrates that the HEIR SIMD vectorizer
would vectorize the dot-product program (`tensor<8xi16>`) then use
rotate-and-reduce technique to compute the sum.

{{% figure src="/images/dot_product_8.svg" link="/images/dot_product_8.svg" %}}
324 changes: 324 additions & 0 deletions docs/static/images/dot_product_8.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff37d35

Please sign in to comment.