Skip to content
Merged
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
1171d17
Add arm support
dor-forer Feb 19, 2025
8102ad1
Changed the arm cpu info
dor-forer Feb 20, 2025
0504e08
Add ip test
dor-forer Feb 20, 2025
ba931d0
Add to tests
dor-forer Feb 20, 2025
e0642c8
Added tests andbm
dor-forer Feb 20, 2025
4b8c347
fix tests
dor-forer Feb 20, 2025
3039eb8
Add github benchmakrs
dor-forer Feb 25, 2025
9a67ee8
Check 1
dor-forer Feb 25, 2025
a9b87d4
only arm
dor-forer Feb 25, 2025
da3c880
change ami
dor-forer Feb 25, 2025
1fdb6d5
Try ireland
dor-forer Feb 25, 2025
b4302e1
Try different image
dor-forer Feb 25, 2025
a83947a
try image
dor-forer Feb 25, 2025
a698070
back to old image
dor-forer Feb 25, 2025
730d8ac
larger image
dor-forer Feb 25, 2025
38371c5
Add option to change env
dor-forer Feb 25, 2025
202a89d
back to default region
dor-forer Feb 25, 2025
185703d
Created new image
dor-forer Feb 25, 2025
90e885c
Try to add the x86 to check
dor-forer Feb 25, 2025
d61c358
Try different machine
dor-forer Feb 25, 2025
4a88b1f
added include
dor-forer Feb 25, 2025
3ceadaa
Try without opti on arm
dor-forer Feb 25, 2025
e89762c
Change to c6g
dor-forer Feb 25, 2025
ba1ea86
added matrix region
dor-forer Feb 25, 2025
76b7132
change to west
dor-forer Feb 25, 2025
55bb40f
try the i8
dor-forer Feb 25, 2025
1b84ced
Try oregon
dor-forer Feb 25, 2025
3f98c27
Change subnet id
dor-forer Feb 25, 2025
66d96a1
Now subnet
dor-forer Feb 25, 2025
0c5f16c
Change subnet
dor-forer Feb 25, 2025
b2af693
add subnet
dor-forer Feb 25, 2025
20e596c
Try group id
dor-forer Feb 25, 2025
0682472
Change to vpc id
dor-forer Feb 26, 2025
9be3846
change subnet
dor-forer Feb 26, 2025
125e30b
Change ami
dor-forer Feb 26, 2025
6758753
Try without subnet
dor-forer Feb 26, 2025
2a37fb3
add security group again
dor-forer Feb 26, 2025
7d97821
Change the subnets
dor-forer Feb 26, 2025
97e7249
Change to ids
dor-forer Feb 26, 2025
4545554
Change sg
dor-forer Feb 26, 2025
3a443d3
psubnet
dor-forer Feb 26, 2025
a472150
Try different
dor-forer Feb 26, 2025
bee1c27
different
dor-forer Feb 26, 2025
4a891da
to a file
dor-forer Feb 26, 2025
0341dd7
print
dor-forer Feb 26, 2025
f8f424a
p
dor-forer Feb 26, 2025
ee0458a
leave empty
dor-forer Feb 26, 2025
26ff2cc
empty
dor-forer Feb 26, 2025
d3eaeeb
Try different account
dor-forer Feb 26, 2025
55bc653
Run 2 arm machines
dor-forer Feb 26, 2025
21de162
Move both to us-west-2
dor-forer Feb 26, 2025
6f8e4d4
Try workflow
dor-forer Feb 26, 2025
eedc25c
Change name
dor-forer Feb 26, 2025
578b88d
Changes
dor-forer Feb 26, 2025
41e920f
Change the secrets
dor-forer Feb 27, 2025
6218a9c
Add supprted arch
dor-forer Feb 27, 2025
1533ba7
Add defaults
dor-forer Feb 27, 2025
a86d7ac
Support all
dor-forer Feb 27, 2025
7652c9e
Change the jq
dor-forer Feb 27, 2025
c369125
Change machine to t4g
dor-forer Feb 27, 2025
9d9a047
Change the name
dor-forer Feb 27, 2025
14f8739
Change the machine
dor-forer Feb 27, 2025
2f119ec
fix the stop
dor-forer Feb 27, 2025
96d63af
only benchamrk
dor-forer Mar 2, 2025
305aa0b
add the secrets
dor-forer Mar 2, 2025
4e45109
region secret
dor-forer Mar 2, 2025
1b4649a
benchmark region
dor-forer Mar 2, 2025
797d1d6
Change timeout
dor-forer Mar 3, 2025
db9c63e
Added support for arch name in benchamrks
dor-forer Mar 9, 2025
106fc5e
change th json
dor-forer Mar 9, 2025
a0d62fb
changed to v9.0
dor-forer Mar 9, 2025
b8075b1
Change the check
dor-forer Mar 9, 2025
2007e33
add v9
dor-forer Mar 9, 2025
606cea7
Check alt version of armv9
dor-forer Mar 9, 2025
12bead0
added check
dor-forer Mar 9, 2025
976c366
add arc_arch
dor-forer Mar 9, 2025
8e23a2f
changed to CONCAT_WITH_UNDERSCORE_ARCH
dor-forer Mar 9, 2025
e81ce18
change the check
dor-forer Mar 9, 2025
f8f3d9e
Add full check
dor-forer Mar 9, 2025
f408017
fix the instruct
dor-forer Mar 10, 2025
0af63d8
Added the cmake
dor-forer Mar 10, 2025
38d563a
fix the support
dor-forer Mar 10, 2025
87ac845
put it back to cmake
dor-forer Mar 10, 2025
14bcd59
back
dor-forer Mar 10, 2025
b48d9c4
change the condition
dor-forer Mar 10, 2025
47b9724
No armpl for now
dor-forer Mar 10, 2025
1b35e30
cland format
dor-forer Mar 11, 2025
cafb30c
remove the opt
dor-forer Mar 11, 2025
bde60e4
Changed to one machine
dor-forer Mar 11, 2025
421715c
Added BENCHMARK_ARCH
dor-forer Mar 11, 2025
3c07da6
fix endif
dor-forer Mar 11, 2025
eabe27c
Remove secrets call
dor-forer Mar 12, 2025
7beb70b
pr changes
dor-forer Mar 12, 2025
69a2f24
suuport check for armv7
dor-forer Mar 13, 2025
fd6291e
Change or OR
dor-forer Mar 13, 2025
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
112 changes: 112 additions & 0 deletions .github/workflows/benchmark-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
on:
workflow_call:
inputs:
setup:
required: true
type: string
architecture:
required: true
type: string
instance-type:
required: true
type: string
ami-id:
required: true
type: string
github-runner-label:
required: true
type: string

jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
runner_label: ${{ steps.start-ec2-runner.outputs.label }}
ec2_instance_id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION_BENCHMARK }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ${{ inputs.ami-id }}
ec2-instance-type: ${{ inputs.instance-type }}
subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID_BENCHMARK }}
security-group-id: ${{ secrets.AWS_EC2_SG_ID_BENCHMARK }}
label: ${{ inputs.github-runner-label }}

benchmark:
name: Run benchmarks on runner
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.runner_label }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.number && format('refs/pull/{0}/merge', github.event.number) || github.head_ref }}
- name: Print runner info
run: |
printf "Runner lscpu:\n$(lscpu)\n"
printf "Runner lsmem:\n$(lsmem)\n"
printf "Runner nproc:\n$(nproc)\n"
printf "Runner uname:\n$(uname -a)\n"
printf "Runner arch:\n$(arch)\n"
- name: Install benchmark dependencies
run: |
sudo .install/install_script.sh
sudo apt install python3-pip -y
pip3 install --upgrade pip PyYAML setuptools redisbench-admin
pip3 install -r requirements.txt
- name: Download pre-generated indices
timeout-minutes: 20
run: ./tests/benchmark/bm_files.sh ${{ inputs.setup }}
- name: Run Benchmark
env:
ARCH: ${{ inputs.architecture }}
timeout-minutes: 300
run: |
make benchmark BM_FILTER=${{ inputs.setup }}
- name: Collect results
run: |
./tests/benchmark/benchmarks.sh ${{ inputs.setup }} | xargs -P 0 -I {} redisbench-admin export \
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }} \
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }} \
--redistimeseries_user default \
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}' \
--github_repo ${{ github.event.repository.name }} \
--github_org ${{ github.repository_owner }} \
--github_branch ${{ github.head_ref || github.ref_name }} \
--github_actor ${{ github.triggering_actor }} \
--results-format google.benchmark \
--benchmark-result-file {}_results.json

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- benchmark # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION_BENCHMARK }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ inputs.github-runner-label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2_instance_id }}

158 changes: 61 additions & 97 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
setup:
type: string
required: true
architecture:
type: string
required: false
default: 'all'
description: 'Run only on specific architecture'
workflow_dispatch:
inputs:
setup:
Expand Down Expand Up @@ -32,107 +37,66 @@ on:
- bm-spaces
description: 'Benchmarks set to run'
default: benchmarks-all
architecture:
type: choice
options:
- all
- arm64
- x86_64
description: 'Run only on specific architecture'
default: 'all'

jobs:
start-runner:
name: Start self-hosted EC2 runner
prepare_runner_configurations:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
# Ubuntu 22.04 128GB Storage AMI
ec2-image-id: ami-0ba430d4b7b64de57
ec2-instance-type: r7i.xlarge
subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID }}
security-group-id: ${{ secrets.AWS_EC2_SG_ID }}

benchmark:
name: Run the benchmarks on the runner
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.number && format('refs/pull/{0}/merge', github.event.number) || github.head_ref }}
- name: Print runner info
- name: Set matrix
id: set-matrix
run: |
printf "Runner lscpu:\n$(lscpu)\n"
printf "Runner lsmem:\n$(lsmem)\n"
printf "Runner nproc:\n$(nproc)\n"
printf "Runner uname:\n$(uname -a)\n"

- name: Install benchmark dependencies
run: |
sudo .install/install_script.sh
sudo apt install python3-pip -y
pip3 install --upgrade pip PyYAML setuptools redisbench-admin
pip3 install -r requirements.txt

# - name: stress test
# run: |
# sudo apt install stress-ng -qqy
# uptime
# stress-ng -c 1 --timeout 60s --metrics-brief
# uptime
# stress-ng --stream 1 -t 60 --metrics-brief
# uptime
# stress-ng --ipsec-mb=1 -t 60 --metrics-brief
# uptime
# Define the full matrix as a JSON string
FULL_MATRIX='
{
"include": [
{
"architecture": "arm64",
"instance-type": "i8g.xlarge",
"ami-id": "ami-0d6c92b636b74f843"
},
{
"architecture": "x86_64",
"instance-type": "r7i.xlarge",
"ami-id": "ami-09fabd03bb09b3704"
}
]
}
'

# Filter the matrix based on architecture
if [ "${{ inputs.architecture }}" = "all" ]; then
# Use the full matrix
FILTERED_MATRIX="$FULL_MATRIX"
else
# Filter to only the selected architecture
FILTERED_MATRIX=$(echo "$FULL_MATRIX" | jq -c '{include: [.include[] | select(.architecture | contains("${{ inputs.architecture }}"))]}')
fi

# Use multiline output delimiter syntax for GitHub Actions
echo "matrix<<EOF" >> $GITHUB_OUTPUT
echo "$FILTERED_MATRIX" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# TODO: remove "--no-check-certificate" when possible
- name: Download pre-generated indices
timeout-minutes: 20
run: ./tests/benchmark/bm_files.sh ${{ inputs.setup }}
- name: Benchmark
timeout-minutes: 120
run: make benchmark BM_FILTER=${{ inputs.setup }}

- name: Collect results
run: |
./tests/benchmark/benchmarks.sh ${{ inputs.setup }} | xargs -P 0 -I {} redisbench-admin export \
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }} \
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }} \
--redistimeseries_user default \
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}' \
--github_repo ${{ github.event.repository.name }} \
--github_org ${{ github.repository_owner }} \
--github_branch ${{ github.head_ref || github.ref_name }} \
--github_actor ${{ github.triggering_actor }} \
--results-format google.benchmark \
--benchmark-result-file {}_results.json

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- benchmark # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
run_benchmarks:
name: Run ${{ matrix.architecture }} benchmarks
needs: prepare_runner_configurations
uses: ./.github/workflows/benchmark-runner.yml
secrets: inherit
strategy:
matrix: ${{ fromJson(needs.prepare_runner_configurations.outputs.matrix) }}
Copy link

Copilot AI Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job 'prepare_runner_configurations' does not declare outputs, yet its output 'matrix' is referenced in 'run_benchmarks'. Please add an outputs section in 'prepare_runner_configurations' to expose the 'matrix' from the 'set-matrix' step.

Copilot uses AI. Check for mistakes.
with:
setup: ${{ inputs.setup }}
architecture: ${{ matrix.architecture }}
instance-type: ${{ matrix.instance-type }}
ami-id: ${{ matrix.ami-id }}
github-runner-label: ${{ matrix.architecture }}-${{ matrix.instance-type }}-${{ github.run_id }}
21 changes: 21 additions & 0 deletions cmake/aarch64InstructionFlags.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include(CheckCXXCompilerFlag)


message(STATUS "Building for ARM aarch64")

# Check what compiler flags are supported
CHECK_CXX_COMPILER_FLAG("-march=armv8-a" CXX_ARMV8A)
CHECK_CXX_COMPILER_FLAG("-march=armv8-a+sve" CXX_SVE)
CHECK_CXX_COMPILER_FLAG("-march=armv9-a+sve2" CXX_ARMV9)

# Only use ARMv9 if both compiler and CPU support it
if(CXX_ARMV9)
message(STATUS "Using ARMv9.0-a with SVE2 (supported by CPU)")
add_compile_definitions(OPT_ARMV9)
endif()
if (CXX_ARMV8A)
add_compile_definitions(OPT_NEON)
endif()
if (CXX_SVE)
add_compile_definitions(OPT_SVE)
endif()
14 changes: 11 additions & 3 deletions tests/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

message("# VectorSimilarity_Benchmark root: " ${root})
message("# VectorSimilarity_Benchmark binroot: " ${binroot})

Expand All @@ -9,6 +8,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
include_directories(../)
include_directories(./)

enable_testing()

Expand All @@ -25,12 +25,20 @@ foreach(benchmark IN ITEMS ${BENCHMARKS})
target_link_libraries(bm_${benchmark} VectorSimilarity benchmark::benchmark)
endforeach()

if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
message(STATUS "Enabling Arm Performance Libraries integration")
include(${root}/cmake/aarch64InstructionFlags.cmake)
add_compile_definitions(BENCHMARK_ARCH=arm64)

else()
include(${root}/cmake/x86_64InstructionFlags.cmake)
add_compile_definitions(BENCHMARK_ARCH=x86_64)
endif()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Spaces benchmarks #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

include(${root}/cmake/x86_64InstructionFlags.cmake)

set(DATA_TYPE fp32 fp64 bf16 fp16 int8 uint8)
foreach(data_type IN LISTS DATA_TYPE)
add_executable(bm_spaces_${data_type} spaces_benchmarks/bm_spaces_${data_type}.cpp)
Expand Down
32 changes: 32 additions & 0 deletions tests/benchmark/bm_macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "cpu_features_macros.h"

#define EXPAND(x) x
#define EXPAND2(x) EXPAND(x)
// Helper for raw concatenation with varying arguments
#define BM_FUNC_NAME_HELPER1_2(a, b) a##_##b
#define BM_FUNC_NAME_HELPER1_3(a, b, c) a##_##b##_##c
#define BM_FUNC_NAME_HELPER1_4(a, b, c, d) a##_##b##_##c##_##d
#define BM_FUNC_NAME_HELPER1_5(a, b, c, d, e) a##_##b##_##c##_##d##_##e

// Force expansion of macro arguments
#define BM_FUNC_NAME_HELPER_2(a, b) BM_FUNC_NAME_HELPER1_2(a, b)
#define BM_FUNC_NAME_HELPER_3(a, b, c) BM_FUNC_NAME_HELPER1_3(a, b, c)
#define BM_FUNC_NAME_HELPER_4(a, b, c, d) BM_FUNC_NAME_HELPER1_4(a, b, c, d)
#define BM_FUNC_NAME_HELPER_5(a, b, c, d, e) BM_FUNC_NAME_HELPER1_5(a, b, c, d, e)

// Determine the number of arguments and select the appropriate helper
#define COUNT_ARGS(...) COUNT_ARGS_(__VA_ARGS__, 6, 5, 4, 3, 2, 1)
#define COUNT_ARGS_(_1, _2, _3, _4, _5, _6, N, ...) N

// Concatenate BM_FUNC_NAME_HELPER with the number of arguments
#define CONCAT_HELPER(a, b) a##_##b
#define CONCAT(a, b) CONCAT_HELPER(a, b)

// Main macro that selects the appropriate helper based on argument count
#define CONCAT_WITH_UNDERSCORE(...) \
EXPAND2(CONCAT(BM_FUNC_NAME_HELPER, EXPAND2(COUNT_ARGS(__VA_ARGS__)))(__VA_ARGS__))

// Modify this macro to account for the extra BENCHMARK_ARCH parameter
#define CONCAT_WITH_UNDERSCORE_ARCH(...) CONCAT_WITH_UNDERSCORE(__VA_ARGS__, BENCHMARK_ARCH)
1 change: 1 addition & 0 deletions tests/benchmark/bm_vecsim_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "VecSim/algorithms/hnsw/hnsw.h"
#include "VecSim/index_factories/hnsw_factory.h"
#include "bm_definitions.h"
#include "bm_macros.h"
#include "utils/mock_thread_pool.h"

// This class includes every static data member that is:
Expand Down
Loading