Creating Concurrent Threads

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Creating Concurrent Threads

Post by lilltroll »

Can some threads have fewer timeslots than other when using more than 4 treads per core ?

Like

Code: Select all

par{
 par{
  Thread(E); 
  Thread(F);
  Thread(G);
  Thread(H);
   }
 Thread(A); 
 Thread(B);
 Thread(C);

}
Resulting in that Thread A-C runs at 100% speed and thread E-H runs at 25% speed in average.


Probably not the most confused programmer anymore on the XCORE forum.
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am
Contact:

Post by trousers »

No, in short.

That code will get you 7 threads all with equal priority (because all threads on the xcore have equal priority). If you want a thread to consume fewer cycles you must make it block on something - a timer, maybe.
Best friends with the code fairy.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Blocking - intresting.

A thread can pause when it is waiting for an event - you mean that with an timer I could make 3 threads to pause ??
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

lilltroll wrote:Blocking - intresting.

A thread can pause when it is waiting for an event - you mean that with an timer I could make 3 threads to pause ??
You can't use a single timer in XC used by three threads.
You can use a timer in each thread to wait (block) for a timer value.
If you want to synchronise them you might want to consider using a master thread and three slave threads.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Ahaa, then I think I will go for the master thread solution. It's because I would like to use all registers for maximum speed, and that all timing issues gets so simple with channels.
It's the 2+2 channel I2S function that needs to communicate with 2 decimating and 2 interpolating functions. But that sould be easy if I'm not running out of channels.

I think someone showed on the XLINKERS that you can do a 6:th order IIR filter without the need of memorycopies beween registers and RAM with the 12 XMOS registers.
(You have to load one filtercoef from the constant pool before each MAC but that is not devistating at all).

What about the amount of available streaming chan /core, and what about the difference in overhead in the communication between channel and streaming channel ?
Probably not the most confused programmer anymore on the XCORE forum.
Post Reply