error: multi-tile main must consist of single non-empty par Topic is solved

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
Post Reply
Endre
Active Member
Posts: 38
Joined: Fri Jan 01, 2016 10:13 am

error: multi-tile main must consist of single non-empty par

Post by Endre »

Hi,

For this code:

Code: Select all

int main() {
    // selfTest();
    configure_clock_rate(pwmPortClk, 100, 2);
    configure_out_port(pwmA, pwmPortClk, 0);
    configure_out_port(pwmB, pwmPortClk, 0);
    configure_out_port(pwmC, pwmPortClk, 0);
    interface PWMFillIf fillPwmIf;
    interface PWMCallBackIf cbIf;
    interface SetPWMFeederIf setPwmFeederIf;
    par {
        on tile[0].core[0]: taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        on tile[0].core[1]: taskPWMFeeder(
            pwmA, pwmB, pwmC, PWM_PERIOD,
            setPwmFeederIf, cbIf, fillPwmIf);
    }
    return 0;
}
I get this error: "error: multi-tile main must consist of single non-empty par"

When I remove the tile-core assignments I get no error:

Code: Select all

par {
        // on tile[0].core[0]:
        taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        // on tile[0].core[1]:
        taskPWMFeeder(
            pwmA, pwmB, pwmC, PWM_PERIOD,
            setPwmFeederIf, cbIf, fillPwmIf);
    }
What is the reason of this error? How can I assign the tasks into specific tiles and cores?


View Solution
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Confused on why the on tile[].core[] does not work but..

Try:

Code: Select all

    par {
        on tile[0]: taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        on tile[0]: taskPWMFeeder(
            pwmA, pwmB, pwmC, PWM_PERIOD,
            setPwmFeederIf, cbIf, fillPwmIf);
    }
Reference:
https://www.xmos.com/published/how-use- ... iple-tiles
The par construct takes a set of statements (usually function calls) and runs them in parallel. By default each task runs on a separate logical core.

The on construct allows you to place tasks on different tiles
Endre
Active Member
Posts: 38
Joined: Fri Jan 01, 2016 10:13 am

Post by Endre »

Thanks for your feedback. Even when I try to assign the tasks to a tile only, I get the same error :-(
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Have you seen this discussion ?

https://www.xcore.com/forum/viewtopic.php?f=8&t=3407

and

http://www.xcore.com/forum/viewtopic.php?f=47&t=4017

so transfer the following code onto the first parallel task:

Code: Select all

    configure_clock_rate(pwmPortClk, 100, 2);
    configure_out_port(pwmA, pwmPortClk, 0);
    configure_out_port(pwmB, pwmPortClk, 0);
    configure_out_port(pwmC, pwmPortClk, 0);
    interface PWMFillIf fillPwmIf;
    interface PWMCallBackIf cbIf;
    interface SetPWMFeederIf setPwmFeederIf;
so you can promote the par construct to the top:

Code: Select all

int main() {
    par {
        on tile[0].core[0]: taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        on tile[0].core[1]: taskPWMFeeder(
            pwmA, pwmB, pwmC, PWM_PERIOD,
            setPwmFeederIf, cbIf, fillPwmIf);
    }
    return 0;
}
It is worth a try.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

so something like this..

Code: Select all

void task1()
{
    // selfTest();
    configure_clock_rate(pwmPortClk, 100, 2);
    configure_out_port(pwmA, pwmPortClk, 0);
    configure_out_port(pwmB, pwmPortClk, 0);
    configure_out_port(pwmC, pwmPortClk, 0);
    interface PWMFillIf fillPwmIf;
    interface PWMCallBackIf cbIf;
    interface SetPWMFeederIf setPwmFeederIf;
    par {
        on tile[0].core[1]: taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        on tile[0].core[2]: taskPWMFeeder(
            pwmA, pwmB, pwmC, PWM_PERIOD,
            setPwmFeederIf, cbIf, fillPwmIf);
    }

}

int main() {
    par {
        on tile[0].core[0]: task1();
    }
    return 0;
}
Endre
Active Member
Posts: 38
Joined: Fri Jan 01, 2016 10:13 am

Post by Endre »

Thanks for the hint!
I have this error: "error: can only specify 'on' in function `main'" when I move the "par" into a task function.
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

Endre wrote:Thanks for the hint!
I have this error: "error: can only specify 'on' in function `main'" when I move the "par" into a task function.
You can't specify the tile on a non-main par statement.
Endre
Active Member
Posts: 38
Joined: Fri Jan 01, 2016 10:13 am

Post by Endre »

Ok now it compiles.

Here is the snippet:

Code: Select all

#define PWM_TILE    tile[0]

on PWM_TILE: out buffered port:1 pwmA = XS1_PORT_1A;
on PWM_TILE: out buffered port:1 pwmB = XS1_PORT_1B;
on PWM_TILE: out buffered port:1 pwmC = XS1_PORT_1C;
on PWM_TILE: clock pwmPortClk = XS1_CLKBLK_1;

void taskPWMFeeder(
    uint period,
    server interface SetPWMFeederIf setPwmFeederIf,
    server interface PWMCallBackIf pwmCbIf,
    client interface PWMFillIf pwmFillIf
) {
    configure_clock_rate(pwmPortClk, 100, 2);
    configure_out_port(pwmA, pwmPortClk, 0);
    configure_out_port(pwmB, pwmPortClk, 0);
    configure_out_port(pwmC, pwmPortClk, 0);
    ....

int main() {
    interface PWMFillIf fillPwmIf;
    interface PWMCallBackIf cbIf;
    interface SetPWMFeederIf setPwmFeederIf;
    par {
        on PWM_TILE: taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        on PWM_TILE: taskPWMFeeder(
            PWM_PERIOD, setPwmFeederIf, cbIf, fillPwmIf);
    }
}

Port configuration is moved into a task. The port declaration is file scoped and tile assigned.
stnschrdr
Member
Posts: 13
Joined: Thu Jan 24, 2019 7:35 pm

Post by stnschrdr »

I'm getting the same 'error: multi-tile main must consist of single non-empty par statements' and the above does not seem to work for me.

I'm try to modify modify the 'app_usb_aud_xk_216_mc' application to first read data from a .txt file into an array that I will use as my FIR filter. I want to do this before I start streaming audio. This application is setup to pass audio from the host to the device over USB. I tried populating the FIR within a DSP task that I inserted in the audio task, but it only works when my FIR filter is less than 50 taps. When I try to read in more taps during the DSP task it can't recognize my USB as an audio streaming device.

I get 'error: multi-tile main must consist of single non-empty par statements' when I try to call the function without 'tile[x]:' in front, outside of main() or inside main() but outside of par{}. But when I do use it and use tile AUDIO_IO_TILE (tile 0) or just tile 1, I get the error: 'on' expression not of type tileref .
moh_algoblan
Member++
Posts: 17
Joined: Tue Jun 18, 2019 11:39 am

Post by moh_algoblan »

Endre wrote: Fri Mar 25, 2016 11:10 am Ok now it compiles.

Here is the snippet:

Code: Select all

#define PWM_TILE    tile[0]

on PWM_TILE: out buffered port:1 pwmA = XS1_PORT_1A;
on PWM_TILE: out buffered port:1 pwmB = XS1_PORT_1B;
on PWM_TILE: out buffered port:1 pwmC = XS1_PORT_1C;
on PWM_TILE: clock pwmPortClk = XS1_CLKBLK_1;

void taskPWMFeeder(
    uint period,
    server interface SetPWMFeederIf setPwmFeederIf,
    server interface PWMCallBackIf pwmCbIf,
    client interface PWMFillIf pwmFillIf
) {
    configure_clock_rate(pwmPortClk, 100, 2);
    configure_out_port(pwmA, pwmPortClk, 0);
    configure_out_port(pwmB, pwmPortClk, 0);
    configure_out_port(pwmC, pwmPortClk, 0);
    ....

int main() {
    interface PWMFillIf fillPwmIf;
    interface PWMCallBackIf cbIf;
    interface SetPWMFeederIf setPwmFeederIf;
    par {
        on PWM_TILE: taskSymPWM(PWM_PERIOD, fillPwmIf, cbIf);
        on PWM_TILE: taskPWMFeeder(
            PWM_PERIOD, setPwmFeederIf, cbIf, fillPwmIf);
    }
}

Port configuration is moved into a task. The port declaration is file scoped and tile assigned.
I have the same problem, this solution unfortunately doesn't work for me.
Post Reply