SSE/MMX

Windows specific forum
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

SSE/MMX

Post by eriansa »

This code uses SSE/MMX.
(add 2 buffers of floating points, multiply them by v_gain, and move the result into a third buffer of 16bit integers)

It works all the time in a process with 1 thread.
In a multithreaded process however, It works sometimes and sometimes not.
(when this code is called from an Asio_CallBack)

Sometimes, just by minimizing the main application window and restoring it, the code works again. (no I am not drunk! this is really happening, i can reproduce it many times....)

It is difficult to figure out what exactly goes wrong, since it's impossible to debug the real time thread without a crash.

Should I do something extra?

Code: Select all

  !movss xmm2,[v_Gain]
  !unpcklps xmm2,xmm2
  !movlhps xmm2,xmm2
  
  !MOV edi, [v_L0]
  !MOV esi, [v_L1]
  !MOV ebp, [v_LD]
  !MOV ecx, 256
  !.While1:
    !movups xmm0,[edi]
    !movups xmm1,[esi]
    !addps xmm0,xmm1
    !mulps xmm0, xmm2
    !cvtps2pi mm0,xmm0
    !movhlps xmm0,xmm0
    !cvtps2pi mm1,xmm0  
    !packssdw mm0,mm1
    !movq [ebp],mm0
    !ADD esi,16
    !ADD edi,16
    !ADD ebp,8
  !LOOP .While1
  !EMMS
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Re: SSE/MMX

Post by va!n »

do you have an intel with hyperthreading activated? as far as i know (i have read about something like this on a magazine or www some time ago!?) if you using hyperthreading you can run more threads at once time and here the coder has to know/check some things... but i cant really help you, sorry!


Edit:
Maybe this may help you...!?
http://lists.debian.org/debian-glibc/20 ... 00062.html
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Post Reply