I read the tutorial here but I unfortunately couldn’t get anything usable out of it.
I am trying to just simply improve the optimization of one of my more computationally expensive synths. I must do an enormous amount of multiplications/additions per sample as it is doing some advanced physical modeling.
As I understand it, SIMD allows you to add/multiply up to 4 floats or doubles for the cost of one, right? Is it system dependent how many you can do at once?
What is the absolute simplest code that might allow me to do this hypothetically with SIMD (random data here for example):
//ALREADY EXISTING DATA IN VARIABLES TO WORK WITH
float set1A = 20;
float set1B = 10;
float set1C = 2;
float set1D = 8;
float set2A = 5;
float set2B = 30;
float set2C = 80;
float set2D = 6;
//NEED TO REPLACE WITH SIMD TO GO FASTER AND ASSIGN RESULTS TO THOSE VARIABLE NAMES:
float resultA = set1A * set2A;
float resultB = set1B * set2B;
float resultC = set1C * set2C;
float resultD = set1D * set2D;
Surely there is some easy way to take advantage of the SIMD function to replace the multiplication operations and not make life too hard?
For example, according to this in .NET it would be as simple as putting the data into a Vector4 and using the dot function, followed by reassigning your output variables from that:
Vector4 set1 = new Vector4(set1A, set1B, set1C, set1D);
Vector4 set2 = new Vector4(set2A, set2B, set2C, set2D);
Vector4 result = Vector4.Dot(set1,set2);
float resultA = result.W;
float resultB = result.X;
float resultC = result.Y;
float resultD = result.Z;
This is obvious, simple, easy, and intuitive. Whereas I can’t make any sense of the JUCE equivalent, if one exists.
If the JUCE method is inherently cumbersome, I wonder if it is worth implementing a third party library like this one or is there any other you would recommend?
Thanks for any help.
