Page 1 of 1
error: multi-tile main must consist of single non-empty par
Posted: Thu Mar 24, 2016 7:15 pm
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?
Re: error: multi-tile main must consist of single non-empty
Posted: Thu Mar 24, 2016 9:55 pm
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
Re: error: multi-tile main must consist of single non-empty
Posted: Thu Mar 24, 2016 10:33 pm
by Endre
Thanks for your feedback. Even when I try to assign the tasks to a tile only, I get the same error :-(
Re: error: multi-tile main must consist of single non-empty
Posted: Thu Mar 24, 2016 10:50 pm
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.
Re: error: multi-tile main must consist of single non-empty
Posted: Thu Mar 24, 2016 10:59 pm
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;
}
Re: error: multi-tile main must consist of single non-empty
Posted: Fri Mar 25, 2016 10:29 am
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.
Re: error: multi-tile main must consist of single non-empty
Posted: Fri Mar 25, 2016 10:29 am
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.
Re: error: multi-tile main must consist of single non-empty
Posted: Fri Mar 25, 2016 11:10 am
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.
Re: error: multi-tile main must consist of single non-empty par
Posted: Fri Feb 22, 2019 1:35 am
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 .
Re: error: multi-tile main must consist of single non-empty
Posted: Thu Jun 27, 2019 12:09 pm
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.