mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-13 05:33:51 -04:00
install: clang-11.x compatible PGO instructions
LLVM/Clang 11.x throws errors for _files_ without any profiling data: error: ../../async.c: Function control flow change detected (hash mismatch) async_write Hash = 72057641800614222 [-Werror,-Wbackend-plugin] This caused multiple issues with the current PGO instructions: * The `pgo` binary failed to link with `meson configure -Db_pgo=use` when doing a full PGO build (since it isn't used in this case); * `footclient` fails to link for the same reason. * `foot` fails to link for the same reason in **partial** PGO builds. The solution is to make sure all binaries that are built in the final phase (`-Db_pgo=use`) have been executed in the _generate_ phase. Doing this also means we can drop `-Wno-missing-profile` and friends. Also add `--sixel` to the `generate-alt-random-writes` command line in the description for a full PGO build. Closes #418
This commit is contained in:
parent
243578d308
commit
3fd9256c02
1 changed files with 17 additions and 11 deletions
28
INSTALL.md
28
INSTALL.md
|
|
@ -185,21 +185,15 @@ slower!) binary.
|
||||||
First, configure the build directory:
|
First, configure the build directory:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export CFLAGS="$CFLAGS -O3 -Wno-missing-profile"
|
export CFLAGS="$CFLAGS -O3"
|
||||||
meson --buildtype=release --prefix=/usr -Db_lto=true ../..
|
meson --buildtype=release --prefix=/usr -Db_lto=true ../..
|
||||||
```
|
```
|
||||||
|
|
||||||
It is **very** important `-O3` is being used here, as GCC-10.1.x and
|
It is **very** important `-O3` is being used here, as GCC-10.1.x and
|
||||||
later have a regression where PGO with `-O2` is **much** slower.
|
later have a regression where PGO with `-O2` is **much** slower.
|
||||||
|
|
||||||
If you are using Clang instead of GCC, use the following `CFLAGS` instead:
|
Clang users **must** add `-Wno-ignored-optimization-argument` to
|
||||||
|
`CFLAGS`.
|
||||||
```sh
|
|
||||||
export CFLAGS="$CFLAGS -O3 \
|
|
||||||
-Wno-ignored-optimization-argument \
|
|
||||||
-Wno-profile-instr-out-of-date \
|
|
||||||
-Wno-profile-instr-unprofiled"
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, tell meson we want to _generate_ profiling data, and build:
|
Then, tell meson we want to _generate_ profiling data, and build:
|
||||||
|
|
||||||
|
|
@ -235,6 +229,8 @@ We will use the `pgo` binary along with input corpus generated by
|
||||||
`scripts/generate-alt-random-writes.py`:
|
`scripts/generate-alt-random-writes.py`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
./footclient --version
|
||||||
|
./foot --version
|
||||||
tmp_file=$(mktemp)
|
tmp_file=$(mktemp)
|
||||||
../../scripts/generate-alt-random-writes \
|
../../scripts/generate-alt-random-writes \
|
||||||
--rows=67 \
|
--rows=67 \
|
||||||
|
|
@ -254,7 +250,12 @@ tmp_file=$(mktemp)
|
||||||
rm ${tmp_file}
|
rm ${tmp_file}
|
||||||
```
|
```
|
||||||
|
|
||||||
The snippet above first creates an (empty) temporary file. Then, it
|
The first step, running `./foot --version` and `./footclient
|
||||||
|
--version` might seem unnecessary, but is needed to ensure we have
|
||||||
|
_some_ profiling data for functions not covered by the PGO helper
|
||||||
|
binary. Without this, the final link phase will fail.
|
||||||
|
|
||||||
|
The snippet above then creates an (empty) temporary file. Then, it
|
||||||
runs a script that generates random escape sequences (if you cat
|
runs a script that generates random escape sequences (if you cat
|
||||||
`${tmp_file}` in a terminal, you’ll see random colored characters all
|
`${tmp_file}` in a terminal, you’ll see random colored characters all
|
||||||
over the screen). Finally, we feed the randomly generated escape
|
over the screen). Finally, we feed the randomly generated escape
|
||||||
|
|
@ -272,14 +273,19 @@ This method requires a running Wayland session.
|
||||||
We will use the script `scripts/generate-alt-random-writes.py`:
|
We will use the script `scripts/generate-alt-random-writes.py`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
./footclient --version
|
||||||
foot_tmp_file=$(mktemp)
|
foot_tmp_file=$(mktemp)
|
||||||
./foot --config=/dev/null --term=xterm sh -c "<path-to-generate-alt-random-writes.py> --scroll --scroll-region --colors-regular --colors-bright --colors-256 --colors-rgb --attr-bold --attr-italic --attr-underline ${foot_tmp_file} && cat ${foot_tmp_file}"
|
./foot --config=/dev/null --term=xterm sh -c "<path-to-generate-alt-random-writes.py> --scroll --scroll-region --colors-regular --colors-bright --colors-256 --colors-rgb --attr-bold --attr-italic --attr-underline --sixel ${foot_tmp_file} && cat ${foot_tmp_file}"
|
||||||
rm ${foot_tmp_file}
|
rm ${foot_tmp_file}
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see a foot window open up, with random colored text. The
|
You should see a foot window open up, with random colored text. The
|
||||||
window should close after ~1-2s.
|
window should close after ~1-2s.
|
||||||
|
|
||||||
|
The first step, `./footclient --version` might seem unnecessary, but
|
||||||
|
is needed to ensure we have _some_ profiling data for
|
||||||
|
`footclient`. Without this, the final link phase will fail.
|
||||||
|
|
||||||
|
|
||||||
##### Use the generated PGO data
|
##### Use the generated PGO data
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue