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

internal/cpu: ARM feature detection #26630

Closed
smasher164 opened this issue Jul 26, 2018 · 7 comments
Closed

internal/cpu: ARM feature detection #26630

smasher164 opened this issue Jul 26, 2018 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@smasher164
Copy link
Member

Similar to #26538, feature detection on ARM is useful for runtime specialization of code.

Knowing if VFPv4 is present on the hardware helps the implementation of intrinsics (like FMA) and other math operations. However, since VFPv4 is detected through the HWCAP bits from auxv, only the runtime has access to the this information. Given that ARM's hardware features don't map easily to GOARM values, more fine-grained detection is needed.

An additional benefit of including ARM feature detection into the package is that because pre-ARMv8 is so variable, having a single source of feature detection makes it easier to debug different codepaths (f045ddc).

Because Go does not support ARMv4 and lower,

  • HWCAP_26BIT is always false, and thus unnecessary.
  • HWCAP_SWP and HWCAP_HALF should always be enabled.
@gopherbot
Copy link

Change https://golang.org/cl/124436 mentions this issue: unix: add Linux network namespace constants

@gopherbot
Copy link

Change https://golang.org/cl/126315 mentions this issue: internal/cpu: Detect features on ARM

@martisch
Copy link
Contributor

martisch commented Jul 27, 2018

The first arm support for harddiv was already implemented in https://go-review.googlesource.com/c/go/+/114826 and is waiting for the freeze to go1.12 to lift.

Please allow a day to answer on issues before starting implementations.

@smasher164
Copy link
Member Author

Sorry, I jumped the gun on that CL. I can withdraw it and comment on the hardDiv one if you'd like.

@martisch
Copy link
Contributor

martisch commented Jul 27, 2018

Np. I would be happy if you can comment on and test for any improvements for the existing https://go-review.googlesource.com/c/go/+/114826. We can submit your CL (after review) ontop of that for any additional features needed for upcoming implementations needing other cpu features (in e.g. math) once they are ready for review.

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 3, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 3, 2018
gopherbot pushed a commit that referenced this issue Oct 15, 2018
This change exposes feature flags needed to implement an FMA intrinsic
on ARM CPUs via auxv's HWCAP bits. Specifically, it exposes HasVFPv4 to
detect if an ARM processor has the fourth version of the vector floating
point unit. The relevant instruction for this CL is VFMA, emitted in Go
as FMULAD.

Updates #26630.

Change-Id: Ibbc04fb24c2b4d994f93762360f1a37bc6d83ff7
Reviewed-on: https://go-review.googlesource.com/c/126315
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
@bradfitz
Copy link
Contributor

What remains here? Looks like all the CLs above were merged?

Bumping to Go 1.13 but feel free to close if this is all done.

@bradfitz bradfitz modified the milestones: Go1.12, Go1.13 Nov 29, 2018
@smasher164
Copy link
Member Author

The CL has been merged, so nothing remains for the internal/cpu portion of the ARM feature.

@golang golang locked and limited conversation to collaborators Dec 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants