Skip to content

Commit

Permalink
[build] fixup script for cleaning the build (#534)
Browse files Browse the repository at this point in the history
The way `tt-mlir` builds the environment and the toolchain has changed,
so now if you delete the environment directories, everything will need
to be rebuilt (including LLVM, Flatbuffers, etc.).

Since cleaning everything (including toolchains) is rarely needed,
update the script to leave `env/build` dirs intact and rename it to
`clean_build.sh`.

Also, tidying up the build docs...
  • Loading branch information
pilkicTT authored Oct 25, 2024
1 parent 3c26306 commit f99c4b8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
10 changes: 0 additions & 10 deletions clean_all.sh

This file was deleted.

12 changes: 12 additions & 0 deletions clean_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC

# SPDX-License-Identifier: Apache-2.0

# Cleans all build artifacts, except for the environment and toolchains.
# If you want to clean the environment (should be rarely needed), remove the env/build directories.
# E.g. rm -rf env/build third_party/tt-mlir/env/build

rm -rf build
rm -rf third_party/tt-mlir/build
rm -rf third_party/tt-mlir/third_party/tt-metal
rm -rf third_party/tvm/build
17 changes: 12 additions & 5 deletions docs/src/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,32 @@ cmake --build build -- docs
mdbook serve build/docs
```

> **NOTE:** `mdbook serve` will by default create a local server at `http://localhost:3000`.
> **Note:** `mdbook serve` will by default create a local server at `http://localhost:3000`.
## Build Cleanup

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

1. **Clean Forge FE build artifacts**:
1. **Clean only 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
./clean_build.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:** 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._
> **Note:** `clean_build.sh` script will not clean toolchain (LLVM) build artifacts and dependencies.

3. **Clean everything (including environment):**
```sh
./clean_build.sh
rm -rf env/build third_party/tt-mlir/env/build
```
> **Note:** This should rarely be needed, as it removes the entire build and environment (consequently entire toolchain will need to be rebuilt).

## 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.
Expand Down

0 comments on commit f99c4b8

Please sign in to comment.