-
Notifications
You must be signed in to change notification settings - Fork 9
121 lines (103 loc) · 3.31 KB
/
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
name: Build
on:
workflow_dispatch:
inputs:
mlir_override:
description: 'Git SHA of commit in tenstorrent/tt-mlir or branch name'
required: false
type: string
workflow_call:
inputs:
mlir_override:
description: 'Git SHA of commit in tenstorrent/tt-mlir or branch name'
required: false
type: string
docker-image:
description: 'Docker image to use for build'
required: true
type: string
permissions:
packages: write
checks: write
pull-requests: write # only required if `comment: true` was enabled
jobs:
forge-build:
strategy:
fail-fast: false
matrix:
build:
- runs-on: [runner]
runs-on:
- in-service
- ${{ matrix.build.runs-on }}
container:
image: ${{ inputs.docker-image }}
steps:
- name: Fetch job id
id: fetch-job-id
uses: tenstorrent/tt-github-actions/.github/actions/job_id@main
with:
job_name: "${{ github.job }}"
- name: Set reusable strings
id: strings
shell: bash
env:
JOB_ID: ${{ steps.fetch-job-id.outputs.job_id }}
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: |
git config --system --add safe.directory ${{ steps.strings.outputs.work-dir }}
chown -R root:root ${{ steps.strings.outputs.work-dir }}
- uses: actions/checkout@v4
with:
submodules: recursive
clean: true
fetch-depth: 0 # Fetch all history and tags
# Clean everything from submodules (needed to avoid issues
# with cmake generated files leftover from previous builds)
- name: Cleanup submodules
run: |
git submodule foreach --recursive git clean -ffdx
git submodule foreach --recursive git reset --hard
- name: Update submodule if mlir_override is set
if: ${{ inputs.mlir_override }}
run: |
cd third_party/tt-mlir
git fetch
git checkout ${{ inputs.mlir_override }}
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: $branch_name, commit: $commit_sha, title: $commit_title"
cd ../..
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ matrix.build.runs-on }}-runtime-${{ matrix.build.enable_runtime }}
- name: Build (creates tvm and tt-forge-fe wheels)
shell: bash
run: |
source env/activate
python3 setup.py bdist_wheel
cd third_party/tvm/python
python3 setup.py bdist_wheel
cd ../../..
cp third_party/tvm/python/dist/*.whl dist/
- name: Run Unit Tests
shell: bash
run: |
source env/activate
pip install dist/forge*.whl --force-reinstall
cmake --build ${{ steps.strings.outputs.build-output-dir }} -- run_unit_tests
- name: Upload Build
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: forge-wheel
path: dist/*.whl