If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
Could this technique be faster ?
5 posts
• Page 1 of 1
Could this technique be faster ?
Hi,
What do you think of this technique ? Could it be faster ?
Here's an example with a little sin osc code.
Normally we must load 6 variables every cycle.
But there's 2 float and 2 int that have the same value for all SSE channels.
The idea is to use the SSE to store the 2 float an 2 int in 1 float and 1 int in stage0.
So we could load 2 variable instead of 4.
Then in stage 2 we have to copy to another register and shufps. But i suppose this could be faster ?
Well in this example it does not change so much but maybe with code that need more variable ?
Also, do you think that the aliasing is ok with this sin approximation ?
Thanks for any response !)
What do you think of this technique ? Could it be faster ?
Here's an example with a little sin osc code.
Normally we must load 6 variables every cycle.
But there's 2 float and 2 int that have the same value for all SSE channels.
The idea is to use the SSE to store the 2 float an 2 int in 1 float and 1 int in stage0.
So we could load 2 variable instead of 4.
Then in stage 2 we have to copy to another register and shufps. But i suppose this could be faster ?
Well in this example it does not change so much but maybe with code that need more variable ?
Also, do you think that the aliasing is ok with this sin approximation ?
Thanks for any response !)
- Attachments
-
sin way.fsm
- (Now use stage0 and not 1 to initialize ;)
- (34.39 KiB) Downloaded 325 times
Last edited by Tepeix on Wed Apr 13, 2022 7:54 pm, edited 1 time in total.
- Tepeix
- Posts: 333
- Joined: Sat Oct 16, 2021 3:11 pm
Re: Could this technique be faster ?
I upgraded a little. Specially for the triple sin.
But taking the risk of a int/float confusion.. Is it possibly dangerous ????
That was not so much sense to extract the variable at every use..
Now the five variable are extracted once, (letting only 3 left for calculation)
Also at each cycle it have only to read 1 variable to get in the 4 SSE channels 2 float and also 2 int.
So it's a float variable that contain 2 int, (abs and sign) and 2 float (1,0.2222).
That's the int/float confusion think..
There's no conversion, but only shufps extracting.
But taking the risk of a int/float confusion.. Is it possibly dangerous ????
That was not so much sense to extract the variable at every use..
Now the five variable are extracted once, (letting only 3 left for calculation)
Also at each cycle it have only to read 1 variable to get in the 4 SSE channels 2 float and also 2 int.
So it's a float variable that contain 2 int, (abs and sign) and 2 float (1,0.2222).
That's the int/float confusion think..
There's no conversion, but only shufps extracting.
- Attachments
-
sin way v2.fsm
- (Now use stage0 and not1 to initialize ;)
- (36.39 KiB) Downloaded 332 times
- Tepeix
- Posts: 333
- Joined: Sat Oct 16, 2021 3:11 pm
Re: Could this technique be faster ?
Note that shufps won't work well in the poly section - the natural habitat of most oscillators.
-
martinvicanek - Posts: 1301
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Could this technique be faster ?
I didn't think about that.
But it seams to be ok in this special case.
The little synth i make work well.
I suppose it's because every shufps here take the same value for every channels.
When there's a 5e voice (or 9, 13,..) it have to load variable as 4 channels.
Even if there's no other's voice to shufps with.
Well maybe the variables must also be fixed and never change..
I would try to do more test but it seams to work well.
But it seams to be ok in this special case.
The little synth i make work well.
I suppose it's because every shufps here take the same value for every channels.
When there's a 5e voice (or 9, 13,..) it have to load variable as 4 channels.
Even if there's no other's voice to shufps with.
Well maybe the variables must also be fixed and never change..
I would try to do more test but it seams to work well.
- Attachments
-
SinWay Synth.fsm
- (27.68 KiB) Downloaded 334 times
- Tepeix
- Posts: 333
- Joined: Sat Oct 16, 2021 3:11 pm
Re: Could this technique be faster ?
..well, finally i doesn't see so much change with loading normally the four variable or using this special technique..
Here's a test with 127 notes played at once.. Maybe there's -0.2% cpu less for 6% cpu... Not even sure

Here's a test with 127 notes played at once.. Maybe there's -0.2% cpu less for 6% cpu... Not even sure


- Attachments
-
SinWay SynthTest.fsm
- (92.22 KiB) Downloaded 327 times
- Tepeix
- Posts: 333
- Joined: Sat Oct 16, 2021 3:11 pm
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests