osxmidi / LinVst

Linux Windows vst wrapper/bridge
GNU General Public License v3.0
674 stars 41 forks source link

Extreme cpu leak: IK Multimedia MODO BASS + almost any Kush / Sly-Fi plugins #174

Closed keybreak closed 3 years ago

keybreak commented 3 years ago

Description

There are severe cpu leaks when using almost any Kush / Sly-Fi plugins on top of: IK multimedia MODO BASS v1.5.1

Reproduce

  1. Load IK Multimedia MODO BASS v1.5.1, drop some notes on pattern
  2. Load Kush REDDI v1.0
  3. Press stop in Renoise
  4. CPU will gradually spike from whatever it was up to 100% (about 1-2 seconds) and Renoise's audio engine will crash
  5. After you press OK on pop-up and audio engine will restart in about 2 seconds CPU will start to spike to 100% and crash again
  6. You can go infinite times like that.

Some Kush / Sly-Fi plugins on step 4 just rich about 70-80% CPU (climbs to that slightly longer, like 4-5 seconds) and stuck in that state, without getting to crash state.

Here are test results:

CPU % on stop Dev Name Version
100% + audio engine crash Kush REDDI v1.0
100% + audio engine crash Sly-fi Axis EQ v1.0.6
100% + audio engine crash Sly-fi Deflector v1.0.5
100% + audio engine crash Sly-fi Kaya v1.1.0
~80% Kush Goldplate v1.0.2

Few things to note

  1. Independently out of that combination - all of the mentioned plugins work perfectly, so it's only combination
  2. I couldn't quickly find other VSTi that would produce similar effect like MODO BASS in combination with Kush / Sly-Fi
  3. I couldn't find any VST that would produce similar effect like Kush / Sly-Fi in combination with MODO BASS, and i've tried some very heavy plugins, with oversampling etc.
  4. I've tested exactly same combinations in VM on Windows with same Renoise version - it doesn't happen there.

So given all that information, i would think it's most likely something in LinVst, doesn't look like Wine, Renoise, individual plugins...

Enviroments

 OS: Manjaro 20.2 Nibia
 Kernel: x86_64 Linux 5.4.80-2-MANJARO
 Shell: bash 5.0.18
 DE: KDE 5.76.0 / Plasma 5.20.4
 WM: KWin
 dm: SDDM 
 gcc: 10.2.0
 tk: Qt 5.15.2 
 driver: nvidia v: 455.45.01 
 WINE: 5.19-staging amd64

Winetricks

isolate_home
mimeassoc=off
gdiplus
andale
arial
comicsans
courier
georgia
impact
times
trebuchet
verdana
webdings
corefonts
tahoma
mfc42
vcrun6
iertutil
wininet
fontsmooth=rgb
win7
keybreak commented 3 years ago

Oh, just noticed one thing with REDDI for example, if you turn off oversampling - it doesn't seem to 100% + audio-engine crash anymore...

Which still doesn't make it any normal behavior, but hopefully would give you some idea

osxmidi commented 3 years ago

I tried it out.

The REDDI/IK combo is ok in Reaper.

As soon as a note is played in Renoise, it cycles up to 100% (just with the REDDI plugin, not with other plugins) .

Maybe it's something to do with REDDI/iLok and Renoise, incompatibility.

keybreak commented 3 years ago

@osxmidi hmmm...That's interesting, thx for checking Reaper.

What iLok :laughing: Mine is completely cut out, you know..I actually respect my CPU / RAM :pirate_flag:

I think it has something to do with oversampling, can you confirm that when you turn of REDDI oversampling it doesn't happen in Renoise?

Besides, if it was the iLok or something along those lines, surely each of mentioned plugins would have that problem on their own, but they don't have it

osxmidi commented 3 years ago

@osxmidi hmmm...That's interesting, thx for checking Reaper.

What iLok laughing Mine is completely cut out, you know..I actually respect my CPU / RAM pirate_flag

I think it has something to do with oversampling, can you confirm that when you turn of REDDI oversampling it doesn't happen in Renoise?

Besides, if it was the iLok or something along those lines, surely each of mentioned plugins would have that problem on their own, but they don't have it

Well, I've only got the demos and the REDDI demo uses ilok.

Something is causing problems with Wine/Renoise and not Wine Reaper, and ilok was one of the things on my list and I can take it off now.

It all behaves ok with Renoise if I turn oversampling off.

My theory (at the moment) is that the oversampling is interfering with Renoise's/Wine's threads maybe, and the oversampling is ok with Reaper's/Wine's threads.

I've seen similar things with other plugins where GUI acceleration was enabled and sometimes with Kontakt and multiple cpus enabled which goes up to 100% cpu on some computers/systems.

It's basically a Wine/Daw incompatibility of some sort, so just turn off oversampling.

keybreak commented 3 years ago

It's basically a Wine/Daw incompatibility of some sort, so just turn off oversampling.

Well...I don't know, it's not really a viable solution for some of my use cases, please don't close it unless we find a real cause / cure. Also it reminds me of that kind of problem: https://github.com/osxmidi/LinVst/issues/114

Maybe @robbert-vdh would have an idea?

I've seen similar things with other plugins where GUI acceleration was enabled and sometimes with Kontakt and multiple cpus enabled which goes up to 100% cpu on some computers/systems.

That is interesting, i haven't seen that on Renoise with same conditions :thinking: Anything common you've found on those computers / systems?


Later i'll test with other Linux bridges to confirm / exclude if it's some Wine/Daw voodoo magic

robbert-vdh commented 3 years ago

The same thing happens when I test IK multimedia MODO BASS v1.5.1 and Kush REDDI v1.0 with Renoise 3.2.4, wine-tkg 6.0 rc-4 and yabridge's latest master branch commit. This is just a bug in REDDI. I haven't dug too deep into what exactly it is doing during audio processing, but REDDI doesn't handle small (but still not denormal) input values. After stopping playback Renoise will send buffers with an RMS of around 1e-20, but with a lot of values values going as low as 1e-[40-45] (which is about as low as you can go with single precision floating point numbers). My guess is that REDDI does some dividing or exponentiation internally which results in denormals and the plugin thus starts showing abnormal behaviour.

keybreak commented 2 years ago

@osxmidi Please take a look at this, perhaps you can implement something similar to avoid that bug, but it might break other plugins as mentioned: https://github.com/robbert-vdh/yabridge/commit/2be41da9b668bf2e3d389d969147fccc3388ffe3#commitcomment-50083689