-
Notifications
You must be signed in to change notification settings - Fork 405
89 lines (80 loc) · 2.88 KB
/
Copy pathexecutorch-static-linux.yml
File metadata and controls
89 lines (80 loc) · 2.88 KB
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
name: ExecuTorch Static Linux Build
on:
workflow_call:
inputs:
build-matrix:
description: "Build matrix to utilize"
default: ""
type: string
repository:
description: 'Repository to checkout, defaults to ""'
default: ""
type: string
ref:
description: 'Reference to checkout, defaults to ""'
default: ""
type: string
test-infra-repository:
description: "Test infra repository to use"
default: "pytorch/test-infra"
type: string
test-infra-ref:
description: "Test infra reference to use"
default: ""
type: string
jobs:
select-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.pick.outputs.matrix }}
steps:
- id: pick
env:
FULL_MATRIX: ${{ inputs.build-matrix }}
run: |
set -euo pipefail
python - <<'PY' >> "${GITHUB_OUTPUT}"
import json
import os
matrix = json.loads(os.environ["FULL_MATRIX"])
include = matrix.get("include", [])
if not include:
raise SystemExit("build-matrix include[] is empty")
preferred = None
for entry in include:
if entry.get("python_version") == "3.11":
preferred = entry
break
if preferred is None:
preferred = include[0]
print("matrix=" + json.dumps({"include": [preferred]}))
PY
build:
needs: select-matrix
uses: ./.github/workflows/linux-test.yml
with:
job-name: executorch-static-build
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
test-infra-repository: ${{ inputs.test-infra-repository }}
test-infra-ref: ${{ inputs.test-infra-ref }}
build-matrix: ${{ needs.select-matrix.outputs.matrix }}
script: |
set -euo pipefail
EXECUTORCH_SRC="${RUNNER_TEMP}/executorch"
EXECUTORCH_BUILD="${EXECUTORCH_SRC}/cmake-out"
git clone --depth 1 https://github.com/pytorch/executorch.git "${EXECUTORCH_SRC}"
cmake -S "${EXECUTORCH_SRC}" -B "${EXECUTORCH_BUILD}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=OFF \
-DEXECUTORCH_BUILD_PYBIND=OFF \
-DEXECUTORCH_BUILD_PORTABLE_OPS=OFF
cmake --build "${EXECUTORCH_BUILD}" --target executorch_core -j"$(nproc)"
TORCH_CMAKE_PREFIX="$(python3 -c 'import torch; print(torch.utils.cmake_prefix_path)')"
cmake -S . -B build-executorch \
-DCMAKE_PREFIX_PATH="${TORCH_CMAKE_PREFIX}" \
-DBUILD_TORCHTRT_EXECUTORCH=ON \
-DEXECUTORCH_ROOT="${EXECUTORCH_SRC}" \
-DEXECUTORCH_CORE_LIBRARY="${EXECUTORCH_BUILD}/libexecutorch_core.a"
cmake --build build-executorch --target trt_executor_runner -j"$(nproc)"