microarchitectures: add optimization flags for Intel compilers (#13345)
* Added optimization flags for Intel compilers with Intel CPUs * Added optimization flags for Intel compilers with AMD CPUs
This commit is contained in:
		
				
					committed by
					
						
						Todd Gamblin
					
				
			
			
				
	
			
			
			
						parent
						
							fd58c98b0e
						
					
				
				
					commit
					cfbdd2179e
				
			@@ -65,6 +65,11 @@
 | 
			
		||||
          "versions": ":",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu=generic"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": ":",
 | 
			
		||||
          "name": "pentium4",
 | 
			
		||||
          "flags": "-march={name} -mtune=generic"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -86,6 +91,11 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "name": "pentium4",
 | 
			
		||||
          "flags": "-march={name} -mtune=generic"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -107,6 +117,10 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -138,6 +152,11 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "name": "corei7",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -164,6 +183,11 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "name": "corei7",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -198,7 +222,18 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        "intel": [
 | 
			
		||||
          {
 | 
			
		||||
            "versions": "16.0:17.9.0",
 | 
			
		||||
            "name": "corei7-avx",
 | 
			
		||||
            "flags": "-march={name} -mtune={name}"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "versions": "18.0:",
 | 
			
		||||
            "flags": "-march={name} -mtune={name}"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "ivybridge": {
 | 
			
		||||
@@ -234,7 +269,18 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        "intel": [
 | 
			
		||||
          {
 | 
			
		||||
            "versions": "16.0:17.9.0",
 | 
			
		||||
            "name": "core-avx-i",
 | 
			
		||||
            "flags": "-march={name} -mtune={name}"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "versions": "18.0:",
 | 
			
		||||
            "flags": "-march={name} -mtune={name}"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "haswell": {
 | 
			
		||||
@@ -275,7 +321,18 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
        "intel": [
 | 
			
		||||
          {
 | 
			
		||||
            "versions": "16.0:17.9.0",
 | 
			
		||||
            "name": "core-avx2",
 | 
			
		||||
            "flags": "-march={name} -mtune={name}"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "versions": "18.0:",
 | 
			
		||||
            "flags": "-march={name} -mtune={name}"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "broadwell": {
 | 
			
		||||
@@ -311,6 +368,10 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "18.0:",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -350,6 +411,10 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "18.0:",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -393,6 +458,11 @@
 | 
			
		||||
          "name": "knl",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "18.0:",
 | 
			
		||||
          "name": "knl",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -440,6 +510,11 @@
 | 
			
		||||
          "name": "skylake-avx512",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "18.0:",
 | 
			
		||||
          "name": "skylake-avx512",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -488,6 +563,10 @@
 | 
			
		||||
          "versions": "3.9:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "18.0:",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -534,6 +613,10 @@
 | 
			
		||||
          "versions": "8.0:",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "19.0:",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -603,7 +686,12 @@
 | 
			
		||||
            "family": "x86-64",
 | 
			
		||||
            "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
        ],
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "18.0:",
 | 
			
		||||
          "name": "icelake-client",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "bulldozer": {
 | 
			
		||||
@@ -636,6 +724,11 @@
 | 
			
		||||
          "name": "bdver1",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors",
 | 
			
		||||
          "flags": "-msse3"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -673,6 +766,11 @@
 | 
			
		||||
          "name": "bdver2",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors",
 | 
			
		||||
          "flags": "-msse3"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -711,6 +809,11 @@
 | 
			
		||||
          "name": "bdver3",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors",
 | 
			
		||||
          "flags": "-msse4.2"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -752,6 +855,12 @@
 | 
			
		||||
          "name": "bdver4",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors",
 | 
			
		||||
          "name": "core-avx2",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -796,6 +905,12 @@
 | 
			
		||||
          "name": "znver1",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors",
 | 
			
		||||
          "name": "core-avx2",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -841,6 +956,12 @@
 | 
			
		||||
          "name": "znver2",
 | 
			
		||||
          "family": "x86-64",
 | 
			
		||||
          "flags": "-march={family} -mcpu={name}"
 | 
			
		||||
        },
 | 
			
		||||
        "intel": {
 | 
			
		||||
          "versions": "16.0:",
 | 
			
		||||
          "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors",
 | 
			
		||||
          "name": "core-avx2",
 | 
			
		||||
          "flags": "-march={name} -mtune={name}"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -205,6 +205,15 @@ def test_target_json_schema():
 | 
			
		||||
    ('icelake', 'clang', '8.0.0', '-march=x86-64 -mcpu=icelake-client'),
 | 
			
		||||
    ('zen2', 'clang', '9.0.0', '-march=x86-64 -mcpu=znver2'),
 | 
			
		||||
    ('power9le', 'clang', '8.0.0', '-march=ppc64le -mcpu=pwr9'),
 | 
			
		||||
    # Test Intel on Intel CPUs
 | 
			
		||||
    ('sandybridge', 'intel', '17.0.2', '-march=corei7-avx -mtune=corei7-avx'),
 | 
			
		||||
    ('sandybridge', 'intel', '18.0.5',
 | 
			
		||||
     '-march=sandybridge -mtune=sandybridge'),
 | 
			
		||||
    # Test Intel on AMD CPUs
 | 
			
		||||
    pytest.param('steamroller', 'intel', '17.0.2', '-msse4.2',
 | 
			
		||||
                 marks=pytest.mark.filterwarnings('ignore::UserWarning')),
 | 
			
		||||
    pytest.param('zen', 'intel', '17.0.2', '-march=core-avx2 -mtune=core-avx2',
 | 
			
		||||
                 marks=pytest.mark.filterwarnings('ignore::UserWarning')),
 | 
			
		||||
    # Test that an unknown compiler returns an empty string
 | 
			
		||||
    ('sandybridge', 'unknown', '4.8.5', ''),
 | 
			
		||||
])
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user