You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `priority` accepts a digit as the version priority during [Version Selection](#version-selection). If `priority` isn't specified, then the priority of version defaults to zero.
379
+
365
380
It makes the compiler trigger the <<function-multi-version, function multi-version>>,
366
381
when there exist more than one version for the same function signature.
367
382
@@ -376,38 +391,19 @@ function. If there is more than one version for the same function, it
376
391
must have `default` one that indicating the translation unit scope build
377
392
attributes.
378
393
379
-
The syntax of `<TARGET-VERSION-ATTR-STRING>` describes below:
380
-
381
-
[source, C]
382
-
----
383
-
TARGET-VERSION-ATTR-STRING := 'arch=' EXTENSIONS
384
-
| 'default'
385
-
386
-
EXTENSIONS := <EXTENSION> ',' <EXTENSIONS>
387
-
| <EXTENSION>
388
-
389
-
EXTENSION := <OP> <EXTENSION-NAME> <VERSION>
390
-
391
-
OP := '+'
392
-
393
-
VERSION := [0-9]+ 'p' [0-9]+
394
-
| [1-9][0-9]*
395
-
|
396
-
397
-
EXTENSION-NAME := Naming rule is defined in RISC-V ISA manual
398
-
----
394
+
The syntax of `<TARGET-VERSION-ATTR-STRING>` is the same as described above for `<TARGET-CLONES-ATTR-STRING>`.
399
395
400
396
For example, the following foo function has three versions.
The `priority` accepts a digit as the version priority during [Version Selection](#version-selection). If `priority` isn't specified, then the priority of version defaults to zero.
425
+
426
+
The `default` version does not accept the priority.
427
+
428
428
It makes the compiler trigger the <<function-multi-version, function multi-version>>
429
429
when there exist more than one version for the same function signature.
430
430
@@ -946,3 +946,17 @@ Each queryable extension must have an associated `groupid` and `bitmask` that in
946
946
| zcmop | 1 | 6
947
947
| zawrs | 1 | 7
948
948
|====
949
+
950
+
=== Version Selection
951
+
952
+
The process of selecting the appropriate function version during function multi-versioning follows these guidelines:
953
+
954
+
1. The implementation of the selection algorithm is implementation-specific.
955
+
2. Once a version is selected, it remains in use for the entire duration of the process.
956
+
3. Only versions whose required features are all available in the runtime environment are eligible for selection.
957
+
958
+
The version selection process applies the following rules in order:
959
+
960
+
1. Among the eligible versions, select the one with the highest priority.
961
+
2. If multiple versions have equal priority, select one based on an implementation-defined heuristic.
962
+
3. If no other suitable versions are found, fall back to the "default" version.
0 commit comments