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

Implementation for Aarch64 TME intrinsics #855

Merged
merged 3 commits into from
May 29, 2020

Conversation

vertexclique
Copy link
Member

This enables Aarch64 TME intrinsics and documents them. We need to enable tme feature at rust-lang/rust before merging this.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

crates/core_arch/src/aarch64/tme.rs Outdated Show resolved Hide resolved
crates/core_arch/src/aarch64/tme.rs Outdated Show resolved Hide resolved
crates/core_arch/src/aarch64/tme.rs Outdated Show resolved Hide resolved
crates/core_arch/src/aarch64/tme.rs Outdated Show resolved Hide resolved
RalfJung added a commit to RalfJung/rust that referenced this pull request May 22, 2020
…es, r=Amanieu

Enable ARM TME (Transactional Memory Extensions)

Enables ARM TME coming up with LLVM 10. Related ARM TME intrinsics are included by the merge of rust-lang#67900.

Enables: rust-lang/stdarch#855
@vertexclique vertexclique force-pushed the vcq/aarch64-tme-extensions branch 6 times, most recently from 6be4f82 to d79e0a7 Compare May 27, 2020 00:37
@vertexclique
Copy link
Member Author

vertexclique commented May 27, 2020

@Amanieu There is a problem with current tests for neon intrinsics in the test suite. Any way to get over it?

Marking the PR as ready for review.

@vertexclique vertexclique marked this pull request as ready for review May 27, 2020 10:40
@Amanieu
Copy link
Member

Amanieu commented May 27, 2020

I'll have a look at the tests, it doesn't seem to be due to your code.

@Amanieu
Copy link
Member

Amanieu commented May 28, 2020

I fixed the CI failures in #857, please rebase.

@vertexclique
Copy link
Member Author

Rebased, it seems QEMU doesn't come with this feature extension.

@@ -45,6 +45,7 @@ fn aarch64_linux() {
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
println!("tme: {}", is_aarch64_feature_detected!("tme"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to implement detection for this feature. Do a search for dotprod to see how it is done.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with feature detection, didn't find the feature tbh. Even instructions and signatures are the same. llvm/llvm-project@a36d314#diff-3674dac5c4241890431fece8594c3143R25-R34

What am I doing wrong? (I still suspect from qemu, checked source code, it doesn't exist there yet. Might be wrong.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current feature detection is fine. Linux doesn't have the TME flag in /proc/cpuinfo or AT_HWCAPS yet, so there's nothing we can do about that for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when it enters to kernel I will add here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed your comments. Thanks for the help! @Amanieu

@vertexclique vertexclique force-pushed the vcq/aarch64-tme-extensions branch 6 times, most recently from 59f8fbb to f91a223 Compare May 29, 2020 01:18
@Amanieu
Copy link
Member

Amanieu commented May 29, 2020

It seems that the tests are failing because the objdump version in CI doesn't support TME instructions.

Try updating the ubuntu version to 20.04 in ci/docker/aarch64-unknown-linux-gnu/Dockerfile.

@Amanieu Amanieu merged commit 94cf517 into rust-lang:master May 29, 2020
@Amanieu
Copy link
Member

Amanieu commented May 29, 2020

Thanks! You'll need to send a PR to rust-lang/rust to update the stdarch submodule if you want to have this in the next nightly.

@RalfJung
Copy link
Member

RalfJung commented Feb 3, 2024

I am not sure if we can have intrinsics like these in Rust. After all, the compiler may reorder unrelated memory accesses into the transaction block, which would then be un-done when the transaction is aborted, which can cause arbitrary program misbehavior. Or am I misunderstanding how these instructions work?

See #1521 for discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants