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

all: drop GO386=387 support in Go 1.16 #40255

Closed
aclements opened this issue Jul 16, 2020 · 24 comments
Closed

all: drop GO386=387 support in Go 1.16 #40255

aclements opened this issue Jul 16, 2020 · 24 comments

Comments

@aclements
Copy link
Member

I propose dropping 387 floating-point support and requiring SSE2 support for GOARCH=386 in the native gc compiler for Go 1.16. This would raise the minimum GOARCH=386 requirement to the Intel Pentium 4 (released in 2000) or AMD Opteron/Athlon 64 (released in 2003).

We would need to pre-announce this in the 1.15 release notes. (I've put it in the 1.15 milestone for this reason.)

There are several benefits to doing this:

  1. While 387 support isn’t a huge maintenance burden, it does take time away from performance and feature work and represents a fair amount of latent complexity.
  2. 387 support has been a regular source of bugs (cmd/compile: constant propagation in compiler converts signaling NaN to quiet NaN #36400, cmd/compile: 387 quietens signalling NaNs during compilation #27516, cmd/compile: invalid instruction error for FMOVD when compiling for 387 #22429, math: math on 387 does not match float64 due to extended exponents #17357, cmd/compile: Illegal instruction 'fucomip' on 386 with GO386=387 #13923, possible non-387 instructions in a GO386=387 build #12970, cmd/8c: use of prefetchnta requires SSE #4798, just to name a few).
  3. 387 bugs often go undetected for a long time because we don’t have builders that support only 387 (so unsupported instructions can slip in unnoticed).
  4. Raising the minimum requirement to SSE2 would allow us to also assume many other useful architectural features, such as proper memory fences and 128 bit registers, which would simplify the compiler and runtime and allow for much more efficient implementations of core functions like memmove on 386.
  5. We’re exploring switching to a register-based calling convention in Go 1.16, which promises significant performance improvements, but retaining 387 support will definitely complicate this and slow our progress.

The gccgo toolchain will continue to support 387 floating-point, so this remains an option for projects that absolutely must use 387 floating-point.

I proposed this on golang-nuts to get feedback on significant uses of GO386=387, particularly for which using gccgo would not be a viable option.

@aclements aclements added this to the Go1.15 milestone Jul 16, 2020
@gopherbot
Copy link

Change https://golang.org/cl/243137 mentions this issue: doc/go1.15: announce GO386=387 deprecation

@aclements
Copy link
Member Author

We should wait a little longer for public comment, but I've gone ahead and prepared the pre-announcement for the release notes. (We could also submit the release notes change and roll it back if necessary.)

Nick Craig-Wood pointed out on golang-nuts that we should make sure GO386=387 fails with a useful error message if we do drop it (rather than, say, starting to ignore the GO386 environment variable entirely).

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Jul 16, 2020
@mvdan
Copy link
Member

mvdan commented Jul 16, 2020

Perhaps a silly question, but would this affect GOARCH=amd64 at all?

@randall77
Copy link
Contributor

@mvdan, no it would not.

@beoran
Copy link

beoran commented Jul 18, 2020

I guess I am the only one who still has such an old computer. Emulated coprocessor support is also still useful for certain embedded systems. I would keep the feature around for a few more years.

@martisch
Copy link
Contributor

It is known that systems still exists that do not support SSE2. I have several too. It would be interesting if there are users of them relying on current versions of Go for more than hobbyist use and if they cant use gccgo.

@rsc rsc moved this from Incoming to Active in Proposals (old) Jul 22, 2020
@rsc rsc changed the title proposal: drop GO386=387 support in Go 1.16 proposal: all: drop GO386=387 support in Go 1.16 Jul 22, 2020
gopherbot pushed a commit that referenced this issue Jul 23, 2020
For #40255.
Updates #37419.

Change-Id: If9210c855cc2eea079e7e469463d4203888748f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/243137
Reviewed-by: Andrew Bonventre <andybons@golang.org>
@aclements
Copy link
Member Author

I've gone ahead and submitted the deprecation notice to the 1.15 release notes. However, this issue is still in proposal review. If it does get declined, we can revert the CL. I've asked for this to get reviewed in next week's proposal review meeting.

@rsc
Copy link
Contributor

rsc commented Jul 29, 2020

This went into the proposal minutes last week, and @aclements mailed it to golang-nuts and golang-dev as well. Let's leave this open another week before moving to likely accept, but there doesn't seem to be much pushback here.

@rsc
Copy link
Contributor

rsc commented Aug 5, 2020

Based on the discussion above, this seems like a likely accept.
So long, 387, and thanks for all the floating-point errors.

@rsc rsc moved this from Active to Likely Accept in Proposals (old) Aug 5, 2020
@bradfitz
Copy link
Contributor

bradfitz commented Aug 7, 2020

One data point: just today somebody asked for 387 binaries in tailscale/tailscale#651

We already cross-compile a number of architectures (https://pkgs.tailscale.com/unstable/#static) and it's easy to add 387 to that list. If we had to use gccgo, though, it's a bit harder. Perhaps add some docs linked from the release notes pointing to gccgo instructions for building static 387 binaries?

@ianlancetaylor
Copy link
Contributor

To build a static executable with gccgo: go build -compiler=gccgo -gccgoflags=-static.

But note that gccgo executables use the C libraries, so static executables on GNU/Linux systems have some limitations, as glibc generally expects to be dynamically linked. Specifically not all /etc/nsscache.conf values are supported, unless the dynamic C library is also present at run time.

@martisch
Copy link
Contributor

martisch commented Aug 10, 2020

The most feedback to keep support seems to come from users with AMD Geode GX/LX (the kind with MMX but not SSE or SSE2) boards still used in the embedded space (e.g. routers like the ALIX boards).

Im in favor of dropping 387. As an alternative go1.16 could be made to reinterpret GO386=387 to mean use softfloat support instead of 387 or SSE2 instructions. This would make ordinary go programs on 387 hardware still work, but slower. It would make the register based calling convention still easier as other platforms (e.g. arm and mips) also require softfloat support. We would also have a mainstream platform for builders to test the softfloat code paths frequently.

The upside is that e.g. Athlon XP and Pentium II/III (there were quite alot produced in the Windows XP time) keep on working and linux distros dont need to switch away from go gc to gogcc for their package builders for 386 distros supporting older hardware. This would allow linux distros to keep on using the same build/verification processes in place for 386 and amd64.

For verifying no newer instructionsets are used we could potentially use something like:
https://software.intel.com/content/www/us/en/develop/articles/intel-software-development-emulator.html

@andybons andybons modified the milestones: Go1.15, Go1.16 Aug 11, 2020
@rsc
Copy link
Contributor

rsc commented Aug 12, 2020

No change in consensus, so accepted.

@rsc rsc moved this from Likely Accept to Accepted in Proposals (old) Aug 12, 2020
@rsc rsc changed the title proposal: all: drop GO386=387 support in Go 1.16 all: drop GO386=387 support in Go 1.16 Aug 14, 2020
@randall77
Copy link
Contributor

Small question here. What to do with GO386?
Since GO386 was only used to select 387, we can drop it. But should we get rid of it completely, or do we want to keep it around, if only to error out if GO386 is still set to 387. Otherwise, we'd silently generate sse2 binaries when 387 was requested.

@bcmills
Copy link
Contributor

bcmills commented Oct 1, 2020

I would keep it around to generate the error.

(https://golang.org/design/28221-go2-transitions strongly prefers additions and removals over redefinitions, and ignoring GO386=387 would be a redefinition.)

@aclements
Copy link
Member Author

I agree we should keep it and error out if it's set to anything but sse2 (see also previous comment).

@gopherbot
Copy link

Change https://golang.org/cl/258957 mentions this issue: all: drop 387 support

@gopherbot
Copy link

Change https://golang.org/cl/259449 mentions this issue: dashboard: remove linux-386-387 builder

gopherbot pushed a commit to golang/build that referenced this issue Oct 5, 2020
Also update some test cases to be more relevant.

For golang/go#40255.
Fixes golang/go#41799.

Change-Id: Ie63e068a46058bcaf7866f2090049fb888612cbe
Reviewed-on: https://go-review.googlesource.com/c/build/+/259449
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
gopherbot pushed a commit that referenced this issue Oct 5, 2020
Support for GO386=387 is being dropped in Go 1.16. There
is no need for the target to be available for testing on
the master branch (where Go 1.16 development is ongoing).

For #40255.

Change-Id: I4a4ee80b0c0a535b6b0b246fe991f26964eb07ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/257963
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
@randall77
Copy link
Contributor

We replaced 387 support with softfloat support GO386=softfloat in CLs 260017 and 260137.
If anyone has a machine without SSE support, please try tip and let us know if it works.
@beoran

claucece pushed a commit to claucece/go that referenced this issue Oct 22, 2020
…bbering registers

The 387 port needs to load a floating-point control word from a
global location to implement float32 arithmetic.
When compiling with -pie, loading that control word clobbers an
integer register. If that register had something important in it, boom.

Fix by using LEAL to materialize the address of the global location
first. LEAL with -pie works because the destination register is
used as the scratch register.

387 support is about to go away (golang#40255), so this will need to be
backported to have any effect.

No test. I have one, but it requires building with -pie, which
requires cgo. Our testing infrastructure doesn't make that easy.
Not worth it for a port which is about to vanish.

Fixes golang#41620

Change-Id: I140f9fc8fdce4e74a52c2c046e2bd30ae476d295
Reviewed-on: https://go-review.googlesource.com/c/go/+/257277
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Keith Randall <khr@golang.org>
(cherry picked from commit ea106cc)
Reviewed-on: https://go-review.googlesource.com/c/go/+/257207
kraj added a commit to YoeDistro/openembedded-core that referenced this issue Feb 25, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

Signed-off-by: Khem Raj <raj.khem@gmail.com>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Feb 25, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Feb 25, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: 6f5a7daa3478cfb8febd170f08f7777d3db43865)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Feb 25, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: 6f5a7daa3478cfb8febd170f08f7777d3db43865)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Feb 25, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Feb 25, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: dddd90e708ac93f11ca4a156f9dfdbe18fe223bb)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
stefan-hartmann-lgs pushed a commit to hexagon-geo-surv/poky that referenced this issue Feb 26, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: dddd90e708ac93f11ca4a156f9dfdbe18fe223bb)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Feb 26, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: dddd90e708ac93f11ca4a156f9dfdbe18fe223bb)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Feb 26, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Feb 26, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: bf0d24ea11221eec9191094a4f4213982a146d54)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Feb 26, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
kraj added a commit to YoeDistro/poky-old that referenced this issue Feb 26, 2021
387 has been removed from go 1.16 see [1]

[1] golang/go#40255

(From OE-Core rev: fd549c139f534f28974c86a4e4c7acf6f5c40a79)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
aykevl added a commit to tinygo-org/tinygo that referenced this issue Aug 6, 2021
Previously we used the i386 target, probably with all optional features
disabled. However, the Pentium 4 has been released a _long_ time ago and
it seems reasonable to me to take that as a minimum requirement.

Upstream Go now also seems to move in this direction:
golang/go#40255

The main motivation for this is that there were floating point issues
when running the tests for the math package:

    GOARCH=386 tinygo test math

I haven't investigated what's the issue, but I strongly suspect it's
caused by the weird x87 80-bit floating point format. This could perhaps
be fixed in a different way (by setting the FPU precision to 64 bits)
but I figured that just setting the minimum requirement to the Pentium 4
would probably be fine. If needed, we can respect the GO386 environment
variable to support these very old CPUs.

To support this newer CPU, I had to make sure that the stack is aligned
to 16 bytes everywhere. This was not yet always the case.
deadprogram pushed a commit to tinygo-org/tinygo that referenced this issue Aug 10, 2021
Previously we used the i386 target, probably with all optional features
disabled. However, the Pentium 4 has been released a _long_ time ago and
it seems reasonable to me to take that as a minimum requirement.

Upstream Go now also seems to move in this direction:
golang/go#40255

The main motivation for this is that there were floating point issues
when running the tests for the math package:

    GOARCH=386 tinygo test math

I haven't investigated what's the issue, but I strongly suspect it's
caused by the weird x87 80-bit floating point format. This could perhaps
be fixed in a different way (by setting the FPU precision to 64 bits)
but I figured that just setting the minimum requirement to the Pentium 4
would probably be fine. If needed, we can respect the GO386 environment
variable to support these very old CPUs.

To support this newer CPU, I had to make sure that the stack is aligned
to 16 bytes everywhere. This was not yet always the case.
@gopherbot
Copy link

Change https://golang.org/cl/342895 mentions this issue: dashboard, cmd/gomote: remove the linux-386-387 builder

gopherbot pushed a commit to golang/build that referenced this issue Aug 17, 2021
The linux-386-387 was only in use for Go 1.15 development. It is being
removed as there is no further development for Go 1.15.

For golang/go#40255
For golang/go#41799

Change-Id: If636c0099bce195e227a5036842ace92e8305fc9
Reviewed-on: https://go-review.googlesource.com/c/build/+/342895
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@golang golang locked and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests