blob: 6f82ac3d72df5a2614116e3197dee4d9ed3c0c5b [file] [log] [blame] [view]
Stella Laurenzo14a944b2021-02-22 21:01:43 -08001# Debugging releases playbook
2
3## Tools and Locations
4
5* `.github/workflows/build_package.yml`: Release packaging jobs
6* `build_tools/github_actions/build_dist.py`: Main script to build various
7 release packages (for all platforms). We usually use this when reproing to
8 approximate exactly what the CI does. Assumes a subdirectory of `main_checkout`
9 and writes builds to `iree-build` and `iree-install` as a peer of it. To use
10 locally, just symlink your source dir as `main_checkout` in an empty
11 directory (versus checking out).
12
13## Manylinux releases
14
15The Linux releases are done in a manylinux2014 docker container. At the time of
16this writing, it has gcc 9.3.1 and Python versions 3.5 - 3.9 under `/opt/python`.
17Note that this docker image approximates a 2014 era RHEL distro, patched with
18backported (newer) dev packages. It builds with gcc and BFD linker unless if
19you arrange otherwise. `yum` can be used to get some packages.
20
21Get a docker shell (see exact docker image in build_package.yml workflow):
22
23```shell
24docker run --rm -it -v $(pwd):/work/main_checkout stellaraccident/manylinux2014_x86_64-bazel-3.7.2:latest /bin/bash
25```
26
27Remember that docker runs as root unless if you take steps otherwise. Don't
28touch write files in the `/work/main_checkout` directory to avoid scattering
29root owned files on your workstation.
30
31The default system Python is 2.x, so you must select one of the more modern
32ones:
33
34```shell
35export PATH=/opt/python/cp39-cp39/bin:$PATH
36```
37
38
39Build core installation:
40
41```shell
42# (from within docker)
43cd /work
44python ./main_checkout/build_tools/github_actions/build_dist.py main-dist
45
46# Also supports:
47# main-dist
48# py-runtime-pkg
49# py-xla-compiler-tools-pkg
50# py-tflite-compiler-tools-pkg
51# py-tf-compiler-tools-pkg
52```
53
54You can `git bisect` on the host and keep running the above in the docker
55container. Note that every time you run `build_dist.py`, it deletes the cmake
56cache but otherwise leaves the build directory (so it pays the configure cost
57but is otherwise incremental). You can just `cd iree-build` and run `ninja`
58for faster iteration (after the first build or if changing cmake flags).
59Example:
60
61Extended debugging in the manylinux container:
62
63```shell
64cd /work/iree-build
65# If doing extended debugging in the container, these may make you happier.
Stella Laurenzoa2868a92021-02-23 00:15:16 -080066yum install ccache devtoolset-9-libasan-devel gdb
67
68# Get an LLVM symbolizer.
69yum install llvm9.0
70ln -s /usr/bin/llvm-symbolizer-9.0 /usr/bin/llvm-symbolizer
Stella Laurenzo14a944b2021-02-22 21:01:43 -080071
72# You can manipulate cmake flags. These may get you a better debug experience.
73cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DIREE_ENABLE_ASAN=ON -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold -DIREE_ENABLE_CCACHE=ON .
74
75ninja
76
77# Or you may need this if buggy LLVM tools (like mlir-tblgen) are leaking :(
78ASAN_OPTIONS="detect_leaks=0" ninja
79```
80
81Other tips:
82
83* If debugging the runtime, you may have a better time just building the
84 Release mode `main-dist` package above once, which will drop binaries in the
85 `iree-install` directory. Then build the `py-runtime-pkg` or equiv and
86 iterate further in the build directory. Ditto for TF/XLA/etc.
not-jenni952804a2021-09-08 14:17:27 -070087
88## Testing releases on your fork
89
90To avoid interrupting the regular releases published on the IREE github, you
91can test any changes to the release process on your own fork. Some setup is
92required before these github actions will work on your fork and development
93branch.
94
95To run
96[`schedule_snapshot_release.yml`](https://github.com/google/iree/blob/main/.github/workflows/schedule_snapshot_release.yml),
97comment out
98[this line](https://github.com/google/iree/blob/392449e986493bf710e3da637ebf807715da9ffe/.github/workflows/schedule_snapshot_release.yml#L14):
99```yaml
100# Don't run this in everyone's forks.
101if: github.repository == 'google/iree'
102```
103
104And change the branch from 'main' to the branch you are developing on
105[here](https://github.com/google/iree/blob/392449e986493bf710e3da637ebf807715da9ffe/.github/workflows/schedule_snapshot_release.yml#L37):
106```yaml
107- name: Pushing changes
108 uses: ad-m/github-push-action@v0.6.0
109 with:
110 github_token: ${{ secrets.WRITE_ACCESS_TOKEN }}
111 branch: main
112 tags: true
113```
114
115To speed up
116[`build_package.yml`](https://github.com/google/iree/blob/main/.github/workflows/build_package.yml),
117you may want to comment out some of the builds
118[here](https://github.com/google/iree/blob/392449e986493bf710e3da637ebf807715da9ffe/.github/workflows/build_package.yml#L34-L87).
119The
120[`py-pure-pkgs`](https://github.com/google/iree/blob/392449e986493bf710e3da637ebf807715da9ffe/.github/workflows/build_package.yml#L52)
121build takes only ~2 minutes and the
122[`py-runtime-pkg`](https://github.com/google/iree/blob/392449e986493bf710e3da637ebf807715da9ffe/.github/workflows/build_package.yml#L39)
123build takes ~5, while the others can take several hours.
124
125From your development branch, you can manually run the
126[Schedule Snapshot Release](https://github.com/google/iree/actions/workflows/schedule_snapshot_release.yml)
127action, which invokes the
128[Build Native Release Packages](https://github.com/google/iree/actions/workflows/build_package.yml)
129action, which finally invokes the
130[Validate and Publish Release](https://github.com/google/iree/actions/workflows/validate_and_publish_release.yml)
131action. If you already have a draft release and know the release id, package
132version, and run ID from a previous Build Native Release Packages run, you can
133also manually run just the Validate and Publish Release action.