Skip to content

Commit

Permalink
Build with unity in build-artifact.yaml, don't use unity in build.yaml (
Browse files Browse the repository at this point in the history
#15027)

Optimize CI throughput by using Unity for main CI build steps.
Don't use unity in the test builds.
This way we have builds that verify with or without unity.
  • Loading branch information
blozano-tt authored Nov 14, 2024
1 parent 5f04e31 commit 2665f88
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ jobs:
# NOTE: may be inaccurate if we have >1 build runner on the same machine, using the same local cache
ccache -z
# Disable Unity builds to detect any bitrot from not building each TU independently
build_command="./build_metal.sh --build-type ${{ inputs.build-type }} --build-all --enable-ccache --disable-unity-builds"
build_command="./build_metal.sh --build-type ${{ inputs.build-type }} --build-all --enable-ccache"
echo "${{ inputs.tracy }}"
if [ "${{ inputs.tracy }}" = "true" ]; then
build_command="$build_command --enable-profiler"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ jobs:
-e ARCH_NAME=${{ matrix.arch }}
docker_os_arch: ${{ matrix.build.os }}-amd64
run_args: |
nice -n 19 cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build.type }} -DCMAKE_CXX_COMPILER=${{ matrix.build.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.build.c_compiler }} -G Ninja -DTT_METAL_BUILD_TESTS=ON -DTTNN_BUILD_TESTS=ON -DTT_UMD_BUILD_TESTS=ON
nice -n 19 cmake --build build
build_command="./build_metal.sh --build-type ${{ matrix.build.type }} --cxx-compiler-path ${{ matrix.build.cxx_compiler }} --c-compiler-path ${{ matrix.build.c_compiler }} --build-tests --build-programming-examples --disable-unity-builds"
nice -n 19 $build_command
- name: Check disk space
run: |
df -h
Expand Down
20 changes: 19 additions & 1 deletion build_metal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ show_help() {
echo " --build-umd-tests Build umd Testcases."
echo " --build-programming-examples Build programming examples."
echo " --build-tt-train Build tt-train."
echo " --build-all Build all optional components."
echo " --release Set the build type as Release."
echo " --development Set the build type as RelWithDebInfo."
echo " --debug Set the build type as Debug."
echo " --clean Remove build workspaces."
echo " --build-static-libs Build tt_metal (not ttnn) as a static lib (BUILD_SHARED_LIBS=OFF)"
echo " --disable-unity-builds Disable Unity builds"
echo " --cxx-compiler-path Set path to C++ compiler."
echo " --c-compiler-path Set path to C++ compiler."
}

clean() {
Expand All @@ -54,11 +57,13 @@ build_tt_train="OFF"
build_static_libs="OFF"
unity_builds="ON"
build_all="OFF"
cxx_compiler_path=""
c_compiler_path=""

declare -a cmake_args

OPTIONS=h,e,c,t,a,m,s,u,b:,p
LONGOPTIONS=help,build-all,export-compile-commands,enable-ccache,enable-time-trace,enable-asan,enable-msan,enable-tsan,enable-ubsan,build-type:,enable-profiler,install-prefix:,build-tests,build-ttnn-tests,build-metal-tests,build-umd-tests,build-programming-examples,build-tt-train,build-static-libs,disable-unity-builds,release,development,debug,clean
LONGOPTIONS=help,build-all,export-compile-commands,enable-ccache,enable-time-trace,enable-asan,enable-msan,enable-tsan,enable-ubsan,build-type:,enable-profiler,install-prefix:,build-tests,build-ttnn-tests,build-metal-tests,build-umd-tests,build-programming-examples,build-tt-train,build-static-libs,disable-unity-builds,release,development,debug,clean,cxx-compiler-path:,c-compiler-path:

# Parse the options
PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTIONS --name "$0" -- "$@")
Expand Down Expand Up @@ -112,6 +117,10 @@ while true; do
build_all="ON";;
--disable-unity-builds)
unity_builds="OFF";;
--cxx-compiler-path)
cxx_compiler_path="$2";shift;;
--c-compiler-path)
c_compiler_path="$2";shift;;
--release)
build_type="Release";;
--development)
Expand Down Expand Up @@ -175,6 +184,15 @@ cmake_args+=("-G" "Ninja")
cmake_args+=("-DCMAKE_BUILD_TYPE=$build_type")
cmake_args+=("-DCMAKE_INSTALL_PREFIX=$cmake_install_prefix")

if [ "$cxx_compiler_path" != "" ]; then
echo "INFO: C++ compiler: $cxx_compiler_path"
cmake_args+=("-DCMAKE_CXX_COMPILER=$cxx_compiler_path")
fi
if [ "$c_compiler_path" != "" ]; then
echo "INFO: C compiler: $c_compiler_path"
cmake_args+=("-DCMAKE_C_COMPILER=$c_compiler_path")
fi

if [ "$enable_ccache" = "ON" ]; then
cmake_args+=("-DCMAKE_DISABLE_PRECOMPILE_HEADERS=TRUE")
cmake_args+=("-DENABLE_CCACHE=TRUE")
Expand Down

0 comments on commit 2665f88

Please sign in to comment.