Page 3 of 3

Re: XUF224 channel comms

Posted: Mon Feb 19, 2018 1:48 pm
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.

Re: XUF224 channel comms

Posted: Mon Feb 19, 2018 6:56 pm
by johned
Hello Mike and Claire,

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

Best regards,
John

Re: XUF224 channel comms

Posted: Tue Feb 20, 2018 12:37 pm
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.

Re: XUF224 channel comms

Posted: Wed Feb 21, 2018 12:04 pm
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;
}