From f99c4b8bec0af0bd7b5e32bdf684247f8563bc19 Mon Sep 17 00:00:00 2001 From: Predrag Ilkic <148892209+pilkicTT@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:40:14 +0200 Subject: [PATCH] [build] fixup script for cleaning the build (#534) 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... --- clean_all.sh | 10 ---------- clean_build.sh | 12 ++++++++++++ docs/src/build.md | 17 ++++++++++++----- 3 files changed, 24 insertions(+), 15 deletions(-) delete mode 100755 clean_all.sh create mode 100755 clean_build.sh diff --git a/clean_all.sh b/clean_all.sh deleted file mode 100755 index 13cbfde3b..000000000 --- a/clean_all.sh +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC - -# SPDX-License-Identifier: Apache-2.0 - -rm -rf build -rm -rf env/build -rm -rf third_party/tt-mlir/build -rm -rf third_party/tt-mlir/env/build -rm -rf third_party/tt-mlir/third_party/tt-metal -rm -rf third_party/tvm/build diff --git a/clean_build.sh b/clean_build.sh new file mode 100755 index 000000000..92913ab62 --- /dev/null +++ b/clean_build.sh @@ -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 diff --git a/docs/src/build.md b/docs/src/build.md index e37e53f6e..1ee433d2f 100644 --- a/docs/src/build.md +++ b/docs/src/build.md @@ -85,13 +85,13 @@ 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 ``` @@ -99,11 +99,18 @@ To ensure a clean build environment, follow these steps to remove existing build 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.