-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add target-specific NaN payloads for the missing tier 2 targets #138870
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
Conversation
I was unable to find authoritative ISA documentation specifically for the tier 3 |
I know I've seen some other discussions about NaN stuff pop up in my notifications recently. As such, passing off as Ralf likely knows better. r? @RalfJung |
This LGTM, but I can't fact-check it so let's wait a bit to give target maintainers time to take a look. |
For |
Looks correct for |
LGTM for For future reference, I came to the conclusion based on this part from
There seems to be some documentation on QNaN values in
|
We'll have to double-check for
Whereas the "source operand priority" is based on the instruction format of individual relevant instructions. So QNaN propagation should be possible on LoongArch, and the preferred QNaN is only generated for operations whose inputs don't involve any NaN, but we'd like to do some experiments to definitely confirm. |
The docs I found for this at https://www.nxp.com/docs/en/reference-manual/SPEPEM.pdf state some truly strange things: The docs also mention software routines can be used to override this behavior, but I don't know if this will happen on a typical instance of this target. If not, this is non-compliant with IEEE 754 and hence unsound for Rust. So probably it'd be better for now to clarify that the statement in the table only refers to powerpc chips with the normal FPU. |
"Case 2" aligns with the |
I've updated the |
Given that @beetrees is one of the people I'd have asked for this data if I wrote this PR myself, and the target experts have been notified and nobody objected, I'm going to land this. Cc @programmerjake, I think you're the one person coming to my mind in this area we haven't pinged yet -- would be nice if you could take a brief look whether what the PR says makes sense. :) |
Add target-specific NaN payloads for the missing tier 2 targets This PR adds target-specific NaN payloads for the remaining tier 2 targets: - `arm64ec`: This target is a mix of `x86_64` and `aarch64`, meaning as they both have no extra payloads `arm64ec` also has no extra payloads. - `loongarch64`: Per [LoongArch Reference Manual - Volume 1: Basic Architecture](https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf) section 3.1.1.3, LoongArch does quieting NaN propagation with the Rust preferred NaN as its default NaN, meaning it has no extra payloads. - `nvptx64`: Per [PTX ISA documentation](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#floating-point-instructions) section 9.7.3 (and section 9.7.4 for `f16`), all payloads are possible. The documentation explicitly states that `f16` and `f32` operations result in an unspecified NaN payload, while for `f64` it states "NaN payloads are supported" without specifying how or what payload will be generated if there are no input NaNs. - `powerpc` and `powerpc64`: Per [Power Instruction Set Architecture](https://files.openpower.foundation/s/9izgC5Rogi5Ywmm/download/OPF_PowerISA_v3.1C.pdf) Book I section 4.3.2, PowerPC does quieting NaN propagation with the Rust preferred NaN being generated if no there are no input NaNs, meaning it has no extra payloads. - `s390x`: Per [IBM z/Architecture Principles of Operation](https://www.vm.ibm.com/library/other/22783213.pdf#page=965) page 9-3, s390x does quieting NaN propagation with the Rust's preferred NaN as its default NaN, meaning it has no extra payloads. Tracking issue: rust-lang#128288 cc `@RalfJung` `@rustbot` label +T-lang Also cc relevant target maintainers of tier 2 targets: - `arm64ec`: `@dpaoliello` - `loongarch64`: `@heiher` `@xiangzhai` `@zhaixiaojuan` `@xen0n` - `nvptx64`: `@RDambrosio016` `@kjetilkjeka` - `powerpc`: the only documented maintainer is `@BKPepe` for the tier 3 `powerpc-unknown-linux-muslspe`. - `powerpc64`: `@daltenty` `@gilamn5tr` `@Gelbpunkt` `@famfo` `@neuschaefer` - `s390x`: `@uweigand` `@cuviper`
…enton Rollup of 5 pull requests Successful merges: - rust-lang#138870 (Add target-specific NaN payloads for the missing tier 2 targets) - rust-lang#139309 (make abi_unsupported_vector_types a hard error) - rust-lang#140063 (Remove stray newline from post-merge report) - rust-lang#140067 (Remove (now unused) #[rustc_macro_edition_2021] attribute) - rust-lang#140068 (replace broken links armv7-rtems-eabihf.md) r? `@ghost` `@rustbot` modify labels: rollup
…enton Rollup of 5 pull requests Successful merges: - rust-lang#138870 (Add target-specific NaN payloads for the missing tier 2 targets) - rust-lang#139028 (Make target maintainers more easily pingable) - rust-lang#140063 (Remove stray newline from post-merge report) - rust-lang#140067 (Remove (now unused) #[rustc_macro_edition_2021] attribute) - rust-lang#140068 (replace broken links armv7-rtems-eabihf.md) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#138870 - beetrees:tier-2-nans, r=RalfJung Add target-specific NaN payloads for the missing tier 2 targets This PR adds target-specific NaN payloads for the remaining tier 2 targets: - `arm64ec`: This target is a mix of `x86_64` and `aarch64`, meaning as they both have no extra payloads `arm64ec` also has no extra payloads. - `loongarch64`: Per [LoongArch Reference Manual - Volume 1: Basic Architecture](https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf) section 3.1.1.3, LoongArch does quieting NaN propagation with the Rust preferred NaN as its default NaN, meaning it has no extra payloads. - `nvptx64`: Per [PTX ISA documentation](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#floating-point-instructions) section 9.7.3 (and section 9.7.4 for `f16`), all payloads are possible. The documentation explicitly states that `f16` and `f32` operations result in an unspecified NaN payload, while for `f64` it states "NaN payloads are supported" without specifying how or what payload will be generated if there are no input NaNs. - `powerpc` and `powerpc64`: Per [Power Instruction Set Architecture](https://files.openpower.foundation/s/9izgC5Rogi5Ywmm/download/OPF_PowerISA_v3.1C.pdf) Book I section 4.3.2, PowerPC does quieting NaN propagation with the Rust preferred NaN being generated if no there are no input NaNs, meaning it has no extra payloads. - `s390x`: Per [IBM z/Architecture Principles of Operation](https://www.vm.ibm.com/library/other/22783213.pdf#page=965) page 9-3, s390x does quieting NaN propagation with the Rust's preferred NaN as its default NaN, meaning it has no extra payloads. Tracking issue: rust-lang#128288 cc ``@RalfJung`` ``@rustbot`` label +T-lang Also cc relevant target maintainers of tier 2 targets: - `arm64ec`: ``@dpaoliello`` - `loongarch64`: ``@heiher`` ``@xiangzhai`` ``@zhaixiaojuan`` ``@xen0n`` - `nvptx64`: ``@RDambrosio016`` ``@kjetilkjeka`` - `powerpc`: the only documented maintainer is ``@BKPepe`` for the tier 3 `powerpc-unknown-linux-muslspe`. - `powerpc64`: ``@daltenty`` ``@gilamn5tr`` ``@Gelbpunkt`` ``@famfo`` ``@neuschaefer`` - `s390x`: ``@uweigand`` ``@cuviper``
Add target-specific NaN payloads for the missing tier 2 targets This PR adds target-specific NaN payloads for the remaining tier 2 targets: - `arm64ec`: This target is a mix of `x86_64` and `aarch64`, meaning as they both have no extra payloads `arm64ec` also has no extra payloads. - `loongarch64`: Per [LoongArch Reference Manual - Volume 1: Basic Architecture](https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf) section 3.1.1.3, LoongArch does quieting NaN propagation with the Rust preferred NaN as its default NaN, meaning it has no extra payloads. - `nvptx64`: Per [PTX ISA documentation](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#floating-point-instructions) section 9.7.3 (and section 9.7.4 for `f16`), all payloads are possible. The documentation explicitly states that `f16` and `f32` operations result in an unspecified NaN payload, while for `f64` it states "NaN payloads are supported" without specifying how or what payload will be generated if there are no input NaNs. - `powerpc` and `powerpc64`: Per [Power Instruction Set Architecture](https://files.openpower.foundation/s/9izgC5Rogi5Ywmm/download/OPF_PowerISA_v3.1C.pdf) Book I section 4.3.2, PowerPC does quieting NaN propagation with the Rust preferred NaN being generated if no there are no input NaNs, meaning it has no extra payloads. - `s390x`: Per [IBM z/Architecture Principles of Operation](https://www.vm.ibm.com/library/other/22783213.pdf#page=965) page 9-3, s390x does quieting NaN propagation with the Rust's preferred NaN as its default NaN, meaning it has no extra payloads. Tracking issue: rust-lang#128288 cc ``@RalfJung`` ``@rustbot`` label +T-lang Also cc relevant target maintainers of tier 2 targets: - `arm64ec`: ``@dpaoliello`` - `loongarch64`: ``@heiher`` ``@xiangzhai`` ``@zhaixiaojuan`` ``@xen0n`` - `nvptx64`: ``@RDambrosio016`` ``@kjetilkjeka`` - `powerpc`: the only documented maintainer is ``@BKPepe`` for the tier 3 `powerpc-unknown-linux-muslspe`. - `powerpc64`: ``@daltenty`` ``@gilamn5tr`` ``@Gelbpunkt`` ``@famfo`` ``@neuschaefer`` - `s390x`: ``@uweigand`` ``@cuviper``
This PR adds target-specific NaN payloads for the remaining tier 2 targets:
arm64ec
: This target is a mix ofx86_64
andaarch64
, meaning as they both have no extra payloadsarm64ec
also has no extra payloads.loongarch64
: Per LoongArch Reference Manual - Volume 1: Basic Architecture section 3.1.1.3, LoongArch does quieting NaN propagation with the Rust preferred NaN as its default NaN, meaning it has no extra payloads.nvptx64
: Per PTX ISA documentation section 9.7.3 (and section 9.7.4 forf16
), all payloads are possible. The documentation explicitly states thatf16
andf32
operations result in an unspecified NaN payload, while forf64
it states "NaN payloads are supported" without specifying how or what payload will be generated if there are no input NaNs.powerpc
andpowerpc64
: Per Power Instruction Set Architecture Book I section 4.3.2, PowerPC does quieting NaN propagation with the Rust preferred NaN being generated if no there are no input NaNs, meaning it has no extra payloads.s390x
: Per IBM z/Architecture Principles of Operation page 9-3, s390x does quieting NaN propagation with the Rust's preferred NaN as its default NaN, meaning it has no extra payloads.Tracking issue: #128288
cc @RalfJung
@rustbot label +T-lang
Also cc relevant target maintainers of tier 2 targets:
arm64ec
: @dpaolielloloongarch64
: @heiher @xiangzhai @zhaixiaojuan @xen0nnvptx64
: @RDambrosio016 @kjetilkjekapowerpc
: the only documented maintainer is @BKPepe for the tier 3powerpc-unknown-linux-muslspe
.powerpc64
: @daltenty @gilamn5tr @Gelbpunkt @famfo @neuschaefers390x
: @uweigand @cuviper