CMake options for forcing use of NAM Core for LSTM or WaveNet

This commit is contained in:
Mike Oliphant
2024-11-14 07:47:52 -08:00
parent 5dd03764c5
commit 3f5872cc78
3 changed files with 23 additions and 2 deletions
+13
View File
@@ -23,6 +23,19 @@ if (DISABLE_DENORMALS)
add_definitions(-DDISABLE_DENORMALS)
endif (DISABLE_DENORMALS)
option(LSTM_PREFER_NAM "Always use NAM Core for NAM LSTM models" OFF)
if (LSTM_PREFER_NAM)
add_definitions(-DLSTM_PREFER_NAM)
endif (LSTM_PREFER_NAM)
option(WAVENET_PREFER_NAM "Always use NAM Core for NAM WaveNet models" OFF)
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)
+2 -2
View File
@@ -14,8 +14,8 @@
#include "nam_plugin.h"
// LV2 Functions
static LV2_Handle instantiate(const LV2_Descriptor*, double rate, const char*, const LV2_Feature* const* features
) {
static LV2_Handle instantiate(const LV2_Descriptor*, double rate, const char*, const LV2_Feature* const* features)
{
try
{
auto nam = std::make_unique<NAM::Plugin>();
+8
View File
@@ -12,6 +12,14 @@ 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);
#endif
#ifdef WAVENET_PREFER_NAM // Use NAM Core for NAM WaveNet models
NeuralAudio::NeuralModel::SetWaveNetLoadMode(NeuralAudio::PreferNAMCore);
#endif
}
Plugin::~Plugin()