Browse Source

Fixup details for non-x86 simd compat, fix CI linux cross-compile

Signed-off-by: falkTX <falktx@falktx.com>
tags/24.04
falkTX 1 year ago
parent
commit
a8a5cea9fb
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
16 changed files with 165 additions and 182 deletions
  1. +2
    -2
      .github/workflows/build.yml
  2. +0
    -3
      .gitmodules
  3. +6
    -21
      Makefile.base.mk
  4. +0
    -13
      deps/Makefile
  5. +1
    -1
      deps/PawPaw
  6. +8
    -15
      include/simd-compat/emmintrin.h
  7. +11
    -18
      include/simd-compat/immintrin.h
  8. +6
    -17
      include/simd-compat/mmintrin.h
  9. +8
    -39
      include/simd-compat/pmmintrin.h
  10. +52
    -0
      include/simd-compat/simd-compat.h
  11. +23
    -0
      include/simd-compat/smmintrin.h
  12. +21
    -0
      include/simd-compat/tmmintrin.h
  13. +9
    -15
      include/simd-compat/xmmintrin.h
  14. +6
    -19
      include/simd/common.hpp
  15. +4
    -14
      include/simd/functions.hpp
  16. +8
    -5
      plugins/Makefile

+ 2
- 2
.github/workflows/build.yml View File

@@ -53,7 +53,7 @@ jobs:
shell: bash
run: |
./deps/PawPaw/.github/workflows/bootstrap-deps.sh linux-${{ matrix.target }}
apt-get install -yqq wget
apt-get install -yqq wget zip
- name: Setup dependencies (aarch64)
if: ${{ matrix.target == 'aarch64' }}
shell: bash
@@ -417,7 +417,7 @@ jobs:
- name: Set up dependencies
run: |
./deps/PawPaw/.github/workflows/bootstrap-deps.sh ${{ matrix.target }}
apt-get install -yqq wget
apt-get install -yqq wget zip
apt-get clean
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2


+ 0
- 3
.gitmodules View File

@@ -212,9 +212,6 @@
[submodule "plugins/dBiz"]
path = plugins/dBiz
url = https://github.com/dBiz/dBiz.git
[submodule "include/simde"]
path = include/simde
url = https://github.com/simd-everywhere/simde.git
[submodule "plugins/RebelTech"]
path = plugins/RebelTech
url = https://github.com/hemmer/rebel-tech-vcv.git


+ 6
- 21
Makefile.base.mk View File

@@ -68,6 +68,12 @@ endif

ifeq ($(NOSIMD),true)
BASE_FLAGS += -DCARDINAL_NOSIMD
else ifeq ($(WASM),true)
BASE_FLAGS += -msse -msse2 -msse3 -msimd128
else ifeq ($(CPU_ARM32),true)
BASE_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard
else ifeq ($(CPU_I386_OR_X86_64),true)
BASE_FLAGS += -msse -msse2 -msse3 -mfpmath=sse
endif

ifeq ($(SYSDEPS),true)
@@ -109,10 +115,6 @@ BASE_FLAGS += -DSIMDE_FAST_NANS
BASE_FLAGS += -DSIMDE_FAST_ROUND_MODE
BASE_FLAGS += -DSIMDE_FAST_ROUND_TIES

# unwanted
BASE_FLAGS += -DSIMDE_X86_SSE4_1_H
BASE_FLAGS += -DSIMDE_X86_SSE4_2_H

# -----------------------------------------------------------------------------
# Rack build flags

@@ -161,25 +163,8 @@ endif

# needed for enabling SSE in pffft
ifeq ($(CPU_I386),true)
ifneq ($(NOSIMD),true)
BASE_FLAGS += -Di386
endif
endif

# SIMD must always be enabled, even in debug builds
ifneq ($(NOSIMD),true)
ifeq ($(DEBUG),true)

ifeq ($(WASM),true)
BASE_FLAGS += -msse -msse2 -msse3 -msimd128
else ifeq ($(CPU_ARM32),true)
BASE_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard
else ifeq ($(CPU_I386_OR_X86_64),true)
BASE_FLAGS += -msse -msse2 -msse3 -mfpmath=sse
endif

endif
endif

BASE_FLAGS += -I$(abspath $(ROOT)/dpf/dgl/src/nanovg)
BASE_FLAGS += -I$(abspath $(ROOT)/dpf/distrho)


+ 0
- 13
deps/Makefile View File

@@ -269,19 +269,6 @@ endif
# use custom JUCE from DISTRHO and Carla
SURGE_CXX_FLAGS += -I$(abspath ../carla/source/modules)

# SIMD must always be enabled, even in debug builds
ifeq ($(NOSIMD),true)
SURGE_CXX_FLAGS += -DCARDINAL_NOSIMD
else ifeq ($(DEBUG),true)
ifeq ($(WASM),true)
SURGE_CXX_FLAGS += -msse -msse2 -msse3 -msimd128
else ifeq ($(CPU_ARM32),true)
SURGE_CXX_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard
else ifeq ($(CPU_I386_OR_X86_64),true)
SURGE_CXX_FLAGS += -msse -msse2 -mfpmath=sse
endif
endif

# possibly use fftw?
# ifeq ($(shell $(PKG_CONFIG) --exists fftw3 fftw3f && echo true),true)
# SURGE_CXX_FLAGS += -DJUCE_DSP_USE_STATIC_FFTW=1


+ 1
- 1
deps/PawPaw

@@ -1 +1 @@
Subproject commit 1369e1f84e6391df761b5ac5e143ab6841e57f7e
Subproject commit 7822bb0ba1deb75b3010d6efab63a4f854174b56

+ 8
- 15
include/simd-compat/emmintrin.h View File

@@ -1,26 +1,19 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
#include "simd-compat.h"

#ifdef SIMDE_X86_SSE2_NATIVE
# include_next <emmintrin.h>
#else
# include "mmintrin.h"
# include "xmmintrin.h"
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "simde/x86/sse.h"
# include "simde/x86/sse2.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
#endif

+ 11
- 18
include/simd-compat/immintrin.h View File

@@ -1,27 +1,20 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
#include "simd-compat.h"

#ifdef SIMDE_X86_SSE_NATIVE
# include_next <immintrin.h>
#else
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "../simde/simde/x86/sse.h"
# include "../simde/simde/x86/sse2.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
# include "mmintrin.h"
# include "xmmintrin.h"
# include "emmintrin.h"
# include "pmmintrin.h"
# include "tmmintrin.h"
# include "smmintrin.h"
#endif

+ 6
- 17
include/simd-compat/mmintrin.h View File

@@ -1,28 +1,17 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#if (defined(__i386__) || defined(__x86_64__)) && !defined(CARDINAL_NOSIMD)
#include "simd-compat.h"

#ifdef SIMDE_X86_MMX_NATIVE
# include_next <mmintrin.h>
#elif defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD)
# include <wasm_simd128.h>
#else
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "../simde/simde/x86/mmx.h"
# include "simde/x86/mmx.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
#endif

+ 8
- 39
include/simd-compat/pmmintrin.h View File

@@ -1,51 +1,20 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
#include "simd-compat.h"

#ifdef SIMDE_X86_SSE3_NATIVE
# include_next <pmmintrin.h>
# if defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD)
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
_mm_set1_pi16(short w)
{
return __extension__ (__m64){ static_cast<float>(w), static_cast<float>(w) };
}
# endif
#else
# include "mmintrin.h"
# include "xmmintrin.h"
# include "emmintrin.h"
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "simde/x86/sse.h"
# include "simde/x86/sse2.h"
# include "simde/x86/sse3.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
/*
#elif defined(__ARM_NEON)
# include "../sse2neon/sse2neon.h"

static inline
void __builtin_ia32_pause()
{
__asm__ __volatile__("isb\n");
}

static inline
__m64 _mm_set1_pi16(short w)
{
return vreinterpret_s64_s16(vdup_n_s16(w));
}
*/
#endif

+ 52
- 0
include/simd-compat/simd-compat.h View File

@@ -0,0 +1,52 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

// native up to SSE3
#if (defined(_M_X64) || defined(__amd64__) || defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP == 2)) && !defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD)
# define SIMDE_X86_MMX_NATIVE
# define SIMDE_X86_SSE_NATIVE
# define SIMDE_X86_SSE2_NATIVE
# define SIMDE_X86_SSE3_NATIVE
#else
# define SIMDE_X86_MMX_NO_NATIVE
# define SIMDE_X86_SSE_NO_NATIVE
# define SIMDE_X86_SSE2_NO_NATIVE
# define SIMDE_X86_SSE3_NO_NATIVE
#endif

// everything else is emulated
#define SIMDE_X86_SSSE3_NO_NATIVE
#define SIMDE_X86_SSE4_1_NO_NATIVE
#define SIMDE_X86_SSE4_2_NO_NATIVE
#define SIMDE_X86_XOP_NO_NATIVE
#define SIMDE_X86_AVX_NO_NATIVE
#define SIMDE_X86_AVX2_NO_NATIVE
#define SIMDE_X86_FMA_NO_NATIVE
#define SIMDE_X86_AVX512F_NO_NATIVE
#define SIMDE_X86_AVX512BF16_NO_NATIVE
#define SIMDE_X86_AVX512BW_NO_NATIVE
#define SIMDE_X86_AVX512VL_NO_NATIVE
#define SIMDE_X86_AVX512DQ_NO_NATIVE
#define SIMDE_X86_AVX512CD_NO_NATIVE
#define SIMDE_X86_AVX5124VNNIW_NO_NATIVE
#define SIMDE_X86_AVX512VNNI_NO_NATIVE
#define SIMDE_X86_AVX512VBMI2_NO_NATIVE
#define SIMDE_X86_AVX512VBMI_NO_NATIVE
#define SIMDE_X86_AVX512BITALG_NO_NATIVE
#define SIMDE_X86_AVX512VPOPCNTDQ_NO_NATIVE
#define SIMDE_X86_AVX512VP2INTERSECT_NO_NATIVE
#define SIMDE_X86_SVML_NO_NATIVE

// control wasm simd state
#ifdef __EMSCRIPTEN__
# ifdef CARDINAL_NOSIMD
# define SIMDE_WASM_SIMD128_NO_NATIVE
# else
# define SIMDE_WASM_SIMD128_NATIVE
# endif
#endif

+ 23
- 0
include/simd-compat/smmintrin.h View File

@@ -0,0 +1,23 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#include "simd-compat.h"

#ifdef SIMDE_X86_SSE4_1_NATIVE
# include_next <smmintrin.h>
#else
# include "mmintrin.h"
# include "xmmintrin.h"
# include "emmintrin.h"
# include "pmmintrin.h"
# include "tmmintrin.h"
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "simde/x86/sse4.1.h"
# include "simde/x86/sse4.2.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
#endif

+ 21
- 0
include/simd-compat/tmmintrin.h View File

@@ -0,0 +1,21 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#include "simd-compat.h"

#ifdef SIMDE_X86_SSSE3_NATIVE
# include_next <tmmintrin.h>
#else
# include "mmintrin.h"
# include "xmmintrin.h"
# include "emmintrin.h"
# include "pmmintrin.h"
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "simde/x86/ssse3.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
#endif

+ 9
- 15
include/simd-compat/xmmintrin.h View File

@@ -1,26 +1,20 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#if (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__)) && !defined(CARDINAL_NOSIMD)
#include "simd-compat.h"

#ifdef SIMDE_X86_SSE_NATIVE
# include_next <xmmintrin.h>
#else
# include "mmintrin.h"
# define SIMDE_ENABLE_NATIVE_ALIASES
# include "simde/x86/avx.h"
# include "simde/x86/sse.h"
# undef SIMDE_ENABLE_NATIVE_ALIASES
// always use SSE2 mode, as seen in gcc
# include "emmintrin.h"
#endif

+ 6
- 19
include/simd/common.hpp View File

@@ -1,27 +1,14 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#include "mmintrin.h"
#include "xmmintrin.h"
#include "emmintrin.h"
#include "immintrin.h"
#include "pmmintrin.h"

#define SIMDE_ENABLE_NATIVE_ALIASES
#include "simde/x86/ssse3.h"
#include "simde/x86/sse4.1.h"
#include "simde/x86/sse4.2.h"
#include "tmmintrin.h"
#include "smmintrin.h"

+ 4
- 14
include/simd/functions.hpp View File

@@ -1,22 +1,12 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#include "simd/common.hpp"
#include_next "simd/functions.hpp"
#undef SIMDE_MM_FROUND_NO_EXC
// #undef SIMDE_MM_FROUND_NO_EXC
// #undef _MM_FROUND_NO_EXC

+ 8
- 5
plugins/Makefile View File

@@ -284,7 +284,6 @@ endif
ifeq ($(shell $(PKG_CONFIG) --exists fftw3f && echo true),true)
PLUGIN_FILES += Cardinal/src/AudioToCVPitch.cpp
# MINIPLUGIN_FILES += Cardinal/src/AudioToCVPitch.cpp
BASE_FLAGS += -DHAVE_FFTW3F
endif

# --------------------------------------------------------------
@@ -1280,6 +1279,14 @@ BASE_FLAGS += -D'aligned_alloc_16(ptr)'='aligned_alloc(16,ptr)'
BASE_FLAGS += -D'aligned_free_16(ptr)'='free(ptr)'
endif

ifeq ($(WASM),true)
BASE_FLAGS += -DEIGEN_DONT_VECTORIZE=1
endif

ifeq ($(shell $(PKG_CONFIG) --exists fftw3f && echo true),true)
BASE_FLAGS += -DHAVE_FFTW3F
endif

ifeq ($(shell $(PKG_CONFIG) --exists sndfile && echo true),true)
BASE_FLAGS += -DHAVE_SNDFILE
endif
@@ -1329,10 +1336,6 @@ RTNEURAL_FLAGS += -DSKIP_MINGW_FORMAT
RTNEURAL_FLAGS += -DRTNEURAL_DEFAULT_ALIGNMENT=16
RTNEURAL_FLAGS += -DRTNEURAL_USE_EIGEN=1

ifeq ($(WASM),true)
RTNEURAL_FLAGS += -DEIGEN_DONT_VECTORIZE=1
endif

RTNEURAL_FLAGS += -ICardinal/src/AIDA-X/RTNeural
RTNEURAL_FLAGS += -ICardinal/src/AIDA-X/RTNeural/modules/Eigen



Loading…
Cancel
Save