Memory limitations for instructions per thread

Technical discussions around xCORE processors (e.g. General Purpose (L/G), xCORE-USB, xCORE-Analog, xCORE-XA).
MarcAntigny
Active Member
Posts: 46
Joined: Tue Feb 13, 2018 2:50 pm

Re: Memory limitations for instructions per thread

Postby MarcAntigny » Fri Oct 05, 2018 8:18 am

Hi Johned,
Yes I did try it.
NigelPerks
Posts: 4
Joined: Thu Oct 04, 2018 2:09 pm

Postby NigelPerks » Fri Oct 05, 2018 3:51 pm

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: 46
Joined: Tue Feb 13, 2018 2:50 pm

Postby MarcAntigny » Fri Oct 05, 2018 4:35 pm

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

Postby NigelPerks » Fri Oct 05, 2018 4:46 pm

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: 46
Joined: Tue Feb 13, 2018 2:50 pm

Postby MarcAntigny » Mon Oct 08, 2018 8:22 am

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

Postby NigelPerks » Mon Oct 08, 2018 2:55 pm

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

Postby MarcAntigny » Mon Oct 08, 2018 3:47 pm

Thanks Nigel, this will be greatly appreciated.

Who is online

Users browsing this forum: No registered users and 21 guests