-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (113 loc) · 4.37 KB
/
run-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build
on:
workflow_call:
inputs:
mlir_override:
description: 'Git SHA of commit in tenstorrent/tt-mlir'
required: false
type: string
jobs:
build:
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
build: [
{runs-on: n150, name: "run"},
]
runs-on:
- in-service
- ${{ matrix.build.runs-on }}
container:
image: ghcr.io/tenstorrent/tt-torch/tt-torch-ci-ubuntu-22-04:latest
options: --user root --device /dev/tenstorrent/0
volumes:
- /dev/hugepages:/dev/hugepages
- /dev/hugepages-1G:/dev/hugepages-1G
- /etc/udev/rules.d:/etc/udev/rules.d
- /lib/modules:/lib/modules
- /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
- name: Override tt-mlir SHA mlir_override is set
if: ${{ inputs.mlir_override }}
shell: bash
run: |
# Update the CMakeLists.txt file with the new SHA
sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${{ inputs.mlir_override }}\")/" third_party/CMakeLists.txt
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ matrix.build.runs-on }}
# Build project
- name: Configure CMake
shell: bash
run: |
source env/activate
cmake -G Ninja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.install-output-dir }} \
-B ${{ steps.strings.outputs.build-output-dir }} \
-S ${{ steps.strings.outputs.work-dir }}
- name: Build
shell: bash
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }}
cmake --install ${{ steps.strings.outputs.build-output-dir }}
- name: Verify tt-mlir SHA override
if: ${{ inputs.mlir_override }}
continue-on-error: true
shell: bash
run: |
cd third_party/tt-mlir
branch_name=$(git rev-parse --abbrev-ref HEAD)
commit_sha=$(git rev-parse HEAD)
commit_title=$(git log -1 --pretty=%s)
echo "Branch name: $branch_name"
echo "Commit SHA: $commit_sha"
echo "Commit title: $commit_title"
echo "::notice::Using tt-mlir: $branch_name, commit: $commit_sha, title: $commit_title"
cd ../..
- name: Copy tt-metal binaries
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: |
cp ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal-build/lib/*.so lib/
cp ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir-build/bin/ttmlir-opt lib/
- name: Copy tt-metal directories
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: |
mkdir tt-metal
cp -r ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal/tt_metal tt-metal/
cp -r ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal/ttnn tt-metal/
cp -r ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal/runtime tt-metal/
- name: Copy venv directory
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: |
mkdir env
cp -r ${{ steps.strings.outputs.work-dir }}/env/* env
- name: 'Tar install directory'
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: tar cvf artifact.tar .
- name: Upload install folder to archive
uses: actions/upload-artifact@v4
with:
name: install-artifacts
path: ${{ steps.strings.outputs.install-output-dir }}/artifact.tar