Open BeMg opened 7 months ago
You've gone down the route of 2, which makes sense to me.
One thing you've glossed over is part of the third stage: each function version is for a specific set of features, but nothing requires that each set of features is a strict super-/sub-set of those for other versions of the same function. Does it matter that there's not a defined order for choosing between the two sets?
For example:
f
just has I
, no extensions.x
is for when you have I
and the C
extension.x
is for when you have I
and the F
extension.I
, C
and F
- which version of x
do you choose?Maybe it's fine to leave it undefined? Maybe it's fine to be reasonably nondeterministic? I'm not sure. What do you think?
When generating the resolver function for function multiversioning, a mechanism is needed to retrieve the environment information.
To achieve this goal, several steps need to be taken:
Step 1 is handled by the compiler, while step 3 must follow the necessary steps from the platform during runtime.
This RFC aims to propose how the compiler and runtime function can tackle problem 2.
Here is a example
In this example, there are two versions of function
bar
. One for default, another for "rv64gcv".If environment fullfills the requirement, then
bar
could use the versionarch=rv64gcv
. Otherwise, It invokes withdefault
version.This process be controlled by the
ifunc
resolver function.The version
arch=rv64gcv
requireThe problem 2 is about where to maintain the relationship between extension names and platform-dependent probe forms.
Here are three possible approach to achieve goal.