remove the portable simd f16 patch - #1675
Conversation
|
As expected https://triage.rust-lang.org/gha-logs/rust-lang/rustc_codegen_cranelift/86638749132?pr=1675 So that means we additionally need fallbacks for |
…, r=tgross35 add a fallback for more `f16` intrinsics tracking issue: rust-lang#116909 Add several more fallbacks for `f16` intrinsics, so that they will work on platforms without the corresponding libcalls. related - rust-lang/rustc_codegen_cranelift#1675 - rust-lang/rustc_codegen_cranelift#1674 - rust-lang#150946
b085bcc to
d5b0c74
Compare
|
This is still missing the |
1da99dd to
ad67ef8
Compare
|
Hmm, the changes here are good, but I think we need the the additional gates I added. those are merged into portable_simd but not yet synced. |
This comment has been minimized.
This comment has been minimized.
ad67ef8 to
e2b7f80
Compare
|
I think this needs one more sync, rust-lang/rust#159582 should be in today's nightly. |
This comment has been minimized.
This comment has been minimized.
|
I've done a sync again. |
e2b7f80 to
c101a23
Compare
|
Hmm, this fails on non-windows now because it tries to perform simd_for_each_lane(fx, a, ret, &|fx, lane_ty, _ret_lane_ty, lane| {
let lane_ty = match lane_ty.kind() {
ty::Float(FloatTy::F32) => types::F32,
ty::Float(FloatTy::F64) => types::F64,
_ => unreachable!("{:?}", lane_ty),
};
let name = match (intrinsic, lane_ty) {
(sym::simd_fsin, types::F32) => "sinf",
(sym::simd_fsin, types::F64) => "sin",
(sym::simd_fcos, types::F32) => "cosf",
(sym::simd_fcos, types::F64) => "cos",
(sym::simd_fexp, types::F32) => "expf",
(sym::simd_fexp, types::F64) => "exp",
(sym::simd_fexp2, types::F32) => "exp2f",
(sym::simd_fexp2, types::F64) => "exp2",
(sym::simd_flog, types::F32) => "logf",
(sym::simd_flog, types::F64) => "log",
(sym::simd_flog10, types::F32) => "log10f",
(sym::simd_flog10, types::F64) => "log10",
(sym::simd_flog2, types::F32) => "log2f",
(sym::simd_flog2, types::F64) => "log2",
(sym::simd_round, types::F32) => "roundf",
(sym::simd_round, types::F64) => "round",
(sym::simd_round_ties_even, types::F32) => "rintf",
(sym::simd_round_ties_even, types::F64) => "rint",
_ => unreachable!("{:?}", intrinsic),
};
fx.lib_call(
name,
vec![AbiParam::new(lane_ty)],
vec![AbiParam::new(lane_ty)],
&[lane],
)[0]
});But for |
4ddc467 to
bbb2cad
Compare
|
I guess we also need rust-lang/portable-simd#544. |
We could have a patch for that until it lands and gets synced to the rust-lang/rust repo. That would allow getting rid of the bulk of the portable-simd patch without having to wait for that PR. |
bbb2cad to
5b19f61
Compare
|
CI passed 🎉 |
|
that works, that smaller patch should be much easier to maintain and hopefully we can get rid of it completely in the coming days. |
|
|
||
| simd_for_each_lane(fx, a, ret, &|fx, lane_ty, _ret_lane_ty, lane| { | ||
| let lane_ty = match lane_ty.kind() { | ||
| // f16 is converted to f32 by maybe_with_f16_to_f32. |
There was a problem hiding this comment.
Does that do the right thing for the "round" intrinsics?
There was a problem hiding this comment.
I think so, every f16 value is representable in f32, and the resulting integer was already in an f16 so that should be fine too?
We do the same thing with the fallbacks in core.
There was a problem hiding this comment.
every f16 value is representable in f32,
Yeah but not vice versa. So couldn't it be that this rounds to an integer that is representible in f32 but not f16, and then the second rounding goes wrong?
I believe this will fail but let's see what happens.