Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd LLVM atomic memcpy intrinsics, expose in core/std #58599
Comments
estebank
added
A-LLVM
T-libs
labels
Feb 20, 2019
Centril
added
T-lang
C-feature-request
labels
Feb 20, 2019
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
|
I suspect there'll be opinions on stabilization, but seems fine to add as unstable at least to me! |
This comment has been minimized.
This comment has been minimized.
|
OK cool, thanks! |
This comment has been minimized.
This comment has been minimized.
|
I'd like to take a stab at implementing this. |
This comment has been minimized.
This comment has been minimized.
|
Awesome, thanks @tmccombs ! This will unblock a lot of important work :) |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton On the subject of exposing in |
This comment has been minimized.
This comment has been minimized.
|
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 |
joshlf commentedFeb 20, 2019
Expose LLVM's "element wise atomic memory intrinsics". In particular:
llvm.memcpy.element.unordered.atomicasatomic_element_unordered_copy_memory_nonoverlappingllvm.memmove.element.unordered.atomicasatomic_element_unordered_copy_memoryllvm.memset.element.unordered.atomicasatomic_element_unordered_set_memoryExpose these through functions in the
std::ptrmodule. 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 incore::ptr?)copy_nonoverlapping_atomic_unordered, backed byatomic_element_unordered_copy_memory_nonoverlappingcopy_atomic_unordered, backed byatomic_element_unordered_copy_memorywrite_atomic_unordered, backed byatomic_element_unordered_set_memoryPreviously 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.