Skip to content

Commit

Permalink
Fix typo bug with vreinterpretq + CI improvements (#21)
Browse files Browse the repository at this point in the history
* fix: Correct typo in use of ARM reinterpret u32 -> f32

The type order is swapped; we got it right most places but missed it
here. Not sure why CI didn't catch this error?

* chore: Add Ubuntu 24 to CI

* chore: Simplify matrix for build CI

* chore: Update nanobind pin

* chore: Hopefully fix CI with latest Python by using a proper env

* fix: Specify modern Python and remove unnecessary pip install

Eventually, we're going to want to add Python tests, so we might as well
set up for it. Also, nanobind only requires `typing_extensions` on
Python <3.11, so we can remove that install (which errors on Ubuntu 24
with Python 3.12).

* I love devops so much

actions/setup-python#436 (comment)
  • Loading branch information
wbthomason authored Jul 19, 2024
1 parent df6120a commit 60fe7bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 33 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest]
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-latest]
build_type: [Release]
c_compiler: [gcc, clang]
include:
- os: ubuntu-20.04
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-20.04
c_compiler: clang
cpp_compiler: clang++
- os: ubuntu-22.04
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-22.04
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: gcc
cpp_compiler: g++
compiler: [{cpp: g++, c: gcc}, {cpp: clang++, c: clang}]
python: ["3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -60,33 +42,31 @@ jobs:
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Install packages (Linux)
if: runner.os == 'Linux'
run: >
sudo apt-get install -y libeigen3-dev llvm
- name: Install packages (MacOS)
if: runner.os == 'macOS'
run: >
brew install eigen
- name: Install GCC (MacOS)
if: runner.os == 'macOS' && matrix.c_compiler == 'gcc'
if: runner.os == 'macOS' && matrix.compiler.c == 'gcc'
run: >
brew install gcc
- name: Install Python packages
run: >
pip install typing_extensions
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }}
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
Expand Down
2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ find_package(Python 3.8
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)

CPMAddPackage("gh:wjakob/nanobind#4ed5fdf80de460edc416c0e948d6e6c60e61a02a")
CPMAddPackage("gh:wjakob/nanobind#b0136fe6ac1967cb2399456adc346a1af06a3b88")

CPMAddPackage("gh:kavrakilab/nigh#97130999440647c204e0265d05a997dbd8da4e70")
set(NIGH_INCLUDE_DIRS ${nigh_SOURCE_DIR}/src)
Expand Down
4 changes: 2 additions & 2 deletions src/impl/vamp/vector/neon.hh
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace vamp
template <unsigned int i>
inline static constexpr auto lshift_dispatch(VectorT v) noexcept -> VectorT
{
return vreinterpretq_u32_f32(vshlq_n_u32(vreinterpretq_u32_f32(v), i));
return vreinterpretq_f32_u32(vshlq_n_u32(vreinterpretq_u32_f32(v), i));
}

template <unsigned int = 0>
Expand All @@ -240,7 +240,7 @@ namespace vamp
template <unsigned int i>
inline static constexpr auto rshift_dispatch(VectorT v) noexcept -> VectorT
{
return vreinterpretq_u32_f32(vshrq_n_u32(vreinterpretq_u32_f32(v), i));
return vreinterpretq_f32_u32(vshrq_n_u32(vreinterpretq_u32_f32(v), i));
}

template <unsigned int = 0>
Expand Down

0 comments on commit 60fe7bb

Please sign in to comment.