Skip to content
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

ARMv8 support #32

Merged
merged 5 commits into from
Sep 20, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/build-aarch64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build (aarch64)

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU for ARM
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image for ARM
run: |
docker buildx create --use
docker buildx build --platform linux/arm64 -t my-arm-build --load -f docker/aarch64/Dockerfile .

# - name: Run tests on ARM Docker container
# run: |
# docker run --rm my-arm-build ./run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake
name: Build and test (x86_64)

on:
push:
Expand Down Expand Up @@ -65,6 +65,7 @@ jobs:
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_CXX_FLAGS="-mfma -mavx -mavx2 -DXSIMD_DEFAULT_ARCH=\"fma3<avx2>\"" \
-DBLAST_WITH_BENCHMARK=ON \
-DBLAST_WITH_TEST=ON

Expand Down
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ target_link_libraries(blast

target_compile_options(blast
INTERFACE "-Wno-ignored-attributes" "-fno-math-errno" "-ftemplate-backtrace-limit=0"
# Enable SIMD instruction sets, otherwise it does not compile.
# This will change when we support multiple architectures.
INTERFACE "-march=native" "-mfma" "-mavx" "-mavx2" "-msse4"
)

# BLAST_WITH_BLASFEO
Expand Down
19 changes: 4 additions & 15 deletions bench/blast/math/dense/DynamicIamax.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
// Copyright 2023 Mikhail Katliar
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2023-2024 Mikhail Katliar All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include <blast/math/dense/Iamax.hpp>

#include <blaze/math/DynamicVector.h>
#include <blast/blaze/Math.hpp>

#include <bench/Benchmark.hpp>
#include <bench/Iamax.hpp>
Expand Down
9 changes: 6 additions & 3 deletions bench/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ target_link_libraries(bench-blast-common
PUBLIC benchmark::benchmark
)

target_compile_options(bench-blast-common
PUBLIC "-mllvm" "-inline-threshold=1000"
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# More aggressive inlining with Clang
target_compile_options(bench-blast-common
PUBLIC "-mllvm" "-inline-threshold=1000"
)
endif()
46 changes: 46 additions & 0 deletions docker/aarch64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM ubuntu:latest
WORKDIR /root
RUN apt-get update
# RUN apt-get upgrade -y
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
build-essential clang-18 cmake git libopenblas-dev libboost-exception-dev pkg-config

# Install GTest and GMock
RUN apt install -y libgtest-dev libgmock-dev

# Install Google benchmark
RUN apt install -y libbenchmark-dev

# Install Blaze
RUN git clone https://bitbucket.org/blaze-lib/blaze.git
RUN cd blaze && cmake -DBLAZE_BLAS_MODE=True -DBLAZE_BLAS_USE_MATRIX_MATRIX_MULTIPLICATION=False \
-DBLAZE_BLAS_USE_MATRIX_VECTOR_MULTIPLICATION=False -DBLAZE_VECTORIZATION=False -DBLAZE_SHARED_MEMORY_PARALLELIZATION=False . && make install

# Install Eigen3
RUN apt install -y libeigen3-dev

# Install blasfeo
RUN apt-get install -y bc
RUN git clone https://github.com/giaf/blasfeo.git
RUN cd blasfeo && git checkout cc90e146ee9089de518f57dbb736e064bd82394e
COPY docker/aarch64/blasfeo/Makefile.rule blasfeo
RUN cd blasfeo && make -j `nproc` static_library && make install_static

# Install xsimd
RUN apt install -y libxsimd-dev

# Install Clang-18
RUN apt install -y clang-18
ENV CC=clang-18
ENV CXX=clang++-18

# Build blast
WORKDIR /blast
COPY bench ./bench
COPY cmake ./cmake
COPY include ./include
COPY test ./test
COPY CMakeLists.txt .
ENV PKG_CONFIG_PATH=/usr/local/lib
RUN cmake -B build -DCMAKE_CXX_FLAGS="-march=native -DXSIMD_DEFAULT_ARCH='neon64'" -DBLAST_WITH_TEST=ON -DBLAST_WITH_BENCHMARK=ON .
RUN cd build && make -j `nproc`
Loading
Loading