PROBLEM with constrains check

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
fabriceo
XCore Addict
Posts: 252
Joined: Mon Jan 08, 2018 4:14 pm

PROBLEM with constrains check

Post by fabriceo »

Hi
I m using XTC 14.4.1 and I have a problem with the constrains checker which prevent me to deliver a new version...need help!

considering I have 2 tasks running on tile 0 and launched in main()

task A is using a par statement like this:
taskA() {
if (conditiona)
par { taskA_1(); taskA_2(); }
else
par { taskA_1(); taskA_2(); taskA_3(); }
}
so task A uses either 2 cores or potentially 3 depending on conditiona

task B is using a similar par statement like this:
taskB() {
if (conditionb)
par { taskB_1(); taskB_2(); taskB_3(); taskB_4(); taskB_5(); }
else
par { taskB_1(); taskB_2(); taskB_3(); taskB_4(); taskB_5(); taskB_6();}
}
so task B uses either 5 cores or potentially 6 depending on conditionb

the constrains checker say I m using 9 cores and print FAILED.

I have good reason to declare my tasks and sub tasks in this way, AND I am 100% sure that the combinaison of conditiona and conditions will never bring an overload to 9 cores.

what can I do to fool the constraint checker....?
I ve tried putting a asm volatile(".set taskB.maxcores,5"); somewhere but obviously the linker see an error of duplicate defined label...

need a way to solve this please ! is it possible de de-activate the checker ?
Thanks
User avatar
fabriceo
XCore Addict
Posts: 252
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

okay I found a trick...

declare the symbol taskB.maxcores as weak in the file where it is declared, with this statement:
asm volatile(".set taskB.maxcore");

then in another file, override the value with
asm volatile(".set taskB.maxcores,5");

compiler XC happy, linker happy, constrains now show the max 8 instead of 9