Topic
  • 6 replies
  • Latest Post - ‏2010-06-03T10:43:41Z by SystemAdmin
SystemAdmin
SystemAdmin
10114 Posts

Pinned topic Signal and Mailbox delay

‏2010-05-25T13:50:51Z |
Hi every body,

I want to use signals or mailbox in communication of SPEs and PPE in a real-time application. In CELL MULTIPROCESSOR COMMUNICATION NETWORK: BUILTFOR SPEED, it is written that:
A typical round-trip communication using mail-boxes between two SPUs takes approximately 300 nanoseconds (ns).

But when I want to use mailbox or signals (for example, in communication of 2 SPEs), it takes so much time near some milliseconds which is very strange. I attached a simple code in which only sending a signal or mailbox takes near 2000 cycle (SPU decremented)!
What is the problem?
I also found that the flag of spe_context_create function may affect this time!

Thanks,
Updated on 2010-06-03T10:43:41Z at 2010-06-03T10:43:41Z by SystemAdmin
  • andhp
    andhp
    48 Posts

    Re: Signal and Mailbox delay

    ‏2010-05-26T09:20:38Z  
    Repeat the round-trip a couple of times and see if you get a different result. I think it is only the first transfer between two SPUs that takes a long time.
  • SystemAdmin
    SystemAdmin
    10114 Posts

    Re: Signal and Mailbox delay

    ‏2010-05-27T12:21:20Z  
    Hi!

    There's a better way by directly accessing an SPE:

    See Chapter "Direct SPE access for applications" of SPE Runtime Management Library
    Version 2.3

    Here's what you have to do:

    1. create your context with the flag SPE_MAP_PS:

    spe_context_ptr_t ctx = spe_context_create(SPE_MAP_PS, NULL)

    2. use the problem state area:

    spe_spu_control_area_t ps = spe_ps_area_get(ctxs, SPE_CONTROL_AREA);

    3. use the cbe_mfc.h library functions:

    for sending:
    _spe_in_mbox_write(ps, msg);

    for receving:
    msg = _spe_out_mbox_read(ps);

    Although the average performance is improved, the worst case still seems to be very bad.

    Hopefully, that helped!
  • SystemAdmin
    SystemAdmin
    10114 Posts

    Re: Signal and Mailbox delay

    ‏2010-05-27T12:30:42Z  
    Hi!

    There's a better way by directly accessing an SPE:

    See Chapter "Direct SPE access for applications" of SPE Runtime Management Library
    Version 2.3

    Here's what you have to do:

    1. create your context with the flag SPE_MAP_PS:

    spe_context_ptr_t ctx = spe_context_create(SPE_MAP_PS, NULL)

    2. use the problem state area:

    spe_spu_control_area_t ps = spe_ps_area_get(ctxs, SPE_CONTROL_AREA);

    3. use the cbe_mfc.h library functions:

    for sending:
    _spe_in_mbox_write(ps, msg);

    for receving:
    msg = _spe_out_mbox_read(ps);

    Although the average performance is improved, the worst case still seems to be very bad.

    Hopefully, that helped!
    Omg, so sorry. Forget my anwser ;)
  • SystemAdmin
    SystemAdmin
    10114 Posts

    Re: Signal and Mailbox delay

    ‏2010-05-27T13:09:19Z  
    Hi,

    As andhp said, there is a little difference between first time and next times communication (I don't know why!). But there is still a huge difference between my timing and the expected timing. I am trying to test all communication approaches. But till now, I was not succeed.

    Is there anybody have a code (a simple or a complete benchmark) that measure the round trip communication between processing elements? Between PPE and SPEs / between SPEs, using signals, mailbox or direct LS communication.
  • andhp
    andhp
    48 Posts

    Re: Signal and Mailbox delay

    ‏2010-05-28T09:48:18Z  
    Hi,

    As andhp said, there is a little difference between first time and next times communication (I don't know why!). But there is still a huge difference between my timing and the expected timing. I am trying to test all communication approaches. But till now, I was not succeed.

    Is there anybody have a code (a simple or a complete benchmark) that measure the round trip communication between processing elements? Between PPE and SPEs / between SPEs, using signals, mailbox or direct LS communication.
    I took your code and measured the time for SPE <-> SPE mailbox communication.

    My results on a PS3 look like this:

    Time = 42735
    Time = 3129
    Time = 26
    Time = 27
    Time = 26
    Time = 26
    Time = 26
    Time = 26
    Time = 26
    Time = 27

    If you leave out the first two transfers (TLB and/or page misses?), the average time in clock cycles is approximately 26 * 40 = 1040.
    This is actually very close to the 300ns mentioned in the paper.
  • SystemAdmin
    SystemAdmin
    10114 Posts

    Re: Signal and Mailbox delay

    ‏2010-06-03T10:43:41Z  
    Thank guys for your help.

    The problem was: in the first time, the communication delay was more than usual.
    Now, I am using the PPE-SPE communication which seems to have the minimum communication delay (PPU directly writes on a variable in SPEs local states using memcpy instruction).