Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjharder committed Apr 24, 2024
1 parent 260c9c2 commit f03fedb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions devlog/2024-02-09-Intro-to-optimizing-packages-on-solus.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ We'll explore how to build packages with advanced compiler techniques in order t

<!-- truncate -->
<!-- cspell:disable-next-line -->

# Cual es la causa

Linux distributions have a lot of control over how a source-based package gets compiled and shipped to users as part of a binary repository. Aggressive and advanced compiler optimization techniques, as well as other methods can be used to provide greater out of the box performance for end users. This can greatly benefit users running on older hardware to provide a snappier end-user experience; reducing time waiting on a heavy workload to finish; or even improved battery life; amongst other improvements.
Expand Down Expand Up @@ -123,6 +124,7 @@ Awesome, these binaries do exactly what we need to benchmark `libwebp`, but, we
One extra step we have to do is ensure these binaries are actually linking against their own library, as upstream developers can have a habit of making sure their binaries don't link against their own libraries and end up being self-contained. Run `ldd` to verify.
<!-- spellchecker:disable -->
```
$ ldd /usr/bin/dwebp
linux-vdso.so.1 (0x00007ffed8733000)
Expand All @@ -135,6 +137,7 @@ $ ldd /usr/bin/dwebp
libz.so.1 => /usr/lib/libz.so.1.3.0 (0x00007f7473200000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007f7473bea000)
```
<!-- spellchecker:enable -->
Awesome in this case both `dwebp` and `cwebp` link against `libwebp.so` so we can be confident that any performance improvements will be applicable to all packages in the repository linking against `libwebp`.
Expand Down Expand Up @@ -224,6 +227,7 @@ Benchmark 1: cwebp ~/PNG_Test.png -o /dev/null
Well... That's interesting. We actually regress in performance for decode performance whilst gaining another small bump in encoding performance. Worse still, we get a bunch of `profile count data file not found [-Wmissing-profile]` warning messages during the optimized build indicating to us our profiling workload isn't comprehensive enough and doesn't cover enough code paths. The lack of a handy `make check` that could be used as a profiling workload is really hurting us here. For now, let's put a pin in exploring PGO, it isn't a dead end but more work needs to be done curating a more comprehensive workload to chuck at it in this particular case, whilst other, easier, optimization techniques are still available to us.

<!-- cspell:disable-next-line -->

## 256 Vector Units go brrrrrr...

The next obvious step is to explore `glibc` hardware capabilities. For those unaware both `clang` and `gnu` compilers provide `x86_64-v2`, `x86_64-v3` and `x86_64-v4` micro-architecture build options on top of the baseline of `x86_64`. These enable the use of targeting additional CPU instruction sets during compilation for better performance. For example, `-sse4.2` for `x86_64-v2`, `-avx2` for `x86_64-v3`, and `-avx512` for `x86_64-v4`.
Expand Down Expand Up @@ -256,6 +260,7 @@ We now see these additional files in the `pspec_x86_64.xml` file
Let's rerun `lld` on `dwebp` after installing the new package and...

<!-- spellchecker:disable -->

```
$ ldd /usr/bin/dwebp
linux-vdso.so.1 (0x00007ffeab5b1000)
Expand All @@ -268,6 +273,7 @@ $ ldd /usr/bin/dwebp
libz.so.1 => /usr/lib/glibc-hwcaps/x86-64-v3/libz.so.1.3 (0x00007f9a34dbb000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007f9a3520b000)
```
<!-- spellchecker:enable -->
We can crucially see that `dwebp` is now loading the `x86-64-v3` built `libwebp.so` lib from `/usr/lib/glibc-hwcaps/x86-64-v3/libwebp.so.7.1.8`, success! Let's what our performance looks like.
Expand Down Expand Up @@ -396,6 +402,7 @@ However, there is some light in this tunnel as various forks of zlib having been
Let's just go for it, replacing Solus' `zlib` package with zlib-ng built in compatible mode. It's a bit scary due to how integral zlib is in a typical Linux install, but, how hard could it be?

<!-- cspell:disable-next-line -->

## I Zee a Purty lil' Package

Well that was simple. Here's what our zlib-ng `package.yml` recipe looks like.
Expand Down Expand Up @@ -429,6 +436,7 @@ install : |
check : |
%ninja_check
```
<!-- spellchecker:enable -->
After building it, all the files seem to be in the right place and the test suite is passing. Let's just install it overwriting our canonical `zlib` package and hope our system doesn't die... I think the word is YOLO.
Expand Down
6 changes: 6 additions & 0 deletions docs/packaging/advanced-config/local-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ sudo eopkg ar Solus https://cdn.getsol.us/repo/unstable/eopkg-index.xml.xz
This should yield output similar to:

<!-- spellchecker:disable -->

```
$ sudo eopkg ar Local /var/lib/solbuild/local/eopkg-index.xml.xz
Repo Local added to system.
Expand All @@ -110,6 +111,7 @@ eopkg-index.xml.xz.sha1sum (40.0 B)100% 765.61 KB/s [00:00:00] [complete
eopkg-index.xml.xz (2.1 MB)100% 914.38 KB/s [00:00:01] [complete]
Package database updated.
```

<!-- spellchecker:enable -->

3. Check that the dependency resolution order is correct so that packages from the local `solbuild` repository are preferred over the upstream Solus repository.
Expand All @@ -131,6 +133,7 @@ To reset the system to use only packages from the official Solus repository, dis
The output should look similar to:

<!-- spellchecker:disable -->

```
$ sudo eopkg disable-repo Local
$ sudo eopkg lr
Expand All @@ -139,11 +142,13 @@ Local [inactive]
Solus [active]
https://cdn.getsol.us/repo/unstable/eopkg-index.xml.xz
```

<!-- spellchecker:enable -->

The "Local" `eopkg` repository can be re-enabled with `sudo eopkg enable-repo Local`.

<!-- spellchecker:disable -->

```
$ sudo eopkg enable-repo Local
$ sudo eopkg lr
Expand All @@ -152,6 +157,7 @@ Local [active]
Solus [active]
https://cdn.getsol.us/repo/unstable/eopkg-index.xml.xz
```

<!-- spellchecker:enable -->

## Closing thoughts
Expand Down
2 changes: 2 additions & 0 deletions docs/packaging/prepare-for-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ Create your own fork of [getsolus/packages](https://github.com/getsolus/packages
Create a local clone of the package repository you just forked. Here we are using the name `solus-packages` and cloning it into our home directoy. The rest of the documentation will presume this structure. You can choose a different name and path but will have to make sure to replace it in every command that refers to the `solus-packages` directory.

<!-- spellchecker:disable -->

```bash
gh repo clone packages ~/solus-packages
```

<!-- spellchecker:enable -->

## Initialize git hooks
Expand Down
1 change: 1 addition & 0 deletions docs/packaging/submitting-a-pull-request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ There are multiple ways to create a Pull Request with GitHub, either from the we
<Admonition type="info">
The text editor used by `github-cli` may not the same one that `git` uses. To change this, consult the [`gh config set` command](https://cli.github.com/manual/gh_config_set).
</Admonition>

</TabItem>
</Tabs>

Expand Down
4 changes: 2 additions & 2 deletions docs/packaging/translation-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Please join our [Matrix rooms](/docs/user/contributing/getting-involved.md#matri

- Strings which include curly braces `{ }` should be translated leaving the curly braces, _and anything inside the braces_, untouched.
- Examples:
<!-- spellchecker:disable -->
<!-- spellchecker:disable -->
- `{DE} Successfully installed, please reboot to continue.` translates to:
- `{DE} Instalado exitosamente, reinicie para continuar.`
- `Successfully Installed {}` translates to:
- `Instalado exitosamente {}`
<!-- spellchecker:enable -->
<!-- spellchecker:enable -->
- Do not translate the following strings; leave them untouched:
- `Packagekit`
- `XDG_SESSION_DESKTOP`
Expand Down

0 comments on commit f03fedb

Please sign in to comment.