Skip to content

Commit

Permalink
Use PNG for diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
henrytwo committed Aug 26, 2022
1 parent 41394c6 commit 365dbda
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/ltc_backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Generated files are created in this directory, which is ignored by version contr

## Architecture

![LTC Diagram](ltc_images/ltc_architecture.jpg)
![LTC Diagram](ltc_images/ltc_architecture.png)

### Tracing LTC graph

Expand All @@ -93,7 +93,7 @@ previously registered in `RegisterLazy.cpp`.
Next, `LazyNativeFunctions::tanh` from `LazyNativeFunctions.cpp` is called, which triggers the creation of a `Tanh` node, which is a subclass of `TorchMlirNode` and `torch::lazy::Node`, defined in `LazyIr.h`.
These nodes are then tracked internally by LTC as the computation graph is traced out.

![Tracing Tensors](ltc_images/tracing_tensors.jpg)
![Tracing Tensors](ltc_images/tracing_tensors.png)

### Syncing Tensors

Expand All @@ -109,15 +109,15 @@ creates an instance of `TorchMlirLoweringContext`. Here, the `TorchMlirNode`s ar
Next, `TorchMlirLoweringContext::Build` is executed and the final `jit::Graph` is sent to `torch_mlir::importJitFunctionAsFuncOp` to generate MLIR using the existing infrastructure from Torch-MLIR.
At this point, a `TorchMlirComputation` is created containing the final `mlir::FuncOp`.

![Syncing Tensors](ltc_images/syncing_tensors.jpg)
![Syncing Tensors](ltc_images/syncing_tensors.png)

### Final Compilation and Execution

The `TorchMlirComputation` is sent to the vendor specific implementation of `TorchMlirBackendImpl::Compile` to be handed off to the vendor's compilation stack (if applicable).

Finally, the compiled computation is sent to `TorchMlirBackendImpl::ExecuteComputation` to be executed on the vendor device, which produces some results to be send back to PyTorch.

![Vendor Execution](ltc_images/vendor_execution.jpg)
![Vendor Execution](ltc_images/vendor_execution.png)

## Implementing a custom backend

Expand Down
Binary file removed docs/ltc_images/ltc_architecture.jpg
Binary file not shown.
Binary file added docs/ltc_images/ltc_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/ltc_images/syncing_tensors.jpg
Binary file not shown.
Binary file added docs/ltc_images/syncing_tensors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/ltc_images/tracing_tensors.jpg
Binary file not shown.
Binary file added docs/ltc_images/tracing_tensors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/ltc_images/vendor_execution.jpg
Binary file not shown.
Binary file added docs/ltc_images/vendor_execution.png
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 365dbda

Please sign in to comment.