XUF224 channel comms

Technical questions regarding the XTC tools and programming with XMOS.
cl-b
Active Member
Posts: 44
Joined: Fri Sep 15, 2017 2:58 pm

Post by cl-b »

We really need these information to understand where is the blocking issue and how to re-write the code to hope to get around this problem without adding too much latency.


User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

Hello Mike and Claire,

Does this help : https://www.xmos.com/published/how-use- ... r-channels

Best regards,
John
MyKeys
Active Member
Posts: 33
Joined: Mon Jul 03, 2017 9:41 am

Post by MyKeys »

Hi John & Claire,

I think my explanation previously is fairly comprehensive.
I only posted to help others in the future.

It's too easy to to go from a 2 tile device to a 4 tile device without fully comprehending the implications of the xlink switch fabric and it's bandwidth limitations.

Claire, the rate the buffer "drains" at is the rate at which you receive from the channel and this is limited by the bandwidth of the xlinks and hence can block/stall the sending end of the channel.

Kind regards,
Mike.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

Here's some code that might help understand the latency and throughput questions.
It prints out the start times and the time taken for the transfers, in both the Tx and Rx ends.

Code: Select all

// Tests the latency and throughput of xCONNECT
// xcc chanComms.xc XCORE-200-EXPLORER.xn -o chanComms.xe

#include <platform.h>
#include <stdio.h>
#include <xs1.h>

#define PACKET_SIZE        1024


void foo(streaming chanend c)
{
    unsigned count = 0;
    unsigned rxd = 0;
    timer t;
    int start_time, end_time, overhead_time;

    t :> start_time; t :> end_time; overhead_time = end_time - start_time;


    t :> start_time;
#pragma loop unroll
    for (unsigned i = 0; i < PACKET_SIZE; i++) {
        c <: count;
        count++;
    }
    t :> end_time;
    printf ("foo Tx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);

    t :> start_time;
#pragma loop unroll
    for (unsigned i = 0; i < PACKET_SIZE; i++) {
        c :> rxd;
    }
    t :> end_time;
    printf ("foo Rx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);
}

void bar(streaming chanend c)
{
    unsigned count = 0;
    unsigned rxd = 0;
    timer t;
    int start_time, end_time, overhead_time;

    t :> start_time; t :> end_time; overhead_time = end_time - start_time;


    t :> start_time;
#pragma loop unroll
    for (unsigned i = 0; i < PACKET_SIZE; i++) {
        c :> rxd;
    }
    t :> end_time;
    printf ("bar Rx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);

    t :> start_time;
#pragma loop unroll
    for (unsigned i = 0; i < PACKET_SIZE; i++) {
        c <: count;
        count++;
    }
    t :> end_time;
    printf ("bar Tx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);
}

int main(){
    streaming chan c;
    par{
        on tile[0]:foo(c);
        on tile[1]:bar(c);
//        on tile[0]:bar(c);
    }
    return 0;
}
Post Reply