The following preprocessor macros are implied when -march=armv8.6a+sve:
__ARM_FEATURE_SVE 1 __ARM_FEATURE_SVE_BF16 1 __ARM_FEATURE_SVE_MATMUL_FP32 1 __ARM_FEATURE_SVE_MATMUL_INT8 1
Differential D83079
[clang][aarch64] Generate preprocessor macros for -march=armv8.6a+sve. fpetrogalli on Jul 2 2020, 12:58 PM. Authored by
Details The following preprocessor macros are implied when -march=armv8.6a+sve: __ARM_FEATURE_SVE 1 __ARM_FEATURE_SVE_BF16 1 __ARM_FEATURE_SVE_MATMUL_FP32 1 __ARM_FEATURE_SVE_MATMUL_INT8 1
Diff Detail
Event Timeline
Comment Actions I haven't looked into details of these arch extensions yet, will do that tomorrow, but I don't think there's any disagreement, i.e., these options and their behaviour are synchronised with the GCC community. Thus, it's better if you remove this wording from both description and comments in the source code. If there is divergence in behaviour, then that is probably be an oversight somewhere. I am also pretty sure that this 8.5 stuff is implemented, not sure if that is upstreamed. And also, I think we need to be more specific than "Default target features implied by -march on AArch64", because this is a big topic, which is not addressed in this patch. This patch is only about a few architecture extension. I am also for example surprised to see bfloat there, as I saw quite some activity in this area. Comment Actions I @SjoerdMeijer - I think I misinterpreted the way the target feature are generated, and which part of the codebase handles that. I wasn't aware about the common code pointed out by @sdesmalen that was translating architecture version into target feature - I thought everything needed to be translated by the driver into a list of -target-feature, that is why I thought there was discrepancy. If there is any, this patch is probably not the right way to fix it. The best thing to do is abandon this patch.
Comment Actions Update the patch to limit its scope to generate the feature macros for -march=armv8.6a+sve.
Comment Actions Addressed code review, moving the code and adding more testing, including the v8.5 one.
Comment Actions @sdesmalen, I have followed your suggestion to use insert instead of push_back! Code is much nicer now, thanks!
Comment Actions LGTM again!
|
Looking at what Clang emits for e.g. -march=armv8.5-a, it just adds a target-feature +v8.5a. The definitions in llvm/lib/Target/AArch64/AArch64.td. suggests that LLVM is already able to infer all supported features from that. e.g.
So I don't think you necessarily have to decompose the architecture version into target-features in the Clang driver as well. For Clang it matters that the right set of feature macros are defined so that the ACLE header file exposes the correct set of functions for the given architecture version. At least for the SVE ACLE that is just a small handful of features.