-
Notifications
You must be signed in to change notification settings - Fork 219
include -ftree-vectorize and -fno-math-errno in default compiler optimisation flags for GCC #2388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
boegel
merged 13 commits into
easybuilders:develop
from
ComputeCanada:gcc_tree_vectorize
Mar 31, 2018
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
18d73dc
Add -ftree-vectorize to defaultopt='-O2' for GCC.
bartoldeman 1c8842b
test_misc_flags_shared: split flags.
bartoldeman 2d44ee4
Use march=nocona instead of -ftree-vectorize in optarch test.
bartoldeman 033cf94
Add -fno-math-errno to defaultprec/loose/veryloose GCC toolchainopts
bartoldeman 04a0663
Adjust test cases to deal with -fno-math-errno.
bartoldeman c721650
Fix one last precision testcase for ieee.
bartoldeman 6b32291
use DEFAULT_OPT_LEVEL constant + fix minor style issues
boegel 4b9176e
Merge pull request #4 from boegel/gcc_tree_vectorize
bartoldeman 0963663
Introduce 'vectorize' toolchainopt.
bartoldeman 71dbf6d
We need a copy of optflags[0] instead of modifying in place.
bartoldeman 6a962a2
Use dictionary with boolean keys for 'vectorize' toolchainopt.
bartoldeman 45f550a
Test both 'vectorize': True and 'vectorize': False toolchainopts.
bartoldeman ed7494d
vectorize: fix [:1] syntax and clarify avoiding double flags.
bartoldeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,8 @@ class Compiler(Toolchain): | |
| 'static': (False, "Build static library"), | ||
| '32bit': (False, "Compile 32bit target"), # LA, FFTW | ||
| 'openmp': (False, "Enable OpenMP"), | ||
| 'vectorize': (None, "Enable compiler auto-vectorization, default except for noopt and lowopt"), | ||
| 'novectorize': (None, "Disable compiler auto-vectorization, default for noopt and lowopt"), # not set, only used to map | ||
| 'packed-linker-options': (False, "Pack the linker options as comma separated list"), # ScaLAPACK mainly | ||
| 'rpath': (True, "Use RPATH wrappers when --rpath is enabled in EasyBuild configuration"), | ||
| } | ||
|
|
@@ -246,7 +248,23 @@ def _set_compiler_flags(self): | |
|
|
||
| # 1st one is the one to use. add default at the end so len is at least 1 | ||
| optflags = [self.options.option(x) for x in self.COMPILER_OPT_FLAGS if self.options.get(x, False)] + \ | ||
| [self.options.option(default_opt_level)] | ||
| [self.options.option(default_opt_level)][:1] | ||
|
||
|
|
||
| # only apply if the vectorize toolchainopt is explicitly set | ||
| # otherwise the individual compiler toolchain file should make sure that | ||
| # vectorization is disabled for noopt and lowopt, and enabled otherwise. | ||
| if self.options.get('vectorize') is not None: | ||
| novectorize = self.options.option('novectorize') | ||
| vectorize = self.options.option('vectorize') | ||
| if self.options['vectorize']: | ||
| vectflags = vectorize | ||
| else: | ||
| vectflags = novectorize | ||
| # avoid double use of such flags | ||
| if isinstance(optflags[0], list): | ||
| optflags[0] = [setting for setting in optflags[0] | ||
| if setting not in (novectorize, vectorize)] | ||
| optflags.append(vectflags) | ||
|
|
||
| optarchflags = [] | ||
| if build_option('optarch') == OPTARCH_GENERIC: | ||
|
|
@@ -259,7 +277,7 @@ def _set_compiler_flags(self): | |
| precflags = [self.options.option(x) for x in self.COMPILER_PREC_FLAGS if self.options.get(x, False)] + \ | ||
| [self.options.option('defaultprec')] | ||
|
|
||
| self.variables.nextend('OPTFLAGS', optflags[:1] + optarchflags) | ||
| self.variables.nextend('OPTFLAGS', optflags + optarchflags) | ||
| self.variables.nextend('PRECFLAGS', precflags[:1]) | ||
|
|
||
| # precflags last | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bartoldeman Why do we need both? Can't we detect
TrueorFalse(vsNone) forvectorizeinstead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is in the mappings in gcc.py etc. I cannot map 'vectorize' to '-ftree-vectorize' for True and to '-fno-tree-vectorize' for False, unless those mappings get redesigned of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I could use
['fno-tree-vectorize','ftree-vectorize']with a bit of code to select first or second. It's just inconsistent with the current use. Maybe use a dict to distinguish:{False: 'fno-tree-vectorize', True: 'ftree-vectorize'}