-
Notifications
You must be signed in to change notification settings - Fork 72
Add FMV priority syntax #404
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
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -446,6 +446,7 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin | |
| * Added `svdot[_n_f16_mf8]_fpm` and `svdot[_n_f32_mf8]_fpm`. | ||
| * Added Guarded Control Stack (GCS) at | ||
| [**Beta**](#current-status-and-anticipated-changes) quality level. | ||
| * Add Function Multi Versioning feature priority syntax. | ||
|
|
||
| #### Changes between ACLE Q4 2024 and ACLE Q2 2025 | ||
|
|
||
|
|
@@ -2755,8 +2756,8 @@ function may be in the final binary. The compiler generates all | |
| supported versions and the runtime makes the selection at load time. | ||
|
|
||
| The following attributes trigger the multi version code generation: | ||
| `__attribute__((target_version("name")))` and | ||
| `__attribute__((target_clones("name",...)))`. | ||
| `__attribute__((target_version("<target version string>")))` and | ||
| `__attribute__((target_clones("<target version string>",...)))`. | ||
|
|
||
| * Functions are allowed to have the same name and signature when | ||
| annotated with these attributes. | ||
|
|
@@ -2765,7 +2766,6 @@ The following attributes trigger the multi version code generation: | |
| section. | ||
| * The `default` version means the version of the function that would | ||
| be generated without these attributes. | ||
| * The dependent features could be joined by the `+` sign. | ||
| * None of these attributes enable the corresponding ACLE feature(s) | ||
| associated to the `name` expressed in the attribute. | ||
| * These attributes have no effect on the calling convention. | ||
|
|
@@ -2789,7 +2789,7 @@ The following attributes trigger the multi version code generation: | |
| * or, as a function annotated with `target_clones(...)` where one | ||
| of the versions is `default`. | ||
|
|
||
| The attribute `__attribute__((target_version("name")))` expresses the | ||
| The attribute `__attribute__((target_version("<target version string>")))` expresses the | ||
| following: | ||
|
|
||
| * When applied to a function it becomes one of the versions. | ||
|
|
@@ -2816,7 +2816,7 @@ int f (int c = 1); | |
| int __attribute__((target_version("default"))) f (int c = 2); | ||
| ``` | ||
|
|
||
| The attribute `__attribute__((target_clones("name",...)))` expresses the | ||
| The attribute `__attribute__((target_clones("<target version string>",...)))` expresses the | ||
| following: | ||
|
|
||
| * when applied to a function the compiler emits multiple versions | ||
|
|
@@ -2841,6 +2841,32 @@ For example, it can be implemented as: | |
| #define __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL __ARM_ACLE_VERSION(2024, 3, 0) | ||
| ``` | ||
|
|
||
| ### Target version strings | ||
|
|
||
| A target version string is of the following form: | ||
|
AlfieRichardsArm marked this conversation as resolved.
Outdated
|
||
|
|
||
| ``` | ||
| <target version string> := 'default' | ||
| | <version string> | ||
| <version string> := <priority string> ';' <arch strings> | ||
| | <arch strings> | ||
|
AlfieRichardsArm marked this conversation as resolved.
|
||
| <priority string> := 'priority=[1-31]' | ||
|
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. @jroelofs with llvm/llvm-project#150079 we have plenty of room to go beyond 5 bits of priority. Any preference?
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. I personally find 6 bits the maximum sensible, but I am also happy with 5 or less.
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. ping |
||
| <arch strings> := <arch strings> '+' arch extension | ||
| | arch extension | ||
| ``` | ||
|
|
||
| where `arch extension` is any Names value from the Mapping table below. | ||
|
|
||
| Valid string examples are given below | ||
|
|
||
| ``` | ||
| default | ||
| dotprod | ||
| dotprod+flagm | ||
| priority=5;sve | ||
| priority=23;sve2+sme2 | ||
|
AlfieRichardsArm marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ### Name mangling | ||
|
|
||
| The `"default"` version is mangled with `".default"` on top of the | ||
|
|
@@ -2857,6 +2883,8 @@ the [[cxxabi]](#cxxabi), and it is defined as follows: | |
| <vendor specific suffix> := `_` followed by token obtained from the tables below and prefixed with `M` | ||
| ``` | ||
|
|
||
| Note, priority values do not affect mangling. | ||
|
AlfieRichardsArm marked this conversation as resolved.
Outdated
|
||
|
|
||
| If multiple features are requested then those shall be appended in lexicographic | ||
| order and prefixed with `M`. The mangled name shall contain a unique set of | ||
| features (duplication of features is not allowed). | ||
|
|
@@ -2990,11 +3018,19 @@ the selection algorithm is platform dependent, where with platform means | |
| CPU/Vendor/OS as in the target triplet. | ||
| 2. The selection is permanent for the | ||
| lifetime of the process. | ||
| 3. Among any two versions, the higher priority version is determined by | ||
| identifying the highest priority feature that is specified in exactly one of | ||
| the versions, and selecting that version. | ||
| 4. The selection algorithm must select the highest priority versions whose | ||
| dependent features are all available. | ||
| 3. The selection algorithm must select the the highest precedence | ||
|
AlfieRichardsArm marked this conversation as resolved.
Outdated
|
||
| version whose dependent features are all available. | ||
|
|
||
| The precedence for two target version strings is determined by: | ||
|
|
||
| 1. If both target version strings specify a `priority`, with different values, | ||
| then the version with the higher `priority` has precedence. | ||
|
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. @jroelofs if I read your comment #371 (comment) correctly you'd also prefer
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. ping |
||
| 2. If only one target version strings specify a `priority`, this version has | ||
|
AlfieRichardsArm marked this conversation as resolved.
Outdated
|
||
| precedence. | ||
| 3. Otherwise, if neither target version strings specify a `priority` or specify | ||
|
AlfieRichardsArm marked this conversation as resolved.
Outdated
|
||
| the same value, then precedence is decided by identifying the highest priority | ||
| feature that is specified in exactly one of the versions, and selecting that | ||
| version. | ||
|
|
||
| ## Weak linkage | ||
|
|
||
|
|
||
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.
Change to Added
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.
Thanks Sally. I'm going to fix this.