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

Add const-eval support for SIMD types, insert, and extract #64738

Merged
merged 12 commits into from Sep 25, 2019

Conversation

@gnzlbg
Copy link
Contributor

commented Sep 24, 2019

This adds initial support for constant-evaluation of Abi::Vector types.

r? @oli-obk

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

commented Sep 24, 2019

@oli-obk this does the bare minimum for getting platform-intrinsics working and adds two "simple" intrinsics. I want initial feedback on this because I don't know what I'm doing. I feel like there are many different ways of doing the same thing with the constant evaluator.

@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2019

This is pretty cool. I think it would be best if the experimentation happened in the miri repo instead of in the const evaluator. With that you can actually run cargo miri test on crates excercising SIMD

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

commented Sep 24, 2019

I think it would be best if the experimentation happened in the miri repo instead of in the const evaluator.

I tried that but miri did not support platform-intrinsics, so I needed to add support for that here, and then, I also needed to add a test here, so I ended up with this :/

I'm really confused for when some intrinsics should be implemented in the const-evaluator vs in the miri repository.

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

commented Sep 24, 2019

Also notice that these intrinsics are all unstable anyways so they can't be used from stable Rust.

@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2019

I tried that but miri did not support platform-intrinsics, so I needed to add support for that here, and then, I also needed to add a test here, so I ended up with this :/

Sometimes miri changes need smaller miri-engine changes. In this case the removal of the ABI check

I'm really confused for when some intrinsics should be implemented in the const-evaluator vs in the miri repository.

anything experimental should go into miri, anything that will never get stabilized should go into miri. Anything that has an RFC and generally a sound plan for stabilization should go into the const evaluator.

We can trivially move things from miri to the const evaluator when we need to in the future.

Also notice that these intrinsics are all unstable anyways so they can't be used from stable Rust.

I'm not worried about that. I just think it would allow you to iterate much faster if you did this in miri, and you could test it much more easily since you can run miri on regular crates instead of having to cook up artificial examples

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Sep 24, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-24T15:02:54.9108811Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-24T15:02:54.9380464Z ##[command]git config gc.auto 0
2019-09-24T15:02:54.9447037Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-24T15:02:54.9496457Z ##[command]git config --get-all http.proxy
2019-09-24T15:02:54.9651994Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64738/merge:refs/remotes/pull/64738/merge
---
2019-09-24T15:09:45.2012823Z    Compiling serde_json v1.0.40
2019-09-24T15:09:47.0923147Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-09-24T15:09:58.4645205Z     Finished release [optimized] target(s) in 1m 34s
2019-09-24T15:09:58.4747795Z tidy check
2019-09-24T15:09:58.8923400Z tidy error: /checkout/src/librustc_mir/interpret/intrinsics.rs:251: line longer than 100 chars
2019-09-24T15:10:00.5879242Z some tidy checks failed
2019-09-24T15:10:00.5885809Z 
2019-09-24T15:10:00.5885809Z 
2019-09-24T15:10:00.5887716Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-09-24T15:10:00.5888359Z 
2019-09-24T15:10:00.5888385Z 
2019-09-24T15:10:00.5894812Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-09-24T15:10:00.5894923Z Build completed unsuccessfully in 0:01:37
2019-09-24T15:10:00.5894923Z Build completed unsuccessfully in 0:01:37
2019-09-24T15:10:00.5947984Z == clock drift check ==
2019-09-24T15:10:00.5963246Z   local time: Tue Sep 24 15:10:00 UTC 2019
2019-09-24T15:10:00.6700520Z   network time: Tue, 24 Sep 2019 15:10:00 GMT
2019-09-24T15:10:00.6700664Z == end clock drift check ==
2019-09-24T15:10:01.9889240Z ##[error]Bash exited with code '1'.
2019-09-24T15:10:01.9930366Z ##[section]Starting: Checkout
2019-09-24T15:10:01.9932461Z ==============================================================================
2019-09-24T15:10:01.9932545Z Task         : Get sources
2019-09-24T15:10:01.9932602Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

gnzlbg added 3 commits Sep 25, 2019
gnzlbg added 2 commits Sep 25, 2019
@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

commented Sep 25, 2019

So I think I've made all changes. Tests pass on my side.

gnzlbg added 2 commits Sep 25, 2019
@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2019

📌 Commit 5ecb7eb has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Sep 25, 2019
Add const-eval support for SIMD types, insert, and extract

This adds initial support for constant-evaluation of Abi::Vector types.

r? @oli-obk
bors added a commit that referenced this pull request Sep 25, 2019
Rollup of 6 pull requests

Successful merges:

 - #62975 (Almost fully deprecate hir::map::Map.hir_to_node_id)
 - #64386 (use `sign` variable in abs and wrapping_abs methods)
 - #64508 (or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR)
 - #64738 (Add const-eval support for SIMD types, insert, and extract)
 - #64759 (Refactor mbe a tiny bit)
 - #64764 (Master is now 1.40 )

Failed merges:

r? @ghost
@bors bors merged commit 5ecb7eb into rust-lang:master Sep 25, 2019
4 checks passed
4 checks passed
pr Build #20190925.26 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (LinuxTools) LinuxTools succeeded
Details
&self, op: OpTy<'tcx, M::PointerTag>
) -> (u64, &rustc::ty::TyS<'tcx>) {
if let layout::Abi::Vector { .. } = op.layout.abi {
(op.layout.ty.simd_size(*self.tcx) as _, op.layout.ty.simd_type(*self.tcx))

This comment has been minimized.

Copy link
@eddyb

eddyb Sep 26, 2019

Member

Any reason why this is not using the element count from Abi::Vector?

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

commented Sep 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.