Just a quick community service note.
PluginVal started failing me on denormals on release builds on Apple silicon.
From what I can tell: if you have inputs near the denormal floor, and FloatVectorOperations::multiply with a gain like 0.1f near the end of your processing chain, you can end up with denormals in your output, even with juce::ScopedNoDenormals in scope.
I think the mechanism is that ScopedNoDenormals is just for the current thread/context, and osx may deploy the vectorized multiply to another CPU context?
Not sure - but when I switched to a naive looped multiply-with-const (which presumably clang will optimize pretty hard?), my pluginval denormal failure went away. No problem seen on x86_64.
Anyone have more context on this one? Thanks.
1 Like
Perhaps vDSP uses some speicific acceleration hardware instead of NEON SIMD registers? I have seen some unofficial reports about matrix calculation in vDSP before.
1 Like
That’s super interesting and I’m not sure if it should be considered concerning or not.
If we think this through and assume that the calculation gets dispatched to some acceleator instead being calculated on the CPU and we assumed for a moment, that this accelerator would not work slower when computing denormals, then I’m not sure it it would actually be problematic? I mean if those values would be computed further on a thread with ScopedNoDenormals active, shouldn’t the next following arithmetic operation not dispatched to some library function just ignore the denormals again and all will be as expected basically?
Because as far as I understand, not the general existence of a denormal value is problematic but the slowdown that they cause for some CPU based calculations on them in case they are not deactivated for the current CPU context.
It’s still interesting if emiting denormals from the plugin is problematic to the host, which could mean that in cases like yours where that vDSP computed values are the actual output to the plugin the host would have to deal with avoiding denormal calculations, but I assume that it’s probably common practice for hosts too?
And last but not least it’s of course pure speculation that these values get emitted by some accelerator that doesn’t suffer any slowdown when computing denormals.
But it shouldn’t be too hard to write a few benchmarks and unit tests to verify this behaviour.
On what system did you see this happening, @remaincalm?
Mac mini M2, not one of the fancier ones.
In this case, the very last processing in a synth I’m working on is a master volume adjustment, so it was passing denormal-scale floats back to the host.