Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Architecture generation question

Hi,

I have some questions about such an architecture:

https://www.alteraforum.com/forum/attachment.php?attachmentid=9219

As you see, I have two paths in my pipeline, but they are not conditional. Both have to be executed at all times.

If I write each path one after the other, like the following, is the compiler intelligent enough to detect there are no memory dependencies and make the arrangement shown previously?


out = in*2;
out = in+4;

Or does it generate something like the following in my pipeline, where the y axis represents the pipeline stages?

https://www.alteraforum.com/forum/attachment.php?attachmentid=9220

Or... performance wise, do I have to actually care? Here the problem is simple enough, but in my real kernel, each branch is very big, with inner loops and lots of stuff.

Regards,

Smith

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes, the compiler will load, then perform the multiplication and addition in parallel, and because you are storing to sequential locations coalesce that into a single store operation.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Suppose the store location depends on a random number, so that they cannot be coalesced, and that the number of instructions in each branch is different.. Are they still going to be executed in parallel?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    In that case I believe it will look like a combination of the two diagrams where you'll have to store sites but each executing in parallel. If possible you should try to avoid random accesses like that since they are not ideal for SDRAMs.