Fixed propagation of native arch optimizations

This commit is contained in:
Mike Oliphant
2024-11-16 08:09:58 -08:00
parent b7595d2750
commit 9d2e7ae205
3 changed files with 43 additions and 35 deletions
+29 -29
View File
@@ -1,8 +1,29 @@
add_subdirectory(../deps/NeuralAudio NeuralAudio)
if (MSVC)
add_compile_options(
"$<$<CONFIG:DEBUG>:/W4>"
"$<$<CONFIG:RELEASE>:/O2>"
)
else()
add_compile_options(
-Wall
# -Wpedantic -Wextra -Wstrict-aliasing -Wunreachable-code -Weffc++ -Wno-unused-parameter
"$<$<CONFIG:DEBUG>:-Og;-ggdb>"
"$<$<CONFIG:RELWITHDEBINFO>:-Ofast>"
"$<$<CONFIG:RELEASE>:-Ofast>"
)
endif()
include_directories(SYSTEM ../deps/NeuralAudio)
include_directories(SYSTEM ../deps/lv2/include)
include_directories(SYSTEM ../deps/denormal)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)|(x86_64)")
option(USE_NATIVE_ARCH "Enable architecture-specific optimizations" OFF)
if (USE_NATIVE_ARCH)
add_compile_options(-march=x86-64-v3)
message("Enabling -march=x86-64-v3")
endif (USE_NATIVE_ARCH)
endif ()
add_subdirectory(../deps/NeuralAudio NeuralAudio)
set(SOURCES nam_lv2.cpp
nam_plugin.cpp
@@ -12,6 +33,10 @@ set(NA_SOURCES ../deps/NeuralAudio/NeuralAudio/NeuralModel.h)
add_library(neural_amp_modeler SHARED ${SOURCES} ${NA_SOURCES})
target_include_directories(neural_amp_modeler PUBLIC ../deps/NeuralAudio)
target_include_directories(neural_amp_modeler PUBLIC ../deps/lv2/include)
target_include_directories(neural_amp_modeler PUBLIC ../deps/denormal)
target_link_libraries(neural_amp_modeler PRIVATE NeuralAudio)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
@@ -35,16 +60,6 @@ if (WAVENET_PREFER_NAM)
add_definitions(-DWAVENET_PREFER_NAM)
endif (WAVENET_PREFER_NAM)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)|(x86_64)")
option(USE_NATIVE_ARCH "Enable architecture-specific optimizations" OFF)
if (USE_NATIVE_ARCH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64-v3")
message("Enabling -march=x86-64-v3")
endif (USE_NATIVE_ARCH)
endif ()
set_target_properties(neural_amp_modeler
PROPERTIES
CXX_VISIBILITY_PRESET hidden
@@ -57,18 +72,3 @@ set_target_properties(neural_amp_modeler
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(neural_amp_modeler PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
endif()
if (MSVC)
target_compile_options(neural_amp_modeler PRIVATE
"$<$<CONFIG:DEBUG>:/W4>"
"$<$<CONFIG:RELEASE>:/O2>"
)
else()
target_compile_options(neural_amp_modeler PRIVATE
-Wall
# -Wpedantic -Wextra -Wstrict-aliasing -Wunreachable-code -Weffc++ -Wno-unused-parameter
"$<$<CONFIG:DEBUG>:-Og;-ggdb>"
"$<$<CONFIG:RELWITHDEBINFO>:-Ofast>"
"$<$<CONFIG:RELEASE>:-Ofast>"
)
endif()
+12 -4
View File
@@ -13,13 +13,21 @@ namespace NAM {
// prevent allocations on the audio thread
currentModelPath.reserve(MAX_FILE_NAME + 1);
#ifdef LSTM_PREFER_NAM // Use NAM Core for NAM LSTM models
NeuralAudio::NeuralModel::SetLSTMLoadMode(NeuralAudio::PreferNAMCore);
NeuralAudio::NeuralModel::SetLSTMLoadMode(
#ifdef LSTM_PREFER_NAM
NeuralAudio::PreferNAMCore
#else
NeuralAudio::PreferRTNeural
#endif
);
#ifdef WAVENET_PREFER_NAM // Use NAM Core for NAM WaveNet models
NeuralAudio::NeuralModel::SetWaveNetLoadMode(NeuralAudio::PreferNAMCore);
NeuralAudio::NeuralModel::SetWaveNetLoadMode(
#ifdef WAVENET_PREFER_NAM
NeuralAudio::PreferNAMCore
#else
NeuralAudio::PreferRTNeural
#endif
);
}
Plugin::~Plugin()