Skip to content

Commit

Permalink
[Docs] Initial "Introduction" and "Building" sections #58 (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvukobratTT authored Aug 23, 2024
1 parent 1ffc55f commit b61a0ad
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Summary

[Introduction](./introduction.md)
# Introduction
- [Introduction](./introduction.md)

# User Guide
# Project setup
- [Building](./build.md)

- [Building](./build.md)
# User Guide
- [Getting Started](./getting-started.md)
97 changes: 97 additions & 0 deletions docs/src/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Building

Following page describes how to build the project on your local machine.

## Prerequisites
Main project dependencies are:
1. Clang 17
1. Ninja
1. CMake 3.20 or higher
1. Git LFS
1. Python 3.10 or higher

On Ubuntu 22.04 systems, you can install these dependencies using the following commands:
```sh
# Update package list
sudo apt update -y
sudo apt upgrade -y

# Install Clang
sudo apt install clang-17

# Install Ninja
sudo apt install ninja-build

# Install CMake
sudo apt remove cmake -y
pip3 install cmake --upgrade
cmake --version

# Install Git LFS
sudo apt install git-lfs

# Check Python version
python3 --version
```

## Build environment
This is one off step to build the toolchain and create virtual environment for tt-forge. Generally you need to run this step only once, unless you want to update the toolchain (LLVM).

First, it's required to create toolchain directories. Proposed example creates directories in default paths. You can change the paths if you want to use different locations (see build environment section below).
```sh
# FFE related toolchain (dafault path)
sudo mkdir -p /opt/ttforge-toolchain
sudo chown -R $USER /opt/ttforge-toolchain

# MLIR related toolchain (default path)
sudo mkdir -p /opt/ttmlir-toolchain
sudo chown -R $USER /opt/ttmlir-toolchain
```

Build FFE environment:
```sh
# Inicialize required env vars
source env/activate

# Initialize and update submodules
git submodule update --init --recursive -f

# Build environment
cmake -B env/build env
cmake --build env/build
```

## Build Forge
```sh
# Activate virtual environment
source env/activate

# Build Forge
cmake -G Ninja -B build
cmake --build build
```

## Build Cleanup

To ensure a clean build environment, follow these steps to remove existing build artifacts:

1. **Clean Forge FE build artifacts**:
```sh
rm -rf build
```
Note: This command removes the `build` directory and all its contents, effectively cleaning up the build artifacts specific to Forge FE.

2. **Clean all Forge build artifacts**:
```sh
./clean_all.sh
```
Note: This script executes a comprehensive cleanup, removing all build artifacts across the entire Forge project, ensuring a clean slate for subsequent builds.

_Note: `clean_all.sh` script will not clean toolchain (LLVM) build artifacts and dependencies._

## Useful build environment variables
1. `TTMLIR_TOOLCHAIN_DIR` - Specifies the directory where TTMLIR dependencies will be installed. Defaults to `/opt/ttmlir-toolchain` if not defined.
2. `TTMLIR_VENV_DIR` - Specifies the virtual environment directory for TTMLIR. Defaults to `/opt/ttmlir-toolchain/venv` if not defined.
3. `TTFORGE_TOOLCHAIN_DIR` - Specifies the directory where tt-forge dependencies will be installed. Defaults to `/opt/ttforge-toolchain` if not defined.
4. `TTFORGE_VENV_DIR` - Specifies the virtual environment directory for tt-forge. Defaults to `/opt/ttforge-toolchain/venv` if not defined.
5. `TTFORGE_PYTHON_VERSION` - Specifies the Python version to use. Defaults to `python3.10` if not defined.
Empty file added docs/src/getting-started.md
Empty file.
10 changes: 10 additions & 0 deletions docs/src/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Introduction

The **TT-Forge FE** is a graph compiler designed to optimize and transform computational graphs for deep learning models, enhancing their performance and efficiency.

Built on top of the [TT-MLIR](https://docs.tenstorrent.com/tt-mlir/) backend, **TT-Forge FE** is an integral component of the [TT-Forge]() project, which provides a comprehensive suite of tools for optimizing and deploying deep learning models on [Tenstorrent](https://tenstorrent.com/) hardware.

Main project goals are:
- Provide abstraction of many different frontend frameworks (PyTorch, TensorFlow, ONNX, etc.)
- Compile many kinds of model architectures without custom modification and with great performance (e.g. Transformers, CNNs, etc.)
- Abstract all Tenstorrent device architectures (e.g. Wormhole, Blackhole, etc.)

0 comments on commit b61a0ad

Please sign in to comment.