Skip to content

Add github workflows for AoR #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
string:
- changed-files:
- any-glob-to-any-file: string/**

networking:
- changed-files:
- any-glob-to-any-file: networking/**

math:
- changed-files:
- any-glob-to-any-file: math/**

fp:
- changed-files:
- any-glob-to-any-file: fp/**

build-system:
- changed-files:
- any-glob-to-any-file: ['Makefile', 'config.mk.dist', '**/*.mk']

15 changes: 15 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: New contributors

on: [pull_request_target]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-message: "Thank you for your contribution to Arm's optimized routines. Contribution to this repository does require a signed contributor's license agreement. See [contributor-agreement.pdf](/contributor-agreement.pdf) for details"
15 changes: 15 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

95 changes: 95 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: build and run

on:
push:
branches: [ "master", "add-ci-aor" ]
pull_request:
branches: [ "master", "add-ci-aor" ]
workflow_dispatch:

jobs:
linux-aarch64-native:
runs-on: ah-ubuntu_24_04-c7g_4x-50
strategy:
matrix:
compiler: ["gcc", "clang-20"]

steps:
- uses: actions/checkout@v4
- name: inspect hardware
run: cat /proc/cpuinfo
- name: install dependencies
run: sudo apt-get install -y libmpfr-dev libmpc-dev wget
- name: install clang
run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20
- name: configure
run: cp config.mk.dist config.mk
- name: make
run: CC="${{ matrix.compiler }}" make -j
- name: make check
run: CC="${{ matrix.compiler }}" V=1 VERBOSE=1 make check -j

linux-x86-64-cross:
runs-on: ubuntu-24.04
strategy:
matrix:
compiler: ["aarch64-linux-gnu-gcc"]

steps:
- uses: actions/checkout@v4
- name: inspect hardware
run: cat /proc/cpuinfo
- name: install dependencies
run: sudo apt-get install -y libmpfr-dev libmpc-dev gcc-aarch64-linux-gnu qemu-user-static
- name: configure
run: cp config.mk.dist config.mk
- name: make
run: CC="${{ matrix.compiler }}" make -j
- name: make check
run: CC="${{ matrix.compiler }}" EMULATOR="qemu-aarch64-static" make check -j
darwin-aarch64-native:
runs-on: macos-15
strategy:
matrix:
compiler: ["gcc-14", "clang"]

steps:
- uses: actions/checkout@v4
- name: install dependencies
run: brew install mpfr libmpc gmp && brew link gmp mpfr
- name: configure
run: cp config.mk.dist config.mk
- name: make
run: CC="${{ matrix.compiler }}" make all -j$(sysctl -n hw.logicalcpu)
- name: make check
run: CC="${{ matrix.compiler }}" make check -j$(sysctl -n hw.logicalcpu)

# windows-x86-64-cross:
# runs-on: windows-latest
# strategy:
# matrix:
# include:
# - { sys: mingw64, base: x86_64, env: cross-mingwarm64, prefix: aarch64-w64-mingw32, compiler: gcc }
# # - { sys: mingw64, base: x86_64, env: cross, prefix: aarch64-w64-mingw32, compiler: clang }
# defaults:
# run:
# shell: msys2 {0}
# steps:
# - uses: actions/checkout@v4
# - uses: msys2/setup-msys2@v2
# with:
# msystem: ${{matrix.sys}}
# install: >
# mingw-w64-${{matrix.base}}-openssl
# mingw-w64-${{matrix.base}}-qemu
# make
# mingw-w64-${{matrix.env}}-${{matrix.compiler}}
# mingw-w64-${{matrix.env}}-binutils
# - name: OS Version
# run: uname -s
# - name: configure
# run: cp config.mk.dist config.mk
# - name: make
# run: CC="/opt/bin/${{matrix.prefix}}-${{matrix.compiler}}.exe" CROSS_COMPILE=/opt/bin/${{matrix.prefix}}- make -j
# - name: make check
# run: CC="/opt/bin/${{matrix.prefix}}-${{matrix.compiler}}.exe" CROSS_COMPILE=/opt/bin/${{matrix.prefix}}- make check -j
5 changes: 5 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* @TamarChristinaArm
fp/* @statham-arm
math/* @blapie @joeramsay
networking/* @WonderfulVoid
string/* @Wilco1
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
INSTALL = install
FP_SUBDIR = none
TEST_BIN_FLAGS = -static

# Detect OS.
# Assume Unix environment: Linux, Darwin, or Msys.
OS := $(shell uname -s)
OS := $(patsubst MSYS%,Msys,$(OS))
OS := $(patsubst MINGW64%,Mingw64,$(OS))

# Following math dependencies can be adjusted in config file
# if necessary, e.g. for Msys.
libm-libs = -lm
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 🚀 Arm Optimized Routines

![master branch](https://github.com/ARM-software/optimized-routines/actions/workflows/tests/badge.svg)

**High-performance, architecture-aware implementations of common library
functions for Arm processors.**

Expand Down
45 changes: 35 additions & 10 deletions config.mk.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ ARCH = aarch64
#CROSS_COMPILE = aarch64-none-linux-gnu-

# Compiler for the target
CC = $(CROSS_COMPILE)gcc
CC ?= $(CROSS_COMPILE)gcc
CFLAGS = -std=c99 -pipe -O3
CFLAGS += -Wall -Wno-missing-braces
CFLAGS += -Werror=implicit-function-declaration

# Used for test case generator that is executed on the host
HOST_CC = gcc
HOST_CC ?= gcc
HOST_CFLAGS = -std=c99 -O2
HOST_CFLAGS += -Wall -Wno-unused-function

Expand Down Expand Up @@ -55,6 +55,7 @@ endif
#CFLAGS += -march=armv8.5-a+memtag -DWANT_MTE_TEST=1

# Use with cross testing.
EMULATOR ?=
#EMULATOR = qemu-aarch64-static
#EMULATOR = sh -c 'scp $$1 user@host:/dir && ssh user@host /dir/"$$@"' --

Expand All @@ -66,7 +67,7 @@ math-testflags =
string-cflags = -falign-functions=64
networking-cflags =

ifeq ($(OS),Msys)
ifneq (,$(filter $(OS),Msys Mingw64))
# Libraries can be installed with pacman
libm-libs = -lmsvcrt -lvcruntime -lucrt
libc-libs =
Expand All @@ -76,12 +77,36 @@ ifeq ($(OS),Msys)
mpfr-libs = $(SYSROOT)/lib/libmpfr.dll.a
gmp-libs = $(SYSROOT)/lib/libgmp.dll.a
mpc-libs = $(SYSROOT)/lib/libmpc.dll.a
# TEST_BIN_FLAGS =
# Clear the default flag -fPIC, as not supported on Windows
CFLAGS_SHARED =
USE_GLIBC_ABI = 0
ifneq ($(ARCH),aarch64)
EMULATOR = "qemu-aarch64-static"
endif
endif

# For Apple Silicon update the paths
ifeq ($(OS),Darwin)
ifeq ($(ARCH),aarch64)
math-cflags += -I/opt/homebrew/include
math-ldlibs += -L/opt/homebrew/lib
HOST_CFLAGS += -I/opt/homebrew/include
HOST_LDFLAGS += -L/opt/homebrew/lib
TEST_BIN_FLAGS =
WANT_EXPERIMENTAL_MATH = 1
WANT_SVE_TESTS = 0
USE_GLIBC_ABI = 0
WANT_EXP10_TESTS = 0
USE_MPFR = 1
math-ulpflags = -q -f
endif
endif

# Use if mpfr is available on the target for ulp error checking. If
# enabling this, it is advised to disable fenv checks by uncommenting
# the two lines at the bottom of this block.
USE_MPFR=0
USE_MPFR?=0
math-cflags += -DUSE_MPFR=$(USE_MPFR)
ifeq ($(USE_MPFR), 1)
math-ldlibs += $(mpfr-libs) $(gmp-libs)
Expand All @@ -106,18 +131,18 @@ math-cflags += -DWANT_ERRNO=$(WANT_ERRNO)

# Disable/enable SVE vector math tests/tools.
ifeq ($(ARCH),aarch64)
WANT_SVE_TESTS = 1
WANT_SVE_TESTS ?= 1
else
WANT_SVE_TESTS = 0
WANT_SVE_TESTS ?= 0
endif
math-cflags += -DWANT_SVE_TESTS=$(WANT_SVE_TESTS)

# If set to 1, set fenv in vector math routines.
WANT_SIMD_EXCEPT = 0
WANT_SIMD_EXCEPT ?= 0
math-cflags += -DWANT_SIMD_EXCEPT=$(WANT_SIMD_EXCEPT)

# If set to 1, enable tests for exp10.
WANT_EXP10_TESTS = 1
WANT_EXP10_TESTS ?= 1
math-cflags += -DWANT_EXP10_TESTS=$(WANT_EXP10_TESTS)

# If set to 1, enable tests for C23 routines.
Expand All @@ -141,11 +166,11 @@ networking-cflags += -O2 -fno-tree-vectorize -funroll-loops
# Provide *_finite symbols and some of the glibc hidden symbols
# so libmathlib can be used with binaries compiled against glibc
# to interpose math functions with both static and dynamic linking
USE_GLIBC_ABI = 1
USE_GLIBC_ABI ?= 1
math-cflags += -DUSE_GLIBC_ABI=$(USE_GLIBC_ABI)

# Enable experimental math routines - non-C23 vector math and low-accuracy scalar
WANT_EXPERIMENTAL_MATH = 0
WANT_EXPERIMENTAL_MATH ?= 0
math-cflags += -DWANT_EXPERIMENTAL_MATH=$(WANT_EXPERIMENTAL_MATH)

# If you add 'fp' to the SUBS list above, you must also define this to
Expand Down
6 changes: 5 additions & 1 deletion math/math_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@

/* Optionally used extensions. */
#ifdef __GNUC__
# define HIDDEN __attribute__ ((__visibility__ ("hidden")))
# if !defined (_WIN32)
# define HIDDEN __attribute__ ((__visibility__ ("hidden")))
# else
# define HIDDEN
# endif
# define NOINLINE __attribute__ ((noinline))
# define UNUSED __attribute__ ((unused))
# define ALIGN(X) __attribute__ ((__aligned__(X)))
Expand Down
7 changes: 7 additions & 0 deletions math/test/mathtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
# define math_errhandling 0
#endif

/* Windows does not define this and math_errhandling should always be 0. */
#if defined (_WIN32)
/* Bitmasks for the math_errhandling macro. */
# define MATH_ERRNO 1 /* errno set by math functions. */
# define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */
#endif

#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
Expand Down
2 changes: 1 addition & 1 deletion networking/Dir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build/lib/libnetworking.a: $(networking-lib-objs)
$(RANLIB) $@

build/bin/test/%: $(B)/test/%.o build/lib/libnetworking.a
$(CC) $(CFLAGS_ALL) $(LDFLAGS) -static -o $@ $^ $(LDLIBS)
$(CC) $(CFLAGS_ALL) $(LDFLAGS) $(TEST_BIN_FLAGS) -o $@ $^ $(LDLIBS)

build/include/%.h: $(S)/include/%.h
cp $< $@
Expand Down
22 changes: 21 additions & 1 deletion networking/test/chksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#if !defined (_WIN32)
# include <sys/mman.h>
#else
# include <windows.h>
#endif
#include <time.h>
#include <unistd.h>
#include "../include/networking.h"
Expand Down Expand Up @@ -277,12 +281,21 @@ usage :

CKSUM_FP = implementations[IMPL].cksum_fp;
POOLSIZE = ALIGN(POOLSIZE, CACHE_LINE);
#if !defined (_WIN32)
uint8_t *base = mmap(0, POOLSIZE, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (base == MAP_FAILED)
{
perror("aligned_alloc"), exit(EXIT_FAILURE);
}
#else
uint8_t *base = VirtualAlloc(0, POOLSIZE, MEM_RESERVE|MEM_COMMIT,
PAGE_READWRITE);
if (base == 0)
{
perror("VirtualAlloc"), exit(EXIT_FAILURE);
}
#endif
for (size_t i = 0; i < POOLSIZE / 4; i++)
{
((uint32_t *) base)[i] = rand();
Expand Down Expand Up @@ -372,10 +385,17 @@ usage :
}
}

#if !defined (_WIN32)
if (munmap(base, POOLSIZE) != 0)
{
perror("munmap"), exit(EXIT_FAILURE);
}
#else

if (VirtualFree(base, POOLSIZE, MEM_RELEASE) == 0)
{
perror("VirtualFree"), exit(EXIT_FAILURE);
}
#endif
return success ? EXIT_SUCCESS : EXIT_FAILURE;
}
4 changes: 2 additions & 2 deletions string/Dir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ build/lib/libstringlib.a: $(string-lib-objs)
$(RANLIB) $@

build/bin/test/%: $(B)/test/%.o build/lib/libstringlib.a
$(CC) $(CFLAGS_ALL) $(LDFLAGS) -static -o $@ $^ $(LDLIBS)
$(CC) $(CFLAGS_ALL) $(LDFLAGS) $(TEST_BIN_FLAGS) -o $@ $^ $(LDLIBS)

build/bin/bench/%: $(B)/bench/%.o build/lib/libstringlib.a
$(CC) $(CFLAGS_ALL) $(LDFLAGS) -static -o $@ $^ $(LDLIBS)
$(CC) $(CFLAGS_ALL) $(LDFLAGS) $(TEST_BIN_FLAGS) -o $@ $^ $(LDLIBS)

build/include/%.h: $(S)/include/%.h
cp $< $@
Expand Down
Loading
Loading