-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Apply cpu-optimisation to Rust projects #15544
Changes from 7 commits
c344a3f
a072508
066a888
b4dd639
d4bfbb1
2bd20ea
c698174
cccad3e
261f55a
2133da8
9a99b93
9a19f5b
73c339d
40aa419
87158ac
55bdbab
521fdcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,4 +24,20 @@ def self.oldest_cpu(version = nil) | |||||
generic_oldest_cpu | ||||||
end | ||||||
end | ||||||
|
||||||
# Override | ||||||
# Mirrors version-dependent logic of oldest_cpu | ||||||
sig { params(version: T.nilable(Version)).returns(String) } | ||||||
def self.rustflags_target_cpu(version = nil) | ||||||
version = if version | ||||||
MacOSVersion.new(version.to_s) | ||||||
else | ||||||
MacOS.version | ||||||
end | ||||||
if Hardware::CPU.intel? && version >= :mojave | ||||||
Tokarak marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
"'-Ctarget-cpu=nehalem'" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
else | ||||||
generic_rustflags_target_cpu | ||||||
end | ||||||
end | ||||||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1543,7 +1543,8 @@ def std_configure_args | |
# Standard parameters for cargo builds. | ||
sig { params(root: T.any(String, Pathname), path: String).returns(T::Array[T.any(String, Pathname)]) } | ||
def std_cargo_args(root: prefix, path: ".") | ||
["--locked", "--root", root, "--path", path] | ||
["--locked", "--root", root, "--path", path, "--config", | ||
"build.rustflags=[#{Hardware.rustflags_target_cpu}]"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this interact with I think we may prefer to set |
||
end | ||
|
||
# Standard parameters for CMake builds. | ||
|
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.
When would
version
be passed through here rather than just use the currentMacOS.version
?