- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Which switch should allow the most optimizations? /qansi-alias or /oa?
Thank you.
Which switch should allow the most optimizations? /qansi-alias or /oa?
Thank you.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
/Qansi-alias asserts that your program conforms with standard (does not alias between incompatible data types). It's equivalent to default options of most compilers, such as gcc -fstrict-aliasing. /Oa effectively asserts a restrict qualifier on all arguments, so would enable more optimization (like Fortran) in the case where you have multiple parameter pointers to compatible type, and didn't set restrict qualifiers. /Oa could break programs which conform with C standard, but should be OK for C functions called by Fortran standard conforming programs. A possible alternative which operates at loop level is #pragma ivdep
Then, shouldn't /Oa allow more optimizations than /Qansi-alias? I compiled some C and C++ programs, and they are faster with /Qansi-alias.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - BSK
Thank you tim18, it's more or less what I thought. If I understand correclty /Qansi-alias asserts my program may have aliasings (allowed by the standard), while /Oa asserts my program does not have aliasing at all.
Then, shouldn't /Oa allow more optimizations than /Qansi-alias? I compiled some C and C++ programs, and they are faster with /Qansi-alias.
Then, shouldn't /Oa allow more optimizations than /Qansi-alias? I compiled some C and C++ programs, and they are faster with /Qansi-alias.
Perhaps I should have been more explicit; it may be preferable to write restrict qualifiers into your source code rather than try to compensate for their absence by using /Oa. That's somewhat of a dilemma too, as MSVC doesn't appear to implement their documented version of restrict, and Intel compilers may implement the Microsoft spelling of it only for linux (!?). Anyway, it's preferable to be specific about the optimizations you are looking for, rather than attempt them with an option like /Oa which explicitly conflicts with standards. No doubt I'm getting too opinionated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
It's good to hear that /Qansi-alias is effective for your application. /Oa is somewhat of a dilemma, as it's there to support optimizations which are possible with Microsoft compilers (or at least to accept the command line), but it may have to be cautious about the extent to which it goes beyond MSVC, or is combined with optimizations which MSVC doesn't perform, risky or not.
Perhaps I should have been more explicit; it may be preferable to write restrict qualifiers into your source code rather than try to compensate for their absence by using /Oa. That's somewhat of a dilemma too, as MSVC doesn't appear to implement their documented version of restrict, and Intel compilers may implement the Microsoft spelling of it only for linux (!?). Anyway, it's preferable to be specific about the optimizations you are looking for, rather than attempt them with an option like /Oa which explicitly conflicts with standards. No doubt I'm getting too opinionated.
Perhaps I should have been more explicit; it may be preferable to write restrict qualifiers into your source code rather than try to compensate for their absence by using /Oa. That's somewhat of a dilemma too, as MSVC doesn't appear to implement their documented version of restrict, and Intel compilers may implement the Microsoft spelling of it only for linux (!?). Anyway, it's preferable to be specific about the optimizations you are looking for, rather than attempt them with an option like /Oa which explicitly conflicts with standards. No doubt I'm getting too opinionated.
I'm satisfied by the performance of my build, it's just I was a confused about /Oa and /Qansi-alias because the descriptions were a bit unclear for me.
Thanks again tim18.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page