diff --git a/.github/workflows/arm-mac.yml b/.github/workflows/arm-mac.yml index d543f902..8ee66f70 100644 --- a/.github/workflows/arm-mac.yml +++ b/.github/workflows/arm-mac.yml @@ -47,15 +47,6 @@ jobs: token: ${{ secrets.OUR_GITHUB_PAT }} path: modules/jai - - name: Checkout math_approx - uses: actions/checkout@v2 - if: github.actor == 'jatinchowdhury18' - with: - ref: main - repository: Chowdhury-DSP/math_approx - token: ${{ secrets.OUR_GITHUB_PAT }} - path: modules/math_approx - - name: Configure shell: bash run: cmake -Bbuild -GXcode $CONFIGURE_ADD_ONS_FLAG -D"CMAKE_OSX_ARCHITECTURES=arm64" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index af721c65..4f1ed363 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -63,15 +63,6 @@ jobs: token: ${{ secrets.OUR_GITHUB_PAT }} path: modules/jai - - name: Checkout math_approx - uses: actions/checkout@v2 - if: github.actor == 'jatinchowdhury18' - with: - ref: main - repository: Chowdhury-DSP/math_approx - token: ${{ secrets.OUR_GITHUB_PAT }} - path: modules/math_approx - - name: Configure shell: bash env: diff --git a/.gitmodules b/.gitmodules index 9febb3fe..48ab9976 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,3 +28,6 @@ [submodule "modules/melatonin_perfetto"] path = modules/melatonin_perfetto url = https://github.com/sudara/melatonin_perfetto +[submodule "modules/math_approx"] + path = modules/math_approx + url = https://github.com/Chowdhury-DSP/math_approx diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 82791b50..88bf1592 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -16,6 +16,7 @@ add_subdirectory(RTNeural) # add other C++ libraries add_subdirectory(sst-cpputils) add_subdirectory(ea_variant) +add_subdirectory(math_approx) include(cmake/WarningFlags.cmake) include(cmake/ConfigFlags.cmake) @@ -43,6 +44,7 @@ target_link_libraries(juce_plugin_modules chowdsp::chowdsp_visualizers RTNeural ea_variant + math_approx PUBLIC config_flags juce::juce_recommended_lto_flags @@ -99,13 +101,6 @@ if(ASIOSDK_DIR) target_compile_definitions(juce_plugin_modules PUBLIC JUCE_ASIO=1) endif() -if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/math_approx") - message(STATUS "Configuring math_approx") - add_subdirectory(math_approx) - target_link_libraries(juce_plugin_modules PUBLIC math_approx) - target_compile_definitions(juce_plugin_modules PRIVATE BYOD_USE_MATH_APPROX=1) -endif() - if(IOS) target_link_libraries(juce_plugin_modules PRIVATE juce::juce_product_unlocking) target_compile_definitions(juce_plugin_modules PUBLIC JUCE_IN_APP_PURCHASES=1) diff --git a/modules/math_approx b/modules/math_approx new file mode 160000 index 00000000..07408e30 --- /dev/null +++ b/modules/math_approx @@ -0,0 +1 @@ +Subproject commit 07408e302de1ad9cda6d1b114b5f2d2c9ce6d719 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 78596c51..28256b31 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -170,7 +170,13 @@ endif() # AVX/SSE files for accelerated neural nets make_lib_simd_runtime(rnn_accelerated processors/drive/neural_utils/RNNAccelerated.cpp) foreach(target IN ITEMS rnn_accelerated_sse_or_arm rnn_accelerated_avx) - target_link_libraries(${target} PRIVATE config_flags juce::juce_recommended_lto_flags warning_flags) + target_link_libraries(${target} + PRIVATE + math_approx + config_flags + juce::juce_recommended_lto_flags + warning_flags + ) target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../modules/RTNeural @@ -183,11 +189,6 @@ foreach(target IN ITEMS rnn_accelerated_sse_or_arm rnn_accelerated_avx) C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden ) - if(TARGET math_approx) - message(STATUS "Using math_approx for ${target}") - target_compile_definitions(${target} PRIVATE RTNEURAL_USE_MATH_APPROX=1) - target_link_libraries(${target} PRIVATE math_approx) - endif() endforeach() target_compile_definitions(rnn_accelerated_sse_or_arm PRIVATE RTNEURAL_DEFAULT_ALIGNMENT=16 RTNEURAL_NAMESPACE=RTNeural_sse_arm) target_compile_definitions(rnn_accelerated_avx PRIVATE RTNEURAL_DEFAULT_ALIGNMENT=32 RTNEURAL_NAMESPACE=RTNeural_avx) diff --git a/src/headless/CMakeLists.txt b/src/headless/CMakeLists.txt index 48b70a78..7dda2e21 100644 --- a/src/headless/CMakeLists.txt +++ b/src/headless/CMakeLists.txt @@ -50,9 +50,6 @@ target_include_directories(BYOD_headless ../../modules/ea_variant ${juce_includes} ) -if(TARGET math_approx) - target_include_directories(BYOD_headless PRIVATE ../../modules/math_approx/include) -endif() target_link_libraries(BYOD_headless PUBLIC BinaryData diff --git a/src/pch.h b/src/pch.h index e58f5499..c4dbf6e4 100644 --- a/src/pch.h +++ b/src/pch.h @@ -38,9 +38,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #include "jai/SharedJaiContext.h" #endif -#if BYOD_USE_MATH_APPROX #include -#endif // global definitions using Parameters = std::vector>; diff --git a/src/processors/drive/diode_circuits/OmegaProvider.h b/src/processors/drive/diode_circuits/OmegaProvider.h index 5050201d..e920100d 100644 --- a/src/processors/drive/diode_circuits/OmegaProvider.h +++ b/src/processors/drive/diode_circuits/OmegaProvider.h @@ -2,7 +2,6 @@ #include -#if BYOD_USE_MATH_APPROX struct OmegaProvider { template @@ -11,6 +10,3 @@ struct OmegaProvider return math_approx::wright_omega<3, 3> (x); } }; -#else -using OmegaProvider = chowdsp::Omega::Omega; -#endif diff --git a/src/processors/drive/neural_utils/RNNAccelerated.cpp b/src/processors/drive/neural_utils/RNNAccelerated.cpp index bb70d411..4bce81a1 100644 --- a/src/processors/drive/neural_utils/RNNAccelerated.cpp +++ b/src/processors/drive/neural_utils/RNNAccelerated.cpp @@ -11,11 +11,9 @@ #endif #include - -#if RTNEURAL_USE_MATH_APPROX #include -struct ApproxMathsProvider +struct RNNMathsProvider { template static T tanh (T x) @@ -29,10 +27,6 @@ struct ApproxMathsProvider return math_approx::sigmoid<9> (x); } }; -using RNNMathsProvider = ApproxMathsProvider; -#else -using RNNMathsProvider = RTNEURAL_NAMESPACE::DefaultMathsProvider; -#endif #include "model_loaders.h"