Set up aggressive optimizations when using simde or MOD
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
7974430c4e
commit
d0a354a411
11 changed files with 54 additions and 8 deletions
|
@ -20,6 +20,12 @@
|
||||||
#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
|
#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
|
||||||
# include_next <emmintrin.h>
|
# include_next <emmintrin.h>
|
||||||
#else
|
#else
|
||||||
|
# define SIMDE_ACCURACY_PREFERENCE 0
|
||||||
# define SIMDE_ENABLE_NATIVE_ALIASES
|
# define SIMDE_ENABLE_NATIVE_ALIASES
|
||||||
|
# define SIMDE_FAST_CONVERSION_RANGE
|
||||||
|
# define SIMDE_FAST_MATH
|
||||||
|
# define SIMDE_FAST_NANS
|
||||||
|
# define SIMDE_FAST_ROUND_MODE
|
||||||
|
# define SIMDE_FAST_ROUND_TIES
|
||||||
# include "../simde/simde/x86/sse.h"
|
# include "../simde/simde/x86/sse.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,13 @@
|
||||||
#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
|
#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
|
||||||
# include_next <immintrin.h>
|
# include_next <immintrin.h>
|
||||||
#else
|
#else
|
||||||
|
# define SIMDE_ACCURACY_PREFERENCE 0
|
||||||
# define SIMDE_ENABLE_NATIVE_ALIASES
|
# define SIMDE_ENABLE_NATIVE_ALIASES
|
||||||
|
# define SIMDE_FAST_CONVERSION_RANGE
|
||||||
|
# define SIMDE_FAST_MATH
|
||||||
|
# define SIMDE_FAST_NANS
|
||||||
|
# define SIMDE_FAST_ROUND_MODE
|
||||||
|
# define SIMDE_FAST_ROUND_TIES
|
||||||
# include "../simde/simde/x86/sse.h"
|
# include "../simde/simde/x86/sse.h"
|
||||||
# include "../simde/simde/x86/sse2.h"
|
# include "../simde/simde/x86/sse2.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,12 @@
|
||||||
#elif defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD)
|
#elif defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD)
|
||||||
# include <wasm_simd128.h>
|
# include <wasm_simd128.h>
|
||||||
#else
|
#else
|
||||||
|
# define SIMDE_ACCURACY_PREFERENCE 0
|
||||||
# define SIMDE_ENABLE_NATIVE_ALIASES
|
# define SIMDE_ENABLE_NATIVE_ALIASES
|
||||||
|
# define SIMDE_FAST_CONVERSION_RANGE
|
||||||
|
# define SIMDE_FAST_MATH
|
||||||
|
# define SIMDE_FAST_NANS
|
||||||
|
# define SIMDE_FAST_ROUND_MODE
|
||||||
|
# define SIMDE_FAST_ROUND_TIES
|
||||||
# include "../simde/simde/x86/mmx.h"
|
# include "../simde/simde/x86/mmx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -67,7 +67,13 @@ __m64 _mm_set1_pi16(short w)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
# define SIMDE_ACCURACY_PREFERENCE 0
|
||||||
# define SIMDE_ENABLE_NATIVE_ALIASES
|
# define SIMDE_ENABLE_NATIVE_ALIASES
|
||||||
|
# define SIMDE_FAST_CONVERSION_RANGE
|
||||||
|
# define SIMDE_FAST_MATH
|
||||||
|
# define SIMDE_FAST_NANS
|
||||||
|
# define SIMDE_FAST_ROUND_MODE
|
||||||
|
# define SIMDE_FAST_ROUND_TIES
|
||||||
# include "../simde/simde/x86/sse.h"
|
# include "../simde/simde/x86/sse.h"
|
||||||
# include "../simde/simde/x86/sse2.h"
|
# include "../simde/simde/x86/sse2.h"
|
||||||
# include "../simde/simde/x86/sse3.h"
|
# include "../simde/simde/x86/sse3.h"
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
|
#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
|
||||||
# include_next <xmmintrin.h>
|
# include_next <xmmintrin.h>
|
||||||
#else
|
#else
|
||||||
|
# define SIMDE_ACCURACY_PREFERENCE 0
|
||||||
# define SIMDE_ENABLE_NATIVE_ALIASES
|
# define SIMDE_ENABLE_NATIVE_ALIASES
|
||||||
|
# define SIMDE_FAST_CONVERSION_RANGE
|
||||||
|
# define SIMDE_FAST_MATH
|
||||||
|
# define SIMDE_FAST_NANS
|
||||||
|
# define SIMDE_FAST_ROUND_MODE
|
||||||
|
# define SIMDE_FAST_ROUND_TIES
|
||||||
# include "../simde/simde/x86/avx.h"
|
# include "../simde/simde/x86/avx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -182,6 +182,9 @@ struct HostAudio2 : HostAudio<2> {
|
||||||
|
|
||||||
if (in1connected)
|
if (in1connected)
|
||||||
{
|
{
|
||||||
|
if (!std::isfinite(dataOuts[0][k]))
|
||||||
|
__builtin_unreachable();
|
||||||
|
|
||||||
valueL = inputs[0].getVoltageSum() * 0.1f;
|
valueL = inputs[0].getVoltageSum() * 0.1f;
|
||||||
|
|
||||||
if (dcFilterEnabled)
|
if (dcFilterEnabled)
|
||||||
|
@ -200,6 +203,9 @@ struct HostAudio2 : HostAudio<2> {
|
||||||
|
|
||||||
if (in2connected)
|
if (in2connected)
|
||||||
{
|
{
|
||||||
|
if (!std::isfinite(dataOuts[1][k]))
|
||||||
|
__builtin_unreachable();
|
||||||
|
|
||||||
valueR = inputs[1].getVoltageSum() * 0.1f;
|
valueR = inputs[1].getVoltageSum() * 0.1f;
|
||||||
|
|
||||||
if (dcFilterEnabled)
|
if (dcFilterEnabled)
|
||||||
|
|
|
@ -146,16 +146,24 @@ struct HostCV : TerminalModule {
|
||||||
inputOffset = params[BIPOLAR_INPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f;
|
inputOffset = params[BIPOLAR_INPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f;
|
||||||
|
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
|
{
|
||||||
|
if (!std::isfinite(dataOuts[i+ioOffset][k]))
|
||||||
|
__builtin_unreachable();
|
||||||
dataOuts[i+ioOffset][k] += inputs[i].getVoltage() + inputOffset;
|
dataOuts[i+ioOffset][k] += inputs[i].getVoltage() + inputOffset;
|
||||||
|
}
|
||||||
|
|
||||||
if (pcontext->variant == kCardinalVariantMain)
|
if (pcontext->variant == kCardinalVariantMain)
|
||||||
{
|
{
|
||||||
inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f;
|
inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f;
|
||||||
|
|
||||||
for (int i=5; i<10; ++i)
|
for (int i=5; i<10; ++i)
|
||||||
|
{
|
||||||
|
if (!std::isfinite(dataOuts[i+ioOffset][k]))
|
||||||
|
__builtin_unreachable();
|
||||||
dataOuts[i+ioOffset][k] += inputs[i].getVoltage() + inputOffset;
|
dataOuts[i+ioOffset][k] += inputs[i].getVoltage() + inputOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
|
|
|
@ -924,7 +924,7 @@ protected:
|
||||||
json_object_set_new(moduleJ, "favorite", json_boolean(m.favorite));
|
json_object_set_new(moduleJ, "favorite", json_boolean(m.favorite));
|
||||||
if (m.added > 0)
|
if (m.added > 0)
|
||||||
json_object_set_new(moduleJ, "added", json_integer(m.added));
|
json_object_set_new(moduleJ, "added", json_integer(m.added));
|
||||||
if (std::isfinite(m.lastAdded))
|
if (std::isfinite(m.lastAdded) && d_isNotZero(m.lastAdded))
|
||||||
json_object_set_new(moduleJ, "lastAdded", json_real(m.lastAdded));
|
json_object_set_new(moduleJ, "lastAdded", json_real(m.lastAdded));
|
||||||
|
|
||||||
if (json_object_size(moduleJ))
|
if (json_object_size(moduleJ))
|
||||||
|
|
|
@ -104,6 +104,10 @@ ifeq ($(HAIKU),true)
|
||||||
BASE_FLAGS += -DCLOCK_MONOTONIC_RAW=CLOCK_MONOTONIC
|
BASE_FLAGS += -DCLOCK_MONOTONIC_RAW=CLOCK_MONOTONIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MOD_BUILD),true)
|
||||||
|
BASE_FLAGS += -DSIMDE_ENABLE_OPENMP -fopenmp
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(WASM),true)
|
ifneq ($(WASM),true)
|
||||||
ifneq ($(HAIKU),true)
|
ifneq ($(HAIKU),true)
|
||||||
BASE_FLAGS += -pthread
|
BASE_FLAGS += -pthread
|
||||||
|
|
|
@ -323,6 +323,8 @@ BASE_FLAGS += -DDISTRHO_PLUGIN_USES_CUSTOM_MODGUI=0
|
||||||
else
|
else
|
||||||
BASE_FLAGS += -DDISTRHO_PLUGIN_USES_CUSTOM_MODGUI=1
|
BASE_FLAGS += -DDISTRHO_PLUGIN_USES_CUSTOM_MODGUI=1
|
||||||
endif
|
endif
|
||||||
|
BASE_FLAGS += -DSIMDE_ENABLE_OPENMP -fopenmp
|
||||||
|
LINK_FLAGS += -fopenmp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(WASM),true)
|
ifneq ($(WASM),true)
|
||||||
|
@ -346,8 +348,6 @@ BASE_FLAGS += -DNANOVG_GLES3_FORCED
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BUILD_C_FLAGS += -std=gnu11
|
BUILD_C_FLAGS += -std=gnu11
|
||||||
BUILD_C_FLAGS += -fno-finite-math-only -fno-strict-aliasing
|
|
||||||
BUILD_CXX_FLAGS += -fno-finite-math-only -fno-strict-aliasing
|
|
||||||
|
|
||||||
ifneq ($(MACOS),true)
|
ifneq ($(MACOS),true)
|
||||||
BUILD_CXX_FLAGS += -faligned-new -Wno-abi
|
BUILD_CXX_FLAGS += -faligned-new -Wno-abi
|
||||||
|
|
|
@ -140,11 +140,9 @@ static void Cable_step(Cable* that) {
|
||||||
const int channels = output->channels;
|
const int channels = output->channels;
|
||||||
// Copy all voltages from output to input
|
// Copy all voltages from output to input
|
||||||
for (int c = 0; c < channels; c++) {
|
for (int c = 0; c < channels; c++) {
|
||||||
float v = output->voltages[c];
|
if (!std::isfinite(output->voltages[c]))
|
||||||
// Set 0V if infinite or NaN
|
__builtin_unreachable();
|
||||||
if (!std::isfinite(v))
|
input->voltages[c] = output->voltages[c];
|
||||||
v = 0.f;
|
|
||||||
input->voltages[c] = v;
|
|
||||||
}
|
}
|
||||||
// Set higher channel voltages to 0
|
// Set higher channel voltages to 0
|
||||||
for (int c = channels; c < input->channels; c++) {
|
for (int c = channels; c < input->channels; c++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue