Memory limitations for instructions per thread

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

Hi Johned,
Yes I did try it.


NigelPerks
Posts: 4
Joined: Thu Oct 04, 2018 2:09 pm

Post by NigelPerks »

At Johned's suggestion, I separated the different loop limits into different source files. So file mixer1900.xc had a copy of the calculation function, and one function calling it with 1900. And file mixer.xc had an identical copy of the calculation function, and the other functions calling it with 2000.

With -O0, the calculation function was not inlined, and the loop was unrolled.

With -O3, the calculation function was not inlined, but the loop was unrolled.

So using separate source files is a workaround to force unrolling of a loop called with different limits.

We were hoping this would help to avoid error-prone manual unrolling.
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

Thank you Nigel for your help. I didn't get what you mean with :
With -O0, the calculation function was not inlined, and the loop was unrolled.
With -O3, the calculation function was not inlined, but the loop was unrolled.
Maybe it's missing a "not" somewhere.
At last, I extracted the calculation to one other module/project which I builtat -O2 optimization level (with module_build_info file) . My main application calls this module and is built at -O3. It works fine, but it is just a workaround to the compiler error.
Your suggestion to copy the function seems to be similar to mine. However, in case the calculation function is a bit tricky and regularly fine-tuned, to copy-paste it in several files is not a lasting solution I think.
Thank you anyway for your help, I hope the compiler error would be solved and I will try with the workaround solution for a little while.
Best regards,
Marc
NigelPerks
Posts: 4
Joined: Thu Oct 04, 2018 2:09 pm

Post by NigelPerks »

Sorry Marc! You are right, a missing "not":

With -O0, the calculation function was not inlined, and the loop was NOT unrolled.

With -O3, the calculation function was not inlined, but the loop WAS unrolled.

But I don't understand what you mean by the compiler error. Do you mean it should always unroll on a "pragma loop unroll"?
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

Hi Nigel,
Thank you for the clarifications.
But I don't understand what you mean by the compiler error. Do you mean it should always unroll on a "pragma loop unroll"?
Yes that what I hoped from such pragma. Or else that the documentation clarifies this by indicating what is possible and what is not. Unroll pragma and inline expansion are not clearly related and to choose a target for a project, that would be a useful information to know the limitation.
As such it is not exactly a compiler error, rather an hidden limitation .
NigelPerks
Posts: 4
Joined: Thu Oct 04, 2018 2:09 pm

Post by NigelPerks »

Thanks Marc. I've raised an internal bug report to rationalise, or at least document, the behaviour.
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

Thanks Nigel, this will be greatly appreciated.
Post Reply