acle icon indicating copy to clipboard operation
acle copied to clipboard

[FMV] Change the __HAVE_FUNCTION_MULTI_VERSIONING value.

Open DanielKristofKiss opened this issue 1 year ago • 7 comments

Checklist: (mark with X those which apply)

  • [ ] If an issue reporting the bug exists, I have mentioned it in the PR (do not bother creating the issue if all you want to do is fixing the bug yourself).
  • [ ] I have added/updated the SPDX-FileCopyrightText lines on top of any file I have edited. Format is SPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}> (Please update existing copyright lines if applicable. You can specify year ranges with hyphen , as in 2017-2019, and use commas to separate gaps, as in 2018-2020, 2022).
  • [ ] I have updated the Copyright section of the sources of the specification I have edited (this will show up in the text rendered in the PDF and other output format supported). The format is the same described in the previous item.
  • [x] I have run the CI scripts (if applicable, as they might be tricky to set up on non-*nix machines). The sequence can be found in the contribution guidelines. Don't worry if you cannot run these scripts on your machine, your patch will be automatically checked in the Actions of the pull request.
  • [x] I have added an item that describes the changes I have introduced in this PR in the section Changes for next release of the section Change Control/Document history of the document. Create Changes for next release if it does not exist. Notice that changes that are not modifying the content and rendering of the specifications (both HTML and PDF) do not need to be listed.
  • [x] When modifying content and/or its rendering, I have checked the correctness of the result in the PDF output (please refer to the instructions on how to build the PDFs locally).
  • [ ] The variable draftversion is set to true in the YAML header of the sources of the specifications I have modified.
  • [ ] Please DO NOT add my GitHub profile to the list of contributors in the README page of the project.

DanielKristofKiss avatar Feb 23 '24 15:02 DanielKristofKiss

cc: @ilinpv @jroelofs @andrewcarlotti

DanielKristofKiss avatar Feb 23 '24 15:02 DanielKristofKiss

Looks reasonable to me.

ilinpv avatar Feb 23 '24 15:02 ilinpv

Ditto. Thank you!

jroelofs avatar Feb 23 '24 16:02 jroelofs

Hi @DanielKristofKiss , can you please give more context to this change? Why is it necessary?

vhscampos avatar Feb 26 '24 13:02 vhscampos

Hi @vhscampos, One of the reasons: https://github.com/llvm/llvm-project/issues/79659

If the macro reports the version then a program code could check the support level. Later if we introduce new features to the spec then we would have a way to detect it. Also make easier to check feature level support to ( .e.g. arch FeatureX only introduced in 2025 release of ACLE )

DanielKristofKiss avatar Feb 26 '24 13:02 DanielKristofKiss

I'm not sure this is a good idea. __HAVE_FUNCTION_MULTI_VERSIONING is a name that reflects a binary choice. Even having it as a bitmask would be a stretch (the previously suggested approach in https://github.com/llvm/llvm-project/issues/79659).

If we want to gate things behing conditions such as this: #if __HAVE_FUNCTION_MULTI_VERSIONING >= __ARM_ACLE_VERSION(2024, 1, 0 ) Then we should just use directly: #if __ARM_ACLE >= __ARM_ACLE_VERSION(2024, 1, 0 )

vhscampos avatar Feb 26 '24 14:02 vhscampos

I am not sure that using __ARM_ACLE >= __ARM_ACLE_VERSION(2024, 1, 0 ) directly solves the problem that I have:

the presence of compilers in the wild that claim to but don't actually support [FMV] means we don't have a great way to gate usage of this feature via the preprocessor.

For context, in clang, support for FMV depends on:

  • platform support for IFuncs, or an equivalent lowering (which isn't implemented for all platforms)
  • libcompiler_rt being the runtime library

which are both orthogonal to the implemented ACLE version.

jroelofs avatar Feb 26 '24 23:02 jroelofs

Sorry for the long delay. I had some discussions internally but the outcome got lost in the process.

I reckon that __HAVE_FUNCTION_MULTI_VERSIONING is a macro whose value should remain a boolean. Its name has the explicit meaning of a boolean piece of information.

For the purpose intended in this change, I recommend that a new macro is created with a name similar to __MULTI_VERSIONING_SUPPORT_LEVEL, with a value derived from the relevant ACLE version:

#define __MULTI_VERSIONING_SUPPORT_LEVEL __ARM_ACLE_VERSION(2024, 1, 0)

vhscampos avatar Aug 05 '24 08:08 vhscampos

works for me

jroelofs avatar Aug 05 '24 18:08 jroelofs

@labrinea Can you please review this as well once you're able to?

vhscampos avatar Aug 07 '24 09:08 vhscampos

Lgtm

labrinea avatar Aug 07 '24 10:08 labrinea