diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..734f133 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,120 @@ +name: Build +on: + push: + paths-ignore: + - "**/README.md" + +env: + USERNAME: kwsp + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg + FEED_URL: https://nuget.pkg.github.com/kwsp/index.json + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite;nuget,https://nuget.pkg.github.com/kwsp/index.json,readwrite" + +jobs: + Build-Win64: + runs-on: windows-2022 + steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup VCPKG + shell: pwsh + run: | + cd ${{ github.workspace }} + git clone https://github.com/microsoft/vcpkg + ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat + + - name: Add NuGet sources + shell: pwsh + run: | + .$(${{ env.VCPKG_EXE }} fetch nuget) ` + sources add ` + -Source "${{ env.FEED_URL }}" ` + -StorePasswordInClearText ` + -Name GitHubPackages ` + -UserName "${{ env.USERNAME }}" ` + -Password "${{ secrets.GH_PACKAGES_TOKEN }}" + .$(${{ env.VCPKG_EXE }} fetch nuget) ` + setapikey "${{ secrets.GH_PACKAGES_TOKEN }}" ` + -Source "${{ env.FEED_URL }}" + + - name: CMake configure + run: cmake --preset win64 + + - name: CMake build + run: cmake --build --preset win64-release + + - name: CTest + shell: bash + run: ctest --output-on-failure --test-dir build/win64/test/ + + Build-mac: + runs-on: macos-latest + steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Install system-wide build tools + shell: bash + # Install + # mono: NuGet requires a dotnet runtime + # ninja: Build system + # llvm: Just for clang-tidy. Need to add to path. + # Just add clang-tidy to path, not all of LLVM clang. + run: | + brew install mono ninja llvm + ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin/clang-tidy + brew install autoconf autoconf-archive automake libtool + + - name: Setup VCPKG + shell: bash + run: | + cd ${{ github.workspace }} + git clone https://github.com/microsoft/vcpkg + ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh + + - name: Add NuGet sources + shell: bash + env: + gh_packages_secret: ${{ secrets.GH_PACKAGES_TOKEN }} + if: ${{ env.gh_packages_secret != '' }} + run: | + mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \ + sources add \ + -Source "${{ env.FEED_URL }}" \ + -StorePasswordInClearText \ + -Name GitHubPackages \ + -UserName "${{ env.USERNAME }}" \ + -Password "${{ secrets.GH_PACKAGES_TOKEN }}" + mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \ + setapikey "${{ secrets.GH_PACKAGES_TOKEN }}" \ + -Source "${{ env.FEED_URL }}" + + - name: CMake configure + shell: bash + run: cmake --preset clang + + - name: CMake build + shell: bash + run: cmake --build --preset clang-release + + - name: CTest + shell: bash + run: ctest --output-on-failure --test-dir build/clang/test/ diff --git a/include/fftconv/fftconv.hpp b/include/fftconv/fftconv.hpp index 3c04183..b7d4153 100644 --- a/include/fftconv/fftconv.hpp +++ b/include/fftconv/fftconv.hpp @@ -8,7 +8,6 @@ #include #include #include -#include // IWYU pragma: keep #include #include #include @@ -107,10 +106,11 @@ inline void copy_to_padded_buffer(const std::span src, assert(src.size() <= dst.size()); // Copy data from source to destination - std::ranges::copy(src, dst.begin()); + std::copy(src.begin(), src.end(), dst.begin()); // Fill the remaining part of the destination with zeros - std::ranges::fill(dst.subspan(src.size()), 0); + auto dst_ = dst.subspan(src.size()); + std::fill(dst_.begin(), dst_.end(), 0); } // static inline void elementwise_multiply(const fftw_complex *a, @@ -196,7 +196,7 @@ inline void multiply_cx_neon_f32(std::span> cx1, #include -__m256d mult_c128_avx2(__m256d vec1, __m256d vec2) { +inline __m256d mult_c128_avx2(__m256d vec1, __m256d vec2) { // vec1 and vec2 each have 2 128bit complex const __m256d neg = _mm256_setr_pd(1.0, -1.0, 1.0, -1.0); @@ -545,7 +545,8 @@ void oaconvolve_fftw(std::span input, std::span kernel, assert(input.size() == output.size()); plan.oaconvolve_same(input, kernel, output); } else { - static_assert(Mode == ConvMode::Full || Mode == ConvMode::Same, "Unsupported mode."); + static_assert(Mode == ConvMode::Full || Mode == ConvMode::Same, + "Unsupported mode."); } }