Skip to content
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

Use NEON build flag on ARM and AArch64 #10916

Merged
merged 2 commits into from May 6, 2016
Merged

Use NEON build flag on ARM and AArch64 #10916

merged 2 commits into from May 6, 2016

Conversation

@mmatyas
Copy link
Contributor

mmatyas commented Apr 29, 2016

The NEON flag is already used when building for Android, this patch enables it on other ARM devices too.

Note that this patch just adds the build flag to the compilation, for actually enabling the SIMD code in Servo, we'll also need #10900 (but it's not a dependency).


This change is Reviewable

@highfive
Copy link

highfive commented Apr 29, 2016

Heads up! This PR modifies the following files:

@@ -202,9 +202,13 @@ def build(self, target=None, release=False, dev=False, jobs=None,

build_start = time()
env = self.build_env()

# Ensure Rust uses hard floats and SIMD on ARM devices
if len(targets):

This comment has been minimized.

@wafflespeanut

wafflespeanut Apr 29, 2016

Member

This could just be targets :)

@@ -202,9 +202,13 @@ def build(self, target=None, release=False, dev=False, jobs=None,

build_start = time()
env = self.build_env()

# Ensure Rust uses hard floats and SIMD on ARM devices
if targets:

This comment has been minimized.

@aneeshusa

aneeshusa Apr 29, 2016

Member

Personally, I prefer the more explicit check of if len(targets) > 0 here.

@mmatyas
Copy link
Contributor Author

mmatyas commented Apr 29, 2016

Ah, right, thanks :)

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

Only looking at targets[0] seems strange to me. Do we only support one target at a time? If so, why is targets a list? If not, I would think (from a very cursory glance) that we'd need to examine the other targets as well.

@mmatyas
Copy link
Contributor Author

mmatyas commented Apr 29, 2016

targets being a list is a good catch, it doesn't look like we add more than one element to it. I think technically it would be possible to build multiple targets, but right now only one is expected or Android.

About the if, would you prefer len(targets) > 0 then?

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

It seems the underlying cargo build command here does not accept multiple --target specifications, so targets should not be a list here. (We should also update ensure_bootstrapped to take a single target instead of a list.)

@larsbergstrom
Copy link
Contributor

larsbergstrom commented Apr 29, 2016

Hrm, I thought that targets was a list because you always need the host bits (because of compiling compiler plugins, which run on the host) plus you will need a second one if you have a cross-compile.

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

I don't see any places where the host target is added to the targets list; it's just the one cross-compile target (e.g. ["arm-linux-androideabi"] or an explicit target). It would make sense that you need the host target to actually compile, but I don't see it being used in the targets variable.

@larsbergstrom
Copy link
Contributor

larsbergstrom commented Apr 29, 2016

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

Convo on IRC: http://logs.glob.uno/?c=mozilla%23servo#c418555

Let's make the targets variables in build_commands.py not lists, and do the same for the targets argument to ensure_bootstrapped in command_base.py since it's only called with that argument from build_commands.py. (The bootstrap_rustc function in bootstrap_commands.py handles inclusion of the host triple.)

@mmatyas
Copy link
Contributor Author

mmatyas commented Apr 29, 2016

Ok! And what should happen if both a target and --android is defined? Should --android override --target?

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

@mmatyas Let's make them mutually exclusive, like --release and --dev are. We can only build for one target at a time.

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

Also, bonus points if you make a separate commit for making targets non-lists first, and then a separate commit after that for the NEON build flag change.

@mmatyas
Copy link
Contributor Author

mmatyas commented Apr 29, 2016

Ok, here's an update. My Python might be a little rusty, so feel free to point on any mistakes.

Just two things you might notice:
I've also changed the if android branch; now it sets the target value from self.config["android"]["target"]], (which is by default arm-linux-androideabi) instead of hardcoding. If, for some reason you use a different Android target, you'd probably need the matching stdlibs, so hardcoding to arm-linux-androideabi and bootstrapping that might be useless.
And, Registrar.dispatch("bootstrap-rust", context=self.context, target=[target]) gets the target as [target], to match the expected argument format.

It you think this looks good, I'll make the separate commits ( ❤️ challenges).

@nox nox assigned aneeshusa and unassigned nox Apr 29, 2016
@@ -411,7 +411,7 @@ def android_support_dir(self):
def android_build_dir(self, dev):
return path.join(self.get_target_dir(), "arm-linux-androideabi", "debug" if dev else "release")

def ensure_bootstrapped(self, targets=[]):
def ensure_bootstrapped(self, target=""):

This comment has been minimized.

@aneeshusa

aneeshusa Apr 29, 2016

Member

The default here should be target=None, not target="". We only need to do the target-related things if we are passed a target explicitly.

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

These changes look good aside from the default argument there. I didn't realize you could fixup fixup commits - I'm surprised the last one isn't fixup! fixup! fixup! fixup! 😛 Feel free to go ahead and reorder these commits.

@wafflespeanut
Copy link
Member

wafflespeanut commented Apr 29, 2016

This should actually be squashed...

@mmatyas mmatyas force-pushed the mmatyas:useneon branch from adec454 to 07a23a0 Apr 29, 2016
@mmatyas
Copy link
Contributor Author

mmatyas commented Apr 29, 2016

Rebased and grouped to two commits.

(PS. Sorry for the late replies)

@mmatyas
Copy link
Contributor Author

mmatyas commented Apr 29, 2016

Is there a clean, Pythonic way to remove None from a list before passing as a function argument?

@wafflespeanut
Copy link
Member

wafflespeanut commented Apr 29, 2016

filter probably?

filter(lambda i: i, [True, None, 'foo'])
@wafflespeanut
Copy link
Member

wafflespeanut commented Apr 29, 2016

btw, it would be nice if we don't have "fixup!" in a commit message :)

@aneeshusa
Copy link
Member

aneeshusa commented Apr 29, 2016

Even better, we can do filter(None, some_list). See https://docs.python.org/2/library/functions.html#filter - passing None is special cased to the identity function.

@wafflespeanut git can automatically combine fixup! commits with rebase --autosquash: https://git-scm.com/docs/git-rebase, so this makes reviewing easier.

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

Testing commit 0bcf35c with merge f3faf08...

bors-servo added a commit that referenced this pull request May 5, 2016
Use NEON build flag on ARM and AArch64

The NEON flag is already used when building for Android, this patch enables it on other ARM devices too.

Note that this patch just adds the build flag to the compilation, for actually enabling the SIMD code in Servo, we'll also need #10900 (but it's not a dependency).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10916)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

💔 Test failed - windows

@mmatyas
Copy link
Contributor Author

mmatyas commented May 5, 2016

[2/-1] Failed to receive response: The server returned an invalid or unrecognized response

Looks like another network issue.

@larsbergstrom
Copy link
Contributor

larsbergstrom commented May 5, 2016

@bors-servo retry

  • infra
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

Testing commit 0bcf35c with merge 9c9c6ea...

bors-servo added a commit that referenced this pull request May 5, 2016
Use NEON build flag on ARM and AArch64

The NEON flag is already used when building for Android, this patch enables it on other ARM devices too.

Note that this patch just adds the build flag to the compilation, for actually enabling the SIMD code in Servo, we'll also need #10900 (but it's not a dependency).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10916)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

💔 Test failed - windows

@jdm
Copy link
Member

jdm commented May 5, 2016

@bors-servo: retry

  • infra
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

Testing commit 0bcf35c with merge a233d1e...

bors-servo added a commit that referenced this pull request May 5, 2016
Use NEON build flag on ARM and AArch64

The NEON flag is already used when building for Android, this patch enables it on other ARM devices too.

Note that this patch just adds the build flag to the compilation, for actually enabling the SIMD code in Servo, we'll also need #10900 (but it's not a dependency).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10916)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

💔 Test failed - linux-rel

@highfive
Copy link

highfive commented May 5, 2016

  ▶ TIMEOUT [expected OK] /html/rendering/replaced-elements/svg-embedded-sizing/svg-in-iframe-percentage.html
  │ 
  └ Xlib:  extension &#34;XFree86-VidModeExtension&#34; missing on display &#34;:0&#34;.

  ▶ Unexpected subtest result in /html/rendering/replaced-elements/svg-embedded-sizing/svg-in-iframe-percentage.html:
  │ TIMEOUT [expected PASS] placeholder: &#39;iframe&#39;, placeholderWidthAttr: &#39;100&#39;, placeholderHeightAttr: &#39;100%&#39;, svgViewBoxAttr: &#39;0 0 100 200&#39;, svgWidthAttr: &#39;25%&#39;, svgHeightAttr: &#39;25%&#39;, 
  └   → Test timed out

  ▶ TIMEOUT [expected OK] /html/rendering/replaced-elements/svg-embedded-sizing/svg-in-iframe-auto.html
  │ 
  └ Xlib:  extension &#34;XFree86-VidModeExtension&#34; missing on display &#34;:0&#34;.

  ▶ Unexpected subtest result in /html/rendering/replaced-elements/svg-embedded-sizing/svg-in-iframe-auto.html:
  │ TIMEOUT [expected PASS] placeholder: &#39;iframe&#39;, containerHeightStyle: &#39;400px&#39;, placeholderWidthAttr: &#39;50%&#39;, svgViewBoxAttr: &#39;0 0 100 200&#39;, svgWidthAttr: &#39;25%&#39;, svgHeightAttr: &#39;25%&#39;, 
  └   → Test timed out
@jdm
Copy link
Member

jdm commented May 5, 2016

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2016

Previous build results for android, arm32, arm64, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows are reusable. Rebuilding only linux-rel...

@bors-servo
Copy link
Contributor

bors-servo commented May 6, 2016

@bors-servo bors-servo merged commit 0bcf35c into servo:master May 6, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.