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
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
stream routing matrix in dsp code!?
28 posts
• Page 3 of 3 • 1, 2, 3
Re: stream routing matrix in dsp code!?
thank you martin, the 16 byte alignment is a good thing, it can be used for the connections too..
i just found out that the zero initialising for the targets is needed! could a loop be used for this?
i still think it should be possible to to use KG's methode for int inputs for the ASM module to getting rid of the conversion to int?
just couldn't figure it out
i just found out that the zero initialising for the targets is needed! could a loop be used for this?
i still think it should be possible to to use KG's methode for int inputs for the ASM module to getting rid of the conversion to int?
just couldn't figure it out
Last edited by Nubeat7 on Sun Aug 02, 2015 6:53 am, edited 1 time in total.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
well, tested this in "reallife" and performance is very good, no difference to the bussystem! and ways faster on presetchanges.. thank you very much martin and KG!
without the conversion to int for the connection indexes there could still be saved 6-8 cycles for each connection! which is a lot when having more connections...
without the conversion to int for the connection indexes there could still be saved 6-8 cycles for each connection! which is a lot when having more connections...
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
Can't you do the int conversion in Ruby? I mean you probably won't be changing connections at 44 kHz.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: stream routing matrix in dsp code!?
yes thats what i want to do but i dont know how? in the last example above i tried to do this but with no success.. i think it is becasue KG's code saves 2 16byte integers on one 32byte place, but then when i split the converted int array inside ruby to the single outputs i get wrong values.. or i'm doing something else in a wrong way...
i also tried to use a loop to assign the targets to zerobut i don't know if a loop would be faster then writing down each line?
i also tried to use a loop to assign the targets to zerobut i don't know if a loop would be faster then writing down each line?
Last edited by Nubeat7 on Sun Aug 02, 2015 6:55 am, edited 1 time in total.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
in your module "int 16 byte alignment"
Now the Float is an Integer(float) value
in your ASM code
replace every cvtps2dq with simple movaps xmm0, yourVAR;
- Code: Select all
def event i,v
@in.each_with_index {|x,id|
output id, [x*16].pack('L').unpack('F')[0]
}
end
Now the Float is an Integer(float) value
in your ASM code
replace every cvtps2dq with simple movaps xmm0, yourVAR;
- Code: Select all
...
// connection 0
//cvtps2dq xmm0,idxs0; // ** replaced
movaps xmm0,idxs0; // ** with this line
movd eax,xmm0;
movaps xmm2,s[eax];
...
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: stream routing matrix in dsp code!?
thank youu very much tronic, thats what i was looking for
Last edited by Nubeat7 on Sun Aug 02, 2015 6:56 am, edited 1 time in total.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
Sorry if I am being pedantic, but you could still squeeze out a few cycles by rearranging the initialisation (reusing eax):Nubeat7 wrote:[...]now i think it is optimized to the absolute limit
- Code: Select all
streamin source0; streamin source1;
streamin idxs0; streamin idxs1;
streamin idxt0; streamin idxt1;
streamout target0;streamout target1;
streamout target2;streamout target3;
float t[4];float s[2];float F0=0;
int I0=0; int I1=16; // 16 Bytes alignment already in
int I2=32; int I3=48;
//init source and target arrays
movaps xmm0,F0; mov eax,I0[0]; movaps t[eax],xmm0;
movaps xmm0,source0; movaps s[eax],xmm0;
mov eax,I1[0]; movaps t[eax],xmm0;
movaps xmm1,source1; movaps s[eax],xmm1;
mov eax,I2[0]; movaps t[eax],xmm0;
mov eax,I3[0]; movaps t[eax],xmm0;
// connection 0
mov eax,idxs0[0]; movaps xmm2,s[eax];
mov eax,idxt0[0]; movaps t[eax],xmm2;
// connection 1
mov eax,idxs1[0]; movaps xmm2,s[eax];
mov eax,idxt1[0]; movaps xmm3,t[eax];
addps xmm2,xmm3; movaps t[eax],xmm2;
//assign outputs
mov eax,I0[0]; movaps xmm0,t[eax]; movaps target0,xmm0;
mov eax,I1[0]; movaps xmm1,t[eax]; movaps target1,xmm1;
mov eax,I2[0]; movaps xmm2,t[eax]; movaps target2,xmm2;
mov eax,I3[0]; movaps xmm3,t[eax]; movaps target3,xmm3;
Using a koop wold be slightly worse on CPU because of the index processing overhead. So if you know the loop length, it is faster to unroll the loops.
How are you going to treat unused connections?
One more thought: have you considered index boundery checking the user inputs I0 through I4? Maybe in the Ruby module so it doesn't affect efficiency?
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: stream routing matrix in dsp code!?
martinvicanek wrote:Sorry if I am being pedantic, but you could still squeeze out a few cycles by rearranging the initialisation (reusing eax):
that is is one important charactaristics you need to have when its about optimizing
about the index boundery checking, yes it needs to be done in ruby, when using the cablepatcher you cannot be outside anyway as long you listed all sources, targets and connections and when you have set the arrays to the right size, but sure like it is atm it could be dangerous to use it when you don't know what you are doing..
i will update the cablepatcher with the asm matrix soon, also the cablepatcher needs to be modified a little bit to fit well for the asm matrix
unused connections are set to source0 and target0 which is just a dummy at the target and with zero at the source, you think this is a good solution?
Ps.: thank for the clarification about the loop.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
28 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 24 guests