CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
42 lines
2.0 KiB
ReStructuredText
42 lines
2.0 KiB
ReStructuredText
.. _hand_in_hand:
|
|
|
|
============
|
|
Hand-in-Hand
|
|
============
|
|
|
|
Hand-in-Hand is the name of the mechanism that allows other LLVM projects to use
|
|
LLVM-libc's internal C++ APIs instead of calling the public libc interface.
|
|
This is useful for cases where the C interface doesn't match the desired
|
|
interface.
|
|
|
|
The original use case for the Hand-in-Hand interface was to let libc++ use
|
|
LLVM-libc's string to float conversion internals. The libc interface (strtof)
|
|
takes a null terminated string with no maximum length while the libc++ interface
|
|
(from_chars<float>) takes a string with a start and an end. If libc++ had used
|
|
the public interface it would have had to allocate a new null terminated string
|
|
before calling strtof, but with Hand-in-Hand libc++ handles its own parsing
|
|
and then passes the parsed information to LLVM-libc's conversion code. This is
|
|
better for performance and cuts down on code duplication in the LLVM repository.
|
|
|
|
Hand-in-Hand works by LLVM-libc exposing a set of headers in the /libc/shared/
|
|
directory. These headers make the interface more explicit and easier to
|
|
maintain. The client library includes the shared headers by depending on the
|
|
llvm-libc-common-utilities target which sets up the necessary includes and
|
|
defines. The client library then includes "shared/<header>" to get the necessary
|
|
components. All of the functions shared via Hand-in-Hand are header only.
|
|
|
|
The Hand-in-Hand interface is intended to be an internal implementation detail,
|
|
and it has no guarantees of stability. When the internal LLVM-libc interface is
|
|
changed the other users inside of the LLVM repository are updated in the same
|
|
commit. This allows LLVM-libc to update their interface without breaking their
|
|
users.
|
|
|
|
Current Hand-in-Hand users:
|
|
Libc++ uses it for from_chars<float/double>
|
|
OpenMP uses it for printf on GPUs
|
|
[WIP] clang uses it for APFloat functions.
|
|
|
|
For more information check out the 2024 talk about the original Project:
|
|
* `slides <https://llvm.org/devmtg/2024-10/slides/techtalk/Jones-DiBella-hand-in-hand.pdf>`__
|
|
* `video <https://www.youtube.com/watch?v=VAEO86YtTHA>`__
|