Merge pull request #5012 from sjackman/skylake

-march=native is default. Hardware::CPU: Add Skylake [Linux]
This commit is contained in:
Shaun Jackman 2018-10-03 13:47:59 -07:00 committed by GitHub
commit b65e68ce90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 15 deletions

View File

@ -1,7 +1,7 @@
# @private # @private
module CompilerConstants module CompilerConstants
GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze GNU_GCC_VERSIONS = %w[4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze
GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|[5-8])$/ GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/
COMPILER_SYMBOL_MAP = { COMPILER_SYMBOL_MAP = {
"gcc" => :gcc, "gcc" => :gcc,
"gcc-4.0" => :gcc_4_0, "gcc-4.0" => :gcc_4_0,
@ -71,7 +71,6 @@ class CompilerFailure
create(:gcc_4_0), create(:gcc_4_0),
create(:gcc_4_2), create(:gcc_4_2),
create(:clang) { build 425 }, create(:clang) { build 425 },
create(gcc: "4.3"),
create(gcc: "4.4"), create(gcc: "4.4"),
create(gcc: "4.5"), create(gcc: "4.5"),
create(gcc: "4.6"), create(gcc: "4.6"),
@ -80,7 +79,6 @@ class CompilerFailure
create(:clang) { build 600 }, create(:clang) { build 600 },
create(:gcc_4_0), create(:gcc_4_0),
create(:gcc_4_2), create(:gcc_4_2),
create(gcc: "4.3"),
create(gcc: "4.4"), create(gcc: "4.4"),
create(gcc: "4.5"), create(gcc: "4.5"),
create(gcc: "4.6"), create(gcc: "4.6"),

View File

@ -7,7 +7,7 @@ module Stdenv
# @private # @private
SAFE_CFLAGS_FLAGS = "-w -pipe".freeze SAFE_CFLAGS_FLAGS = "-w -pipe".freeze
DEFAULT_FLAGS = "-march=core2 -msse4".freeze DEFAULT_FLAGS = "-march=native".freeze
# @private # @private
def setup_build_environment(formula = nil) def setup_build_environment(formula = nil)
@ -108,7 +108,7 @@ module Stdenv
def gcc_4_2 def gcc_4_2
super super
set_cpu_cflags set_cpu_cflags "-march=core2 -msse4"
end end
GNU_GCC_VERSIONS.each do |n| GNU_GCC_VERSIONS.each do |n|
@ -124,7 +124,7 @@ module Stdenv
# Clang mistakenly enables AES-NI on plain Nehalem # Clang mistakenly enables AES-NI on plain Nehalem
map = Hardware::CPU.optimization_flags map = Hardware::CPU.optimization_flags
map = map.merge(nehalem: "-march=native -Xclang -target-feature -Xclang -aes") map = map.merge(nehalem: "-march=native -Xclang -target-feature -Xclang -aes")
set_cpu_cflags "-march=native", map set_cpu_cflags DEFAULT_FLAGS, map
end end
def minimal_optimization def minimal_optimization

View File

@ -235,7 +235,7 @@ module Superenv
Hardware::CPU.optimization_flags.fetch(arch) Hardware::CPU.optimization_flags.fetch(arch)
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4? elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu) Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
elsif compiler == :clang elsif ![:gcc_4_0, :gcc_4_2].include?(compiler)
"-march=native" "-march=native"
# This is mutated elsewhere, so return an empty string in this case # This is mutated elsewhere, so return an empty string in this case
else else

View File

@ -11,8 +11,11 @@ module Hardware
return :dunno unless intel? return :dunno unless intel?
# See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers # See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
# and https://github.com/llvm-mirror/llvm/blob/master/lib/Support/Host.cpp
# and https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures#Roadmap
cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
unknown = :"unknown_0x#{cpu_family.to_s(16)}_0x#{cpu_model.to_s(16)}"
case cpu_family case cpu_family
when 0x06 when 0x06
case cpu_model case cpu_model
@ -36,12 +39,10 @@ module Hardware
:haswell :haswell
when 0x3d, 0x47, 0x4f, 0x56 when 0x3d, 0x47, 0x4f, 0x56
:broadwell :broadwell
when 0x5e when 0x4e, 0x55, 0x5e, 0x8e, 0x9e
:skylake :skylake
when 0x8e
:kabylake
else else
:dunno unknown
end end
when 0x0f when 0x0f
case cpu_model case cpu_model
@ -50,10 +51,10 @@ module Hardware
when 0x03, 0x04 when 0x03, 0x04
:prescott :prescott
else else
:dunno unknown
end end
else else
:dunno unknown
end end
end end

View File

@ -11,7 +11,6 @@ module Hardware
core: "-march=prescott", core: "-march=prescott",
armv6: "-march=armv6", armv6: "-march=armv6",
armv8: "-march=armv8-a", armv8: "-march=armv8-a",
dunno: "-march=native",
}.freeze }.freeze
def optimization_flags def optimization_flags