Well I’ll be DAMNED! I just found out a way to partially vectorize floating point division and square root operations on the Sega Dreamcast’s SH4 CPU, which has dedicated SIMD instructions for neither.
The key is that we exploit the fact that the FDIV and FSQRT instructions do the majority of their computational work in a separate pipeline stage, F3, from the regular floating-point computational instructions. This allows for most of a FDIV or FSQRT instruction to make its way through the pipeline in parallel with regular computational work.
The problem is that FDIV and FSQRT are still the two slowest single-precision floating point instructions on the whole chip, though, and needing to issue multiple back-to-back, as is the case with a vector form, causes a big ass pipeline stall as each must wait for the prior instruction to vacate the parallel pipeline.
But what if we could devise a way to quickly compute the equivalents using the regular pipeline while the dedicated instructions occupy their own, separate pipeline, and we can overlap two computations for each cycle?
Well, by (ab)using the FSSRA instruction, which gives us a fast reciprocal square root approximation (think Carmacks famous approximation as a dedicated instruction), we can devise both a division and square root approximate that does its work separately from the FDIV/FSQRT pipeline, by using the following mathematical identities:
sqrt(x) = x * 1/sqrt(x)
n / d = n * 1/sqrt(d * d)
NOW we can create vector forms of these operations (right) which can interleave the dedicated instructions with FSRRA fast approximates to do the majority of the work in parallel pipelines, yielding us precious clock cycle GAINZ over just chaining the dedicated instructions!
NOTE: Yes, you have to protect against FSSRA(0) for SQRT and preserve the sign of the denominator for DIV. It’s still a gain with the extra work, and I offer alternate fast routines for when it’s not necessary, but I left both out to simplify the description. :)
The three biggest things here are CEF (Browser sources) being updated, plugin restructuring, and an update to a graphics library we use.
If you rely on browser sources or plugins (Hello literally everybody) please read on for details:
1. CEF has been updated from v127 to v150
This was a massive undertaking and took over a year of work from volunteer contributors. We were stuck on v127 for a number of reasons and a lot of changes were needed to allow us to update past that.
More info on that is on GitHub here:
https://t.co/9SPQkerXKJ
This means that the framework powering browser sources and docks has been updated. While we've done our best to test things, modern browsers are obviously capable of a lot, and people use browser sources and docks in OBS in an incredible variety of creative (and cursed) ways.
🔷Please test your overlays, alerts, and other web-based tools on 33.0 and let us know if anything is broken or not working how it did before.🔷
2. Plugin structure and loading changes
As we continue our work on the plugin manager, we've made a significant update to how OBS handles plugin loading.
This should not directly affect existing plugins at all and they will continue to work as normal*
(However, please also see #3).
Some slight changes to where plugins are stored and the structure of those folders has happened as part of this. Those changes do not impact 33.0. Plugins in the old location and structure will still load fine, but be marked as Legacy in the plugin manager to indicate this. We hope over the next year, plugin authors will be able to release new versions that update to the new structure.
3. Internal image library update
We've updated a framework that is used by OBS internally for handling animated images. Unfortunately due to how this was originally implemented, it means that any plugin utilizing the libobs graphics system to render images via gs_image MUST be updated.
As a result when you update to 33.0 plugins that relied on this will fail to load. You can return to version 32 to continue to use these plugins, or wait for the plugin author to update them for 33.0.
If you are a plugin author you can see the changes in the docs diff here:
https://t.co/XTh3va0Oqj
Thank you very much to everyone who helps us with testing and feedback! 💙