-
Notifications
You must be signed in to change notification settings - Fork 30
174 lines (152 loc) · 6.27 KB
/
ci_linux_x64_asan-libshortfin.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: CI - shortfin - ASan
on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/ci_linux_x64_asan-libshortfin.yml'
- 'shortfin/**'
push:
branches:
- main
paths:
- '.github/workflows/ci_linux_x64_asan-libshortfin.yml'
- 'shortfin/**'
permissions:
contents: read
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
PYENV_ROOT: ${{ github.workspace }}/pyenv
PYENV_REF: 96b3fb2fc3bee85650cb22e2cb06c83c24509a6d # v2.4.17
PYTHON_VER: 3.12.7
CACHE_ASAN_VER: 2
CACHE_DEPS_VER: 1
IREE_SOURCE_DIR: ${{ github.workspace }}/iree
LIBSHORTFIN_DIR: ${{ github.workspace }}/shortfin/
jobs:
setup-python-asan:
name: Setup Python ASan
runs-on: ubuntu-24.04
env:
# The Python build process leaks. Here we just disable leak checking vs
# being more precise.
ASAN_OPTIONS: detect_leaks=0
steps:
- name: Cache Python ASan
id: cache-python-asan
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ env.PYENV_ROOT }}
key: ${{ runner.os }}-python-asan-${{ env.PYENV_REF }}-${{ env.PYTHON_VER }}-v${{ env.CACHE_ASAN_VER }}
lookup-only: 'true'
- name: Install dependencies
if: steps.cache-python-asan.outputs.cache-hit != 'true'
run: |
sudo apt update
sudo apt install clang lld cmake ninja-build
sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl git libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
- name: Checkout pyenv
if: steps.cache-python-asan.outputs.cache-hit != 'true'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: pyenv/pyenv
ref: ${{ env.PYENV_REF }}
path: ${{ env.PYENV_ROOT }}
- name: Install pyenv & Python
if: steps.cache-python-asan.outputs.cache-hit != 'true'
working-directory: ${{ env.PYENV_ROOT }}
run: |
src/configure && make -C src
export PATH=${{ env.PYENV_ROOT }}/bin:$PATH && eval "$(pyenv init -)"
CC=clang-18 CXX=clang++-18 LDFLAGS="-lstdc++" PYTHON_CONFIGURE_OPTS="--with-address-sanitizer" pyenv install -v ${{ env.PYTHON_VER }}
pyenv global ${{ env.PYTHON_VER }}
build-and-test:
name: Build and test shortfin
needs: [setup-python-asan]
runs-on: ubuntu-24.04
env:
# We can't count on being leak free in general (i.e. pip, etc) so disable
# leak checker by default. Here we suppress any ASAN features needed to
# pass the build. Test configuration is done specially just for that step.
ASAN_OPTIONS: detect_leaks=0,detect_odr_violation=0
LSAN_OPTIONS: suppressions=${{ github.workspace }}/shortfin/build_tools/python_lsan_suppressions.txt
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install dependencies
run: |
sudo apt update
sudo apt install clang lld cmake ninja-build
- name: Checkout IREE repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: iree-org/iree
path: ${{ env.IREE_SOURCE_DIR }}
submodules: false
ref: iree-3.1.0rc20241204
- name: Initalize IREE submodules
working-directory: ${{ env.IREE_SOURCE_DIR }}
run : |
git submodule update --init --depth 1 -- third_party/benchmark
git submodule update --init --depth 1 -- third_party/cpuinfo/
git submodule update --init --depth 1 -- third_party/flatcc
git submodule update --init --depth 1 -- third_party/googletest
git submodule update --init --depth 1 -- third_party/hip-build-deps/
- name: Restore Python dependencies cache
id: cache-python-deps-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.PYENV_ROOT }}
key: ${{ runner.os }}-python-deps-${{ hashFiles('shortfin/requirements-tests.txt') }}-v${{ env.CACHE_DEPS_VER }}
- name: Restore Python ASan cache
id: cache-python-asan
if: steps.cache-python-deps-restore.outputs.cache-hit != 'true'
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.PYENV_ROOT }}
key: ${{ runner.os }}-python-asan-${{ env.PYENV_REF }}-${{ env.PYTHON_VER }}-v${{ env.CACHE_ASAN_VER }}
- name: Set path
run:
echo "${{ env.PYENV_ROOT }}/bin" >> $GITHUB_PATH
- name: Install Python dependencies
if: steps.cache-python-deps-restore.outputs.cache-hit != 'true'
working-directory: ${{ env.LIBSHORTFIN_DIR }}
run: |
eval "$(pyenv init -)"
pip install -r requirements-tests.txt
pip install -r requirements-iree-compiler.txt
pip freeze
- name: Save Python dependencies cache
if: steps.cache-python-deps-restore.outputs.cache-hit != 'true'
id: cache-python-deps-save
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.PYENV_ROOT }}
key: ${{ steps.cache-python-deps-restore.outputs.cache-primary-key }}
- name: Build shortfin
working-directory: ${{ env.LIBSHORTFIN_DIR }}
run: |
eval "$(pyenv init -)"
SHORTFIN_IREE_SOURCE_DIR="${{ env.IREE_SOURCE_DIR }}" \
SHORTFIN_ENABLE_ASAN=ON \
SHORTFIN_DEV_MODE=ON \
SHORTFIN_RUN_CTESTS=ON \
pip install -v -e .
- name: Run pytest
if: ${{ !cancelled() }}
env:
# TODO(#151): Don't ignore ODR violations
ASAN_OPTIONS: detect_odr_violation=0
working-directory: ${{ env.LIBSHORTFIN_DIR }}
run: |
eval "$(pyenv init -)"
pytest -s