https://bugs.winehq.org/show_bug.cgi?id=46056
Bug ID: 46056 Summary: u-he Diva: Multicore option slows down performance Product: Wine Version: 3.18 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: ajduck@outlook.com Distribution: ---
Created attachment 62643 --> https://bugs.winehq.org/attachment.cgi?id=62643 Edited picture highlighting relevant sections of Diva
u-he's Diva plugin is quite CPU intensive. On Windows, the multicore option on Diva improves the performance of it a lot. But on Wine, the multicore option makes it even slower.
You'll need sound output to notice the difference in performance.
You will also need a DAW to test it in. You can either use a Windows DAW (FL Studio is probably easiest, has a detailed manual and I know it works well in Wine), or a Linux DAW using LinVST to load the VST plugin (LinVST uses Wine and requires it to be installed on the system).
(If you decide to load Diva in FL Studio, see this section of the FL Studio manual on how to scan for and load plugins: https://www.image-line.com/support/flstudio_online_manual/html/basics_extern... )
--------
Steps to reproduce:
1. Download and install Diva (link at bottom). Make sure the DAW you're using has detected it (get it to scan for plugins). 2. Load up Diva. At the lower half of the plugin, the panel just above the "MAIN" button and below the "tuning" panel, set Accuracy to divine, Voices to 16 and Stack to 4 (see image attached). These settings are to make Diva use a lot of CPU so that the difference between multicore on and off can be demonstrated. The multicore button (the button in the top bar to the right) should be off (i.e. it should be black). 3. In the DAW/VST host, input 4 MIDI notes playing simultaneously into the DAW/host's piano roll and play them back. Take note of popping and clicking (if any). If it's popping and clicking then keep in mind how frequent/severe it is. 4. Now go back to Diva and enable multicore (click on the black button). It should now be red. 5. Play back the notes you input again. It should be even slower than it was with multicore off.
If somehow one Diva instance with those settings is not enough to cause buffer underruns (audible pops and clicks) even with multicore enabled, clone the current Diva instrument (or add a new Diva and give it the same settings as done in step 2), add MIDI notes as in step 3 but to the new Diva instance and then play back the notes making sure all the Diva instances are playing at the same time. In other words, we're trying to layer another Diva's notes on top of the first one in order to make it use enough CPU to cause buffer underruns. Remember to enable/disable multicore on both Diva instances when comparing between the option being on and off. It's unlikely you'll need more than 2 instances at full accuracy settings because this synth uses up a lot of CPU.
Diva has a native Linux version and the multicore option improves performance as on Windows. But I use FL Studio in Wine and there's currently no way to run/bridge native Linux VSTs in Windows DAWs (that are running in Wine) so I have to use the Windows version.
OS: elementary OS 5.0 Juno (based on Ubuntu 18.04) Tested on Wine 3.19 but I know 3.18 also has the problem.
--------
Download: https://uhedownloads-heckmannaudiogmb.netdna-ssl.com/releases/Diva_143_7422_...
$ sha1sum Diva_143_7422_Win.zip 50032d8ed54e22e8ec495d283e02754f2959b665 Diva_143_7422_Win.zip
https://bugs.winehq.org/show_bug.cgi?id=46056
ajduck@outlook.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://uhedownloads-heckma | |nnaudiogmb.netdna-ssl.com/r | |eleases/Diva_143_7422_Win.z | |ip Keywords| |download
https://bugs.winehq.org/show_bug.cgi?id=46056
--- Comment #1 from ajduck@outlook.com --- Still happening as of Wine 4.11.
u-he's ACE plugin also slows down when that plugin's multicore option is enabled.
However, u-he's Repro-5 plugin does *not* slow down when it's multicore option is enabled and it improves performance as expected (almost halves processing time going by FL's new plugin performance monitor).
I looked at what was happening with the threads under htop.
Diva with multicore enabled used 15-16 (additional?) threads when 4 notes (4 voices per note) were held down playing 16 voices in total (a voice being one "instance"/"offshoot" of the synth). It seems that for every voice Diva and ACE uses a thread, and the maximum voices for both synths is 16 voices.
Meanwhile, Repro-5 seemed to only use at most 3-4 additional threads with multicore enabled even when holding down the maximum of 8 notes. This is with 1 voice per note as you can't stack voices with Repro-5, so 8 notes = 8 voices.
I say "additional" because with multicore options off there still seems to be mutithreading activity but under 3-4 common threads which probably has something to do with FL.
Anyway, perhaps the slowdown has something to do with some multithreading bottleneck as a lot more threads are being used in the case of Diva and ACE? Or perhaps Repro-5 is using some different Wine functions/codepath to Diva and ACE that avoids a slowdown regardless of how many threads used? This is just speculation/guessing of course.
----
I also wonder if this issue could have some relation to why FL Studio in general slows down as a project file gets bigger. As more plugins are loaded and lots of stuff is showing in FL Studio's GUI and playlist (where everything gets laid out in a project file), processing speed can immensely slow down compared to what it would be on Windows, even when using FL features like "smart disable" (which disables a plugin after some time when no MIDI/audio input is going to it). More plugins = more threads, and FL's GUI is rendered entirely by the CPU (I may make a separate issue for this).
https://bugs.winehq.org/show_bug.cgi?id=46056
--- Comment #2 from ajduck@outlook.com --- Just updating this issue to say it's still a problem, though I know this is more of a long-term/wider thing than a specific bug.
As I said, I think it may be more to do with Wine's multicore performance in general. I've found as of recently that setting both FL and wineserver to highest realtime priority seems to possibly improve performance in general (buffer underruns seem slightly less long) but I don't think it completely fixes what might be some sort of "Wine multicore/thread overhead" or otherwise potential for optimization.
https://bugs.winehq.org/show_bug.cgi?id=46056
johnstonljordan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |johnstonljordan@gmail.com
--- Comment #3 from johnstonljordan@gmail.com --- @ajduck
ni idea if you still watch this bug - but I have multi-core mode working with U-He VST plugins just fine. (in my own wine-fork)
ref: https://github.com/nine7nine/Wine-NSPA
It requires a lot of out-of-tree code to fix this problem. As you suspect, Wineserver is part of the problem (it being single-threaded). It simply cannot handle getting hammered by calls from Diva's worker threads in multi-core mode. it will stall, big time...
but the problem is larger than that. You need to be using Fsync (From Proton) to help fix the synchronization issues in Wine... You also need all of the relevant threads in Wine to be RT, AND have a multi-threaded winerserver implementation (with it's threads all run at high RT priority)...
After all of this, Diva will run incredibly well, but there are still some issues with particular presets + high CPU usage (as happens with some other VSTs too). I think this has more to do with heap performance and locking issues in Wine though, although I'm not positive... the LFH patchwork help somewhat (Low Fragmentation Help).
I don't see Vanilla-Wine being able to support this any time soon, and even something like Proton or Wine-TKG isn't going to support it either (although they get you part way there, for sure)...
runnning proaudio apps in Wine has always been problematic.