Page MenuHomeFreeBSD

lang/rust: enable SSE2 by default on i386
ClosedPublic

Authored by asomers on Oct 21 2024, 7:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 6:31 PM
Unknown Object (File)
Thu, Dec 12, 9:05 AM
Unknown Object (File)
Sun, Dec 8, 5:50 PM
Unknown Object (File)
Tue, Dec 3, 7:05 AM
Unknown Object (File)
Fri, Nov 29, 1:14 AM
Unknown Object (File)
Nov 25 2024, 3:50 PM
Unknown Object (File)
Nov 25 2024, 2:16 AM
Unknown Object (File)
Nov 25 2024, 2:16 AM
Subscribers

Details

Summary

Upstream Rust always requires SSE2 for x86. But back in 2017[^1][^2] we
patched lang/rust to disable SSE2 for i386. At the time, it was
reported that some people were still using non-SSE2 capable hardware.
More recently, LLVM bugs have been discovered[^3][^4] that can result in
rounding bugs and reduced accuracy when using f64 on non-SSE hardware.
In weird cases, they can even cause wilder unpredictable behavior, like
segfaults.

Revert our change for the sake of Pentium 4 users. But add an SSE2
option. Disabling it will allow the port to be used on Pentium 3 an
doler CPUs.

[^1]: https://github.com/freebsd/freebsd-ports/commit/d65b2886b1b3b2135f0b8982de4d9754517acf61
[^2]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223415
[^3]: https://github.com/rust-lang/rust/issues/114479
[^4]: https://github.com/llvm/llvm-project/issues/44218

Diff Detail

Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 60133
Build 57017: arc lint + arc unit

Event Timeline

asomers created this revision.

This is fine with me (but I'm not a ports committer). We ought to give a heads-up as well - your commit message captures the appropriate detail, so I'd just post that to appropriate mailing list(s).

This revision is now accepted and ready to land.Oct 21 2024, 7:58 PM

As @fuz mentioned on IRC, we should also add a note in UPDATING

This revision now requires review to proceed.Oct 21 2024, 8:30 PM

But add an SSE2 option. Disabling it will allow the port to be used on Pentium 3 an doler CPUs.

Bootstrap uses SSE2, so the port won't build on such old systems. Converting to a flavor may help but lang/rust itself may remain unbuildable unless the bootstrap is flavorized or an existing installation can be used as bootstrap.

UPDATING
9

pkg-updating(8) requires AFFECTS to contain package origin (aka port category/name) or magical phrase (currently unused by UPDATING).

But add an SSE2 option. Disabling it will allow the port to be used on Pentium 3 an doler CPUs.

Bootstrap uses SSE2, so the port won't build on such old systems. Converting to a flavor may help but lang/rust itself may remain unbuildable unless the bootstrap is flavorized or an existing installation can be used as bootstrap.

This new option doesn't affect bootstrap. So the port must've been unbuildable on PIII for a long time. That probably means that any PIII users who use Rust are using some other machine to cross-build their packages, which makes sense.

UPDATING
9

I don't want to put 500 separate ports on the AFFECTS line, so I guess I'll go with "all users". I do however see some entries that don't conform, like 20240529: "users of python".

  • Respond to @jbeich's comments regarding UPDATING

This new option doesn't affect bootstrap.

lang/rust uses lang/rust-bootstrap instead of vendor binaries, so changes (like codegen) to the former affect the latter. Upstream has stopped providing anything but rust-std for i686-unknown-freebsd many years ago i.e., there's no vendor bootstrap for i386.

using some other machine to cross-build their packages

Like the FreeBSD package cluster? With port option the affected users will have to buy/borrow a dedicated machine separately. And if not routinely tested by the maintainer or automation the option will bitrot.

This new option doesn't affect bootstrap.

lang/rust uses lang/rust-bootstrap instead of vendor binaries, so changes (like codegen) to the former affect the latter. Upstream has stopped providing anything but rust-std for i686-unknown-freebsd many years ago i.e., there's no vendor bootstrap for i386.

Even so, lang/rust-boostrap is ONLY_FOR_ARCHS=amd64 powerpc64 powerpc64le . It's got a flavor for i386, but I guess that is just for cross-compiling? If so, then rust-bootstrap won't run in fewer places after this commit than it does right now.

using some other machine to cross-build their packages

Like the FreeBSD package cluster? With port option the affected users will have to buy/borrow a dedicated machine separately. And if not routinely tested by the maintainer or automation the option will bitrot.

Yes they will. Pentium III will basically be treated like an embedded system now.

As Jan pointed out, this change will hurt the experience of PIII users. But it will improve the experience of P4+ users, and x86_64 users with 32-bit jails. So @emaste @jbeich , is that a good enough reason to commit it? Or do we need to canvas more people?

I still feel the port option is not practical (waste of CPU time and electricity) but otherwise have exhausted my arguments. It's up to rust team to actually approve but "maintainer timeout" (14 days) may also work.

Yes they will. Pentium III will basically be treated like an embedded system now.

Like Tier3 without packages? armv6 and armv7 have separate repos, so a rare armv7 CPU without NEON can still use armv6 packages (EDIT: until 988dc662364d).

UPDATING
17

build -> cross-build. Native builds won't work on SSE2-less hardware due to bootstrap.

UPDATING
17

cross-build example:

now cross-build lang/rust for i386 on amd64 via ports-mgmt/poudriere after disabling SSE2 port option, and rebuild
This revision is now accepted and ready to land.Nov 8 2024, 12:09 AM

At the 2024 FreeBSD Summit we took a poll. Not a single user thought it important to continue providing Pentium III-compatible prebuilt packages. So I'm going to commit this now.
{F102272979}

This revision was automatically updated to reflect the committed changes.