-
Notifications
You must be signed in to change notification settings - Fork 31
170 lines (146 loc) · 5.71 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
# 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 - libshortfin - ASan
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
paths:
- '.github/workflows/ci_linux_x64_asan-libshortfin.yml'
- 'libshortfin/**'
permissions:
contents: read
env:
PYENV_ROOT: ${{ github.workspace }}/pyenv
PYENV_REF: 9ecd803bffaffb949fbdd8c70cb086227f6a3202 # v2.4.10
PYTHON_VER: 3.12.3
CACHE_ASAN_VER: 1
CACHE_DEPS_VER: 1
IREE_SOURCE_DIR: ${{ github.workspace }}/iree
LIBSHORTFIN_DIR: ${{ github.workspace }}/libshortfin/
jobs:
setup-python-asan:
name: Setup Python ASan
runs-on: ubuntu-24.04
steps:
- name: Cache Python ASan
id: cache-python-asan
uses: actions/cache@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 }}
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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'
run: |
cd ${{ env.PYENV_ROOT }}
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 -g ${{ env.PYTHON_VER }}
pyenv global ${{ env.PYTHON_VER }}-debug
build-and-test:
name: Build and test libshortfin
needs: [setup-python-asan]
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install clang lld cmake ninja-build
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: false
- name: Checkout IREE repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: iree-org/iree
path: ${{ env.IREE_SOURCE_DIR }}
submodules: false
- name: Initalize IREE submodules
run : |
cd ${{ env.IREE_SOURCE_DIR }}
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('libshortfin/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'
run: |
eval "$(pyenv init -)"
pip install -r ${{ env.LIBSHORTFIN_DIR }}/requirements-tests.txt
- 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 libshortfin
env:
# TODO(#151): Don't ignore ODR violations
ASAN_OPTIONS=detect_odr_violation: 0
run: |
eval "$(pyenv init -)"
mkdir ${{ env.LIBSHORTFIN_DIR }}/build
cd ${{ env.LIBSHORTFIN_DIR }}/build
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang-18 \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_LINKER_TYPE=LLD \
-DSHORTFIN_BUNDLE_DEPS=ON \
-DSHORTFIN_IREE_SOURCE_DIR=${{ env.IREE_SOURCE_DIR }} \
-DSHORTFIN_BUILD_PYTHON_BINDINGS=ON \
-DSHORTFIN_ENABLE_ASAN=ON \
..
cmake --build . --target all
pip install -v -e .
- name: Run ctest
if: ${{ !cancelled() }}
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd ${{ env.LIBSHORTFIN_DIR }}/build
ctest --timeout 30 --output-on-failure
- name: Run pytest
if: ${{ !cancelled() }}
run: |
eval "$(pyenv init -)"
cd ${{ env.LIBSHORTFIN_DIR }}
pytest -m "not requires_amd_gpu"