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 LLVM atomic memcpy intrinsics, expose in core/std #58599

Open
joshlf opened this Issue Feb 20, 2019 · 7 comments

Comments

Projects
None yet
5 participants
@joshlf
Copy link
Contributor

joshlf commented Feb 20, 2019

Expose LLVM's "element wise atomic memory intrinsics". In particular:

  • Expose llvm.memcpy.element.unordered.atomic as atomic_element_unordered_copy_memory_nonoverlapping
  • Expose llvm.memmove.element.unordered.atomic as atomic_element_unordered_copy_memory
  • Expose llvm.memset.element.unordered.atomic as atomic_element_unordered_set_memory

Expose these through functions in the std::ptr module. Each function is implemented by the equivalent intrinsic or by a loop of relaxed atomic operations if the intrinsic is not available on the target platform (TODO: Given this platform-specific behavior, can this also be exposed in core::ptr?)

  • copy_nonoverlapping_atomic_unordered, backed by atomic_element_unordered_copy_memory_nonoverlapping
  • copy_atomic_unordered, backed by atomic_element_unordered_copy_memory
  • write_atomic_unordered, backed by atomic_element_unordered_set_memory

Previously discussed on the internals forum here.

Folks with the authority to approve this: Let me know if this is OK to move forward; I'd like to post it to This Week in Rust's CFP.

@joshlf

This comment has been minimized.

Copy link
Contributor Author

joshlf commented Feb 22, 2019

@alexcrichton Do you have thoughts on this? Want to make sure I get the go-ahead before I send somebody on TWiR's CFP down a dead end.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 22, 2019

I suspect there'll be opinions on stabilization, but seems fine to add as unstable at least to me!

@joshlf

This comment has been minimized.

Copy link
Contributor Author

joshlf commented Feb 22, 2019

OK cool, thanks!

@tmccombs

This comment has been minimized.

Copy link
Contributor

tmccombs commented Mar 2, 2019

I'd like to take a stab at implementing this.

@joshlf

This comment has been minimized.

Copy link
Contributor Author

joshlf commented Mar 2, 2019

Awesome, thanks @tmccombs ! This will unblock a lot of important work :)

@joshlf

This comment has been minimized.

Copy link
Contributor Author

joshlf commented Mar 2, 2019

@alexcrichton On the subject of exposing in core::ptr: Is the ban on platform-specific logic in core a general one, or just for API-visible elements? If it's the latter, then we should be able to implement the facade in core::ptr as well.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 4, 2019

Currently it's largely just a "we strongly discorage platform-specific APIs" in libcore, there's already platform-specific pieces to the implementation, especially some math-related pieces on MSVC

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