Repository navigation
102 lines (98 loc) · 3.53 KB
/
Copy pathsimd.yml
File metadata and controls
102 lines (98 loc) · 3.53 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
90
91
92
93
94
95
96
97
98
99
100
101
102
name: simd
# The UTF-8 kernels are compiled with one instruction set fixed at build time, so each level needs a
# build and a run of the differential check (benchmarks/utf8_check) plus the whole C++ suite. The
# scalar level is here to prove the option really changes nothing when it is off.
on:
push:
paths: &paths
- "src/utf8.cpp"
- "include/ycpp/utf8.hpp"
- "benchmarks/**"
- "meson.build"
- "meson.options"
- "subprojects/xsimd.wrap"
- ".github/workflows/simd.yml"
pull_request:
paths: *paths
workflow_dispatch:
concurrency:
group: simd-${{ github.ref }}
cancel-in-progress: true
jobs:
isa:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- { name: scalar, simd: none }
- { name: sse4.2, simd: sse4.2 }
- { name: avx2, simd: avx2 }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Toolchain
run: |
sudo apt-get update
sudo apt-get install -y g++-14
python -m pip install --upgrade pip meson ninja
- name: Runner supports the level
id: cpu
# A runner without AVX2 must not run an -mavx2 binary: the build would work and the first
# kernel call would die with SIGILL. `none` and `sse4.2` are part of x86-64-v1/v2.
run: |
if [ "${{ matrix.simd }}" != "avx2" ] || grep -qw avx2 /proc/cpuinfo; then
echo "ok=1" >> "$GITHUB_OUTPUT"
else
echo "ok=0" >> "$GITHUB_OUTPUT"
echo "::warning::this runner has no AVX2, skipping the avx2 build"
fi
- name: Configure
if: steps.cpu.outputs.ok == '1'
run: >-
CXX=g++-14 meson setup builddir --buildtype=release
-Dsimd=${{ matrix.simd }} -Dutf8_check=true
- name: Build
if: steps.cpu.outputs.ok == '1'
run: ninja -C builddir
- name: Test
if: steps.cpu.outputs.ok == '1'
run: meson test -C builddir --print-errorlogs
python:
name: Python extension (sse4.2)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Toolchain
run: |
sudo apt-get update
sudo apt-get install -y g++-14
python -m pip install --upgrade pip meson ninja pytest hypothesis pycrdt anyio trio pydantic
- name: Configure
# What the wheels build: the extension compiled with the SSE4.2 kernels.
run: >-
CXX=g++-14 meson setup builddir --buildtype=release -Dsimd=sse4.2 -Dpython=enabled
-Dutf8_check=true --prefix="$PWD/stage"
- name: Build and install
run: |
ninja -C builddir
meson install -C builddir
- name: C++ suite
run: meson test -C builddir --print-errorlogs
- name: Python suite
env:
PYTHONPATH: ${{ github.workspace }}/stage/lib/python3.12/site-packages
run: python -m pytest python/tests -q
# The vendored pycrdt suite aliases sys.modules["pycrdt"] to ycpp, so it runs on its own and
# the run above excludes it (norecursedirs in pyproject.toml). Its only skips are the Rust-only
# tests listed in python/README.md.
- name: Vendored pycrdt suite
env:
PYTHONPATH: ${{ github.workspace }}/stage/lib/python3.12/site-packages
run: python -m pytest python/tests/pycrdt_suite -q