Embedded coder loop vectorization

2 views (last 30 days)
Jonathan Horne
Jonathan Horne on 6 Mar 2018
Answered: Mark McBroom on 11 Mar 2018
We're using embedded coder to target an ADI SHARC processor and looking to optimize execution speed.
When compiling the generated code with VisualDSP++, the compiler warns:
cc1434: {D} warning: loop would vectorize if alignment were known - consider inserting vector_for pragma if all memory accesses are aligned on even-word boundaries
Where it makes sense, these loops can be vectorized by manually inserting a #pragma vector_for before the associated for().
Is there a way to get embedded coder to automatically insert these types of pragmas into the generated code?
Thanks for any help! Jonathan

Answers (1)

Mark McBroom
Mark McBroom on 11 Mar 2018
I am not aware of a way to insert these pragmas. However, you might want to investigate using the Code Replacement Library feature. With this feature, you can have the code generator replace standard math operations with optimized library functions provided by your vendor. For example, you could instruct the code generator to replace all matrix addition operations with a call to the function matadd() described in the VisualDSP++ Run Time Library .

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!