Skip to content

Commit a0c0c94

Browse files
Change the FMV rules so target_clones default versions must be explicitly stated (#377)
This patch requires default versions in target_clones to be explicitly stated. This makes it simple to determine where the dispatcher should be created across translation units, and resolves cases (such as below) where we can end up making multiple dispatchers. // Translation unit 1 __attribute__ ((target_clone("dotprod, sve"))) int foo(); int foo() { return 1; } // Translation unit 2 __attribute__ ((target_clone("dotprod, sve"))) int foo() { return 2; } With the previous specification, my understanding is, the second translation unit would implicitly add a default. Then there would be two implementations of defaults, and so two dispatchers would be created.
1 parent 16545a6 commit a0c0c94

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

main/acle.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin
445445
* Added `svdot[_n_f16_mf8]_fpm` and `svdot[_n_f32_mf8]_fpm`.
446446
* Added Guarded Control Stack (GCS) at
447447
[**Beta**](#current-status-and-anticipated-changes) quality level.
448+
* Changed the Function Multi Versioning default version rules to be more explicit.
448449

449450
### References
450451

@@ -2721,17 +2722,19 @@ The following attributes trigger the multi version code generation:
27212722
type of the default version.
27222723
* All the function versions must be declared at the translation
27232724
unit in which the definition of the default version resides.
2725+
* One `default` version of the function is required to be provided
2726+
in one of the translation units.
2727+
* Implicitly, as a definition without any attribute,
2728+
* as a function annotated with `target_version("default")`,
2729+
* or, as a function annotated with `target_clones(...)` where one
2730+
of the versions is `default`.
27242731

27252732
The attribute `__attribute__((target_version("name")))` expresses the
27262733
following:
27272734

27282735
* When applied to a function it becomes one of the versions.
27292736
* Multiple function versions may exist in the same or in different
27302737
translation units.
2731-
* One `default` version of the function is required to be provided
2732-
in one of the translation units.
2733-
* Implicitly, without this attribute,
2734-
* or explicitly providing the `default` in the attribute.
27352738

27362739
For example, the below is valid and 2 is used as the default
27372740
value for `c` when calling the multiversioned function `f`.
@@ -2758,11 +2761,6 @@ following:
27582761

27592762
* when applied to a function the compiler emits multiple versions
27602763
based on the arguments.
2761-
* One of them is implicitly the `default`.
2762-
* If the `default` matches with another explicitly provided
2763-
version in the same translation unit, then the compiler can
2764-
emit only one function instead of the two. The explicitly
2765-
provided version shall be preferred.
27662764
* If a name is not recognized the compiler should ignore it[^fmv-note-ignore].
27672765

27682766
[^fmv-note-ignore]: The intention is to support the usecase of newer code if

0 commit comments

Comments
 (0)