-
Notifications
You must be signed in to change notification settings - Fork 70
Redesign atomic store with hints intrinsics #432
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ toc: true | |
| --- | ||
|
|
||
| <!-- | ||
| SPDX-FileCopyrightText: Copyright 2011-2025 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| SPDX-FileCopyrightText: Copyright 2011-2026 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| SPDX-FileCopyrightText: Copyright 2022 Google LLC. | ||
| CC-BY-SA-4.0 AND Apache-Patent-License | ||
| See LICENSE.md file for details | ||
|
|
@@ -114,7 +114,7 @@ about Arm’s trademarks. | |
|
|
||
| ## Copyright | ||
|
|
||
| * Copyright 2011-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>. | ||
| * Copyright 2011-2026 Arm Limited and/or its affiliates <open-source-office@arm.com>. | ||
| * Copyright 2022 Google LLC. | ||
|
|
||
| ## About this document | ||
|
|
@@ -487,6 +487,7 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin | |
| * Removed all references to Transactional Memory Extension (TME). | ||
| * Added [**Alpha**](#current-status-and-anticipated-changes) support | ||
| for Brain 16-bit floating-point vector multiplication intrinsics. | ||
| * Redesigned atomic store with hints intrinsics. | ||
|
|
||
| ### References | ||
|
|
||
|
|
@@ -4952,33 +4953,38 @@ stored to memory is modified by replacing the low 32 bits of | |
| `value.val[0]` with the contents of the `ACCDATA_EL1` system register. | ||
| The returned value is the same as for `__arm_st64bv`. | ||
|
|
||
| ## Atomic store with PCDPHINT intrinsics | ||
| ## Atomic store with hints intrinsics | ||
|
|
||
| This intrinsic provides an atomic store, which will | ||
| make use of the `STSHH` hint instruction immediately followed by the | ||
| associated store instruction. This intrinsic is type generic and | ||
| supports scalar types from 8-64 bits and is available when | ||
| `__ARM_FEATURE_PCDPHINT` is defined. | ||
| This intrinsic provides an atomic store together with a hint value. | ||
| The hint is a suggestion to the compiler and maps directly to a | ||
| specific hint instruction variant in the ISA. The compiler may use this hint | ||
| when selecting code sequences, but it is not required to emit a specific | ||
| hint instruction or a specific instruction sequence. This intrinsic is | ||
| type generic and supports scalar integer and pointer types of 8, 16, 32, and 64 bits. | ||
|
|
||
| To access this intrinsic, `<arm_acle.h>` should be included. | ||
|
|
||
| ``` c | ||
| void __arm_atomic_store_with_stshh(type *ptr, | ||
| type data, | ||
| int memory_order, | ||
| int ret); /* Retention Policy */ | ||
| void __arm_atomic_store_with_hint(type *ptr, | ||
| type data, | ||
| int memory_order, | ||
| int hint); | ||
| ``` | ||
|
|
||
| The first argument in this intrinsic is a pointer `ptr` which is the location to store to. | ||
| The second argument `data` is the data which is to be stored. | ||
| The third argument `mem` can be one of 3 memory ordering variables supported by atomic_store: | ||
| __ATOMIC_RELAXED, __ATOMIC_SEQ_CST, and __ATOMIC_RELEASE. | ||
| The fourth argument can contain the following values: | ||
| The first argument `ptr` is the location to store to. The second | ||
| argument `data` is the value to be stored. The third argument | ||
| `memory_order` can be one of the memory ordering values supported by | ||
| `atomic_store`: `__ATOMIC_RELAXED`, `__ATOMIC_SEQ_CST`, and | ||
| `__ATOMIC_RELEASE`. | ||
|
|
||
| | **Retention Policy** | **Value** | **Summary** | | ||
| | -------------------- | --------- | --------------------------------------------------------------------------------- | | ||
| | KEEP | 0 | Signals to retain the updated location in the local cache of the updating PE. | | ||
| | STRM | 1 | Signals to not retain the updated location in the local cache of the updating PE. | | ||
| The fourth argument `hint` selects the requested hint. The set of valid | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What will be the behaviour if hint is not valid?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that is undefined behaviour and will be implementation based. For LLVM we will throw error and reject. |
||
| hint values depends on the architectural features supported by the | ||
| target. The following hint values are defined: | ||
|
|
||
| | **Hint** | **Value** | **Feature** | **Summary** | | ||
| | ---------------- | --------- | -------------------------- | --------------------------------------------------------------------------------- | | ||
| | HINT_STSHH_KEEP | 0 | `__ARM_FEATURE_PCDPHINT` | Requests retention of the updated location in the local cache of the updating PE. | | ||
| | HINT_STSHH_STRM | 1 | `__ARM_FEATURE_PCDPHINT` | Requests that the updated location not be retained in the local cache of the updating PE. | | ||
|
Lukacma marked this conversation as resolved.
|
||
|
|
||
| # Custom Datapath Extension | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to list all the possible memory order :
Or the ones you are defining is enough? I am asking because this will be a generic intrinsic now. So I am wondering if all the hint will only need these 3 macros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__ATOMIC_CONSUME and __ATOMIC_ACQUIRE is only for loads. __ATOMIC_ACQ_REL doesn't fit pure store I think and rest are mentioned in spec.