[Tarantool-patches] [PATCH luajit 1/4][v2] ci: add a workflow for testing with AVX512
Sergey Bronnikov
estetus at gmail.com
Thu Apr 11 16:22:02 MSK 2024
From: Sergey Bronnikov <sergeyb at tarantool.org>
This commit adds a workflow for building and testing with enabled
AVX512.
Needed for tarantool/tarantool#9595
Related to tarantool/tarantool#6787
---
.github/actions/setup-linux/action.yml | 12 +++++
.github/workflows/avx512-build-testing.yml | 54 ++++++++++++++++++++++
test/LuaJIT-tests/lib/ffi/bit64.lua | 2 +-
3 files changed, 67 insertions(+), 1 deletion(-)
create mode 100644 .github/workflows/avx512-build-testing.yml
diff --git a/.github/actions/setup-linux/action.yml b/.github/actions/setup-linux/action.yml
index f0171b83..19bdcfa2 100644
--- a/.github/actions/setup-linux/action.yml
+++ b/.github/actions/setup-linux/action.yml
@@ -17,3 +17,15 @@ runs:
apt -y update
apt -y install cmake gcc make ninja-build perl
shell: bash
+ - name: Detect a presence of AVX512
+ id: avx512_script
+ run: |
+ # Set avx512_support environment variable to 'true' when AVX512
+ # is supported and 'false' otherwise.
+ #
+ # Normally `grep` has the exit status is 0 if a line is
+ # selected, 1 if no lines were selected, and 2 if an error
+ # occurred.
+ avx512_support=$(grep avx /proc/cpuinfo 2>&1 > /dev/null; [[ $? == 0 ]] && echo 0 || echo 1)
+ echo "avx512_support=$avx512_support" >> $GITHUB_OUTPUT
+ shell: bash
diff --git a/.github/workflows/avx512-build-testing.yml b/.github/workflows/avx512-build-testing.yml
new file mode 100644
index 00000000..d70fa661
--- /dev/null
+++ b/.github/workflows/avx512-build-testing.yml
@@ -0,0 +1,54 @@
+name: "AVX512 build testing"
+
+on:
+ push:
+ branches-ignore:
+ - '**-notest'
+ - 'upstream-**'
+ tags-ignore:
+ - '**'
+
+concurrency:
+ # An update of a developer branch cancels the previously
+ # scheduled workflow run for this branch. However, the default
+ # branch, and long-term branch (tarantool/release/2.11,
+ # tarantool/release/2.10, etc) workflow runs are never canceled.
+ #
+ # We use a trick here: define the concurrency group as 'workflow
+ # run ID' + # 'workflow run attempt' because it is a unique
+ # combination for any run. So it effectively discards grouping.
+ #
+ # XXX: we cannot use `github.sha` as a unique identifier because
+ # pushing a tag may cancel a run that works on a branch push
+ # event.
+ group: ${{ startsWith(github.ref, 'refs/heads/tarantool/')
+ && format('{0}-{1}', github.run_id, github.run_attempt)
+ || format('{0}-{1}', github.workflow, github.ref) }}
+ cancel-in-progress: true
+
+jobs:
+ test-avx512:
+ strategy:
+ fail-fast: false
+ runs-on: [self-hosted, regular, x86_64, Linux]
+ steps:
+ - uses: actions/checkout at v4
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: setup Linux
+ uses: ./.github/actions/setup-linux
+ - name: configure
+ if: needs.avx512_script.outputs.avx512_support == 0
+ run: >
+ cmake -S . -B ${{ env.BUILDDIR }}
+ -G Ninja
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DCMAKE_C_FLAGS=-march=skylake-avx512
+ -DCMAKE_C_COMPILER=gcc
+ - name: build
+ if: needs.avx512_script.outputs.avx512_support == 0
+ run: cmake --build ${{ env.BUILDDIR }} --parallel
+ - name: run regression tests
+ if: needs.avx512_script.outputs.avx512_support == 0
+ run: cmake --build ${{ env.BUILDDIR }} --parallel --target LuaJIT-test
diff --git a/test/LuaJIT-tests/lib/ffi/bit64.lua b/test/LuaJIT-tests/lib/ffi/bit64.lua
index d1b47bef..cf3a96eb 100644
--- a/test/LuaJIT-tests/lib/ffi/bit64.lua
+++ b/test/LuaJIT-tests/lib/ffi/bit64.lua
@@ -41,7 +41,7 @@ do --- tobit/band assorted C types
end
end
-do --- tobit/band negative unsigned enum
+do --- tobit/band negative unsigned enum -avx512
local x = ffi.new("uenum_t", -10)
local y = tobit(x)
local z = band(x)
--
2.34.1
More information about the Tarantool-patches
mailing list