Skip to content

Commit 19c25b9

Browse files
Add Ubuntu ARM64 runner and packaging to vdf-client HW CI (#320)
* Add Ubuntu ARM64 support for vdf-client HW CI and packaging. This updates Linux FT4222 path selection for arm64 and extends the HW workflow to build, test, and publish architecture-specific Ubuntu artifacts for both amd64 and arm64 runners. Co-authored-by: Cursor <cursoragent@cursor.com> * Tighten Ubuntu/macOS artifact upload paths and CMake arch handling. This limits Linux artifact uploads to the active Ubuntu architecture and makes CMake fail fast on unsupported Linux processors while recognizing common armv8 variants. Co-authored-by: Cursor <cursoragent@cursor.com> * Fail fast on unsupported Linux FT4222 architecture in Makefile. This aligns the Makefile behavior with the install script and CMake by emitting a clear error instead of silently defaulting to the x86_64 library path. Co-authored-by: Cursor <cursoragent@cursor.com> * Normalize Makefile architecture detection for Linux HW builds. Allow ARCH overrides and canonicalize common aliases so FT4222 library selection and asm object gating work reliably across CI environments. Co-authored-by: Cursor <cursoragent@cursor.com> * Ignore local libft4222 staging directory. Exclude src/libft4222 generated by FT4222 setup scripts so local dependency artifacts do not appear as untracked changes. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 8c5842f commit 19c25b9

5 files changed

Lines changed: 76 additions & 22 deletions

File tree

.github/workflows/vdf-client-hw.yml

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
fail-fast: false
3838
matrix:
39-
os: [ubuntu-latest, macos-13-intel, macos-13-arm64, windows-latest]
39+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13-intel, macos-13-arm64, windows-latest]
4040
config: [optimized=1, TSAN=1, ASAN=1]
4141
exclude:
4242
- os: windows-latest
@@ -70,12 +70,12 @@ jobs:
7070
# Apply before build because make TSAN=1 runs ./compile_asm during build.
7171
# See: https://github.com/google/sanitizers/issues/1716
7272
- name: Adjust mmap_rnd_bits before Ubuntu TSAN build/test execution
73-
if: matrix.os == 'ubuntu-latest' && matrix.config == 'TSAN=1'
73+
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'TSAN=1'
7474
run: |
7575
sudo sysctl vm.mmap_rnd_bits=28
7676
7777
- name: Build on Ubuntu
78-
if: matrix.os == 'ubuntu-latest'
78+
if: startsWith(matrix.os, 'ubuntu')
7979
run: |
8080
# Keep mmap_rnd_bits workaround step above this build for TSAN=1:
8181
# make TSAN=1 executes thread-sanitized ./compile_asm during build.
@@ -237,7 +237,7 @@ jobs:
237237
}
238238
239239
- name: Run HW smoke test (Ubuntu/macOS)
240-
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || matrix.os == 'ubuntu-latest')
240+
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu'))
241241
run: |
242242
cd src
243243
# CI runners do not have FT4222 hardware attached; only validate binaries exist.
@@ -249,7 +249,7 @@ jobs:
249249
./emu_hw_vdf_client --list
250250
251251
- name: Run vdf tests (optimized smoke)
252-
if: matrix.config == 'optimized=1' && matrix.os != 'windows-latest' && matrix.os != 'ubuntu-latest'
252+
if: matrix.config == 'optimized=1' && matrix.os != 'windows-latest' && !startsWith(matrix.os, 'ubuntu')
253253
run: |
254254
cd src
255255
echo "Running 1weso_test (fast smoke)"
@@ -258,7 +258,7 @@ jobs:
258258
./2weso_test 1000
259259
260260
- name: Run vdf tests (optimized protected threshold path)
261-
if: matrix.config == 'optimized=1' && matrix.os == 'ubuntu-latest'
261+
if: matrix.config == 'optimized=1' && startsWith(matrix.os, 'ubuntu')
262262
run: |
263263
cd src
264264
echo "Running 1weso_test (fast smoke)"
@@ -280,7 +280,7 @@ jobs:
280280
# it prints to std::cout from multiple threads. Which is allowed by the
281281
# standard
282282
- name: Run prover test (Ubuntu/macOS)
283-
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || matrix.os == 'ubuntu-latest')
283+
if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu'))
284284
run: |
285285
cd src
286286
echo "Running prover_test"
@@ -364,8 +364,25 @@ jobs:
364364
.\vdf_bench.exe square_asm 2000000
365365
if ($LASTEXITCODE -ne 0) { throw "vdf_bench failed with exit code $LASTEXITCODE" }
366366
367-
- name: Upload binaries artifact (Ubuntu/macOS)
368-
if: matrix.os != 'windows-latest' && matrix.config == 'optimized=1'
367+
- name: Upload binaries artifact (Ubuntu)
368+
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1'
369+
uses: actions/upload-artifact@v6
370+
with:
371+
name: binaries-${{ matrix.config }}-${{ matrix.os }}
372+
path: |
373+
src/vdf_client
374+
src/vdf_bench
375+
src/1weso_test
376+
src/2weso_test
377+
src/prover_test
378+
src/emu_hw_test
379+
src/hw_test
380+
src/emu_hw_vdf_client
381+
src/hw_vdf_client
382+
${{ matrix.os == 'ubuntu-24.04-arm' && 'src/hw/libft4222/build-arm-v8/libft4222.so' || 'src/hw/libft4222/build-x86_64/libft4222.so' }}
383+
384+
- name: Upload binaries artifact (macOS)
385+
if: startsWith(matrix.os, 'macos') && matrix.config == 'optimized=1'
369386
uses: actions/upload-artifact@v6
370387
with:
371388
name: binaries-${{ matrix.config }}-${{ matrix.os }}
@@ -379,7 +396,6 @@ jobs:
379396
src/hw_test
380397
src/emu_hw_vdf_client
381398
src/hw_vdf_client
382-
src/hw/libft4222/build-x86_64/libft4222.so
383399
src/hw/libft4222/*.dylib
384400
385401
- name: Upload binaries artifact (Windows)
@@ -402,11 +418,12 @@ jobs:
402418
mpir_gc_x64/*.dll
403419
404420
- name: Assemble Ubuntu .deb (same runner as build)
405-
if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1'
421+
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1'
406422
env:
407423
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}
408424
INSTALLER_VERSION: "${{ github.event_name == 'release' && github.event.release.tag_name || format('0.0.1-{0}', github.run_id) }}"
409-
PLATFORM: "amd64"
425+
PLATFORM: ${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}
426+
LIBFT4222_DIR: ${{ matrix.os == 'ubuntu-24.04-arm' && 'build-arm-v8' || 'build-x86_64' }}
410427
run: |
411428
pip install jinjanator
412429
CLI_DEB_BASE="chiavdf_$INSTALLER_VERSION-1_$PLATFORM"
@@ -422,19 +439,19 @@ jobs:
422439
cp src/hw_test dist/$CLI_DEB_BASE/usr/bin/
423440
cp src/hw_vdf_client dist/$CLI_DEB_BASE/usr/bin/
424441
cp src/emu_hw_vdf_client dist/$CLI_DEB_BASE/usr/bin/
425-
cp src/hw/libft4222/build-x86_64/libft4222.so dist/$CLI_DEB_BASE/usr/lib/
442+
cp "src/hw/libft4222/$LIBFT4222_DIR/libft4222.so" dist/$CLI_DEB_BASE/usr/lib/
426443
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="601c", MODE="0666"' > dist/$CLI_DEB_BASE/etc/udev/rules.d/99-chiavdf.rules
427444
dpkg-deb --build --root-owner-group "dist/$CLI_DEB_BASE"
428445
429446
- name: Upload Ubuntu installer
430-
if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1'
447+
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1'
431448
uses: actions/upload-artifact@v6
432449
with:
433-
name: installer
450+
name: installer-${{ matrix.os }}
434451
path: dist/*.deb
435452

436453
- name: Upload release artifacts
437-
if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1' && github.event_name == 'release'
454+
if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1' && github.event_name == 'release'
438455
env:
439456
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
440457
RELEASE_TAG: ${{ github.event.release.tag_name }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ src/hw_vdf_client
4545

4646
# external library
4747
/src/hw/libft4222
48+
/src/libft4222/
4849

4950
# pyenv
5051
.python-version

scripts/get-libft4222.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,22 @@ install_linux() {
9292
fetch_with_retry "$LINUX_URL" "$LINUX_ARCHIVE" tgz 3
9393
tar -xzf "$LINUX_ARCHIVE" -C "$WORK_DIR"
9494

95+
local linux_arch
96+
linux_arch="$(uname -m)"
97+
local libft4222_dir
98+
case "$linux_arch" in
99+
x86_64) libft4222_dir="build-x86_64" ;;
100+
aarch64|arm64) libft4222_dir="build-arm-v8" ;;
101+
*)
102+
echo "Unsupported Linux architecture for libft4222: $linux_arch" >&2
103+
exit 1
104+
;;
105+
esac
106+
95107
rm -rf "$HW_DIR"
96108
ln -s "$WORK_DIR" "$HW_DIR"
97-
ln -sf "$WORK_DIR/build-x86_64/libft4222.so.1.4.4.170" \
98-
"$WORK_DIR/build-x86_64/libft4222.so"
109+
ln -sf "$WORK_DIR/$libft4222_dir/libft4222.so.1.4.4.170" \
110+
"$WORK_DIR/$libft4222_dir/libft4222.so"
99111
}
100112

101113
install_macos() {

src/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,18 @@ if(BUILD_HW_TOOLS)
458458
)
459459
set(HW_SOCKET_LIBS)
460460
else()
461+
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" HW_ARCH_LOWER)
462+
if(HW_ARCH_LOWER STREQUAL "x86_64" OR HW_ARCH_LOWER STREQUAL "amd64")
463+
set(HW_LIB_DIR "build-x86_64")
464+
elseif(HW_ARCH_LOWER STREQUAL "aarch64" OR HW_ARCH_LOWER STREQUAL "arm64" OR HW_ARCH_LOWER MATCHES "^armv8")
465+
set(HW_LIB_DIR "build-arm-v8")
466+
else()
467+
message(FATAL_ERROR
468+
"Unsupported Linux architecture for FT4222 hardware tools: ${CMAKE_SYSTEM_PROCESSOR}. "
469+
"Expected one of: x86_64, amd64, aarch64, arm64, armv8*.")
470+
endif()
461471
set(HW_LIBS
462-
${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/build-x86_64/libft4222.so
472+
${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/${HW_LIB_DIR}/libft4222.so
463473
)
464474
set(HW_SOCKET_LIBS)
465475
endif()

src/Makefile.vdf-client

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
UNAME := $(shell uname)
2-
ARCH := $(shell uname -m)
2+
# Allow callers/CI to override ARCH, otherwise detect from host.
3+
ARCH ?= $(shell uname -m)
4+
ARCH_CANON := $(ARCH)
5+
ifeq ($(ARCH_CANON),amd64)
6+
ARCH_CANON := x86_64
7+
else ifeq ($(ARCH_CANON),arm64)
8+
ARCH_CANON := aarch64
9+
endif
310
GIT_DESCRIBE := $(strip $(shell git describe --tags --always 2>/dev/null))
411
CHIAVDF_VERSION ?= $(if $(GIT_DESCRIBE),$(GIT_DESCRIBE),dev)
512

@@ -64,7 +71,7 @@ endif
6471
.PHONY: all clean
6572

6673
# Only x86_64 builds use the x86 asm objects
67-
ifeq ($(ARCH),x86_64)
74+
ifeq ($(ARCH_CANON),x86_64)
6875
ASM_OBJS = asm_compiled.o avx2_asm_compiled.o avx512_asm_compiled.o
6976
else
7077
ASM_OBJS =
@@ -108,7 +115,14 @@ HW_LIB = hw/libft4222/libft4222.dylib
108115
HW_FTD2XX_LIB = hw/libft4222/libftd2xx.dylib
109116
HW_LIBS = $(HW_LIB) $(HW_FTD2XX_LIB)
110117
else
111-
HW_LIB = hw/libft4222/build-x86_64/libft4222.so
118+
ifeq ($(ARCH_CANON),x86_64)
119+
HW_LIB_DIR = build-x86_64
120+
else ifeq ($(ARCH_CANON),aarch64)
121+
HW_LIB_DIR = build-arm-v8
122+
else
123+
$(error Unsupported Linux architecture for FT4222 hardware tools: $(ARCH). Expected one of: x86_64, aarch64/arm64, amd64)
124+
endif
125+
HW_LIB = hw/libft4222/$(HW_LIB_DIR)/libft4222.so
112126
HW_LIBS = $(HW_LIB)
113127
endif
114128
endif

0 commit comments

Comments
 (0)