Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FMV][compiler-rt] Fix cpu features initialization. #95149

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

labrinea
Copy link
Collaborator

To detect features we either use HWCAPs or directly extract system register bitfields and compare with a value. In many cases equality comparisons give wrong results for example FEAT_SVE is not set if SVE2 is available (see the issue #93651). I am also making the access to __aarch64_cpu_features atomic.

The corresponding PR for the ACLE specification is ARM-software/acle#322.

Copy link

github-actions bot commented Jun 11, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

To detect features we either use HWCAPs or directly extract system register
bitfields and compare with a value. In many cases equality comparisons give
wrong results for example FEAT_SVE is not set if SVE2 is available (see the
issue llvm#93651). I am also making the access to __aarch64_cpu_features atomic.

The corresponding PR for the ACLE specification is
ARM-software/acle#322.
@labrinea labrinea force-pushed the fix-cpu-features-initialization branch from 89f59ce to 6c1433f Compare June 11, 2024 17:35
if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED))
return;

__init_cpu_features();
}

__attribute__((target("sve"))) long
__arm_get_current_vg(void) __arm_streaming_compatible {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @aemerson @sdesmalen-arm

can this ever get called before __init_cpu_features()?

Copy link
Contributor

@jroelofs jroelofs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Couple of comments that we can address after it lands.

@labrinea labrinea merged commit 933d6be into llvm:main Jun 13, 2024
6 checks passed
@labrinea labrinea deleted the fix-cpu-features-initialization branch June 13, 2024 10:45
EthanLuisMcDonough pushed a commit to EthanLuisMcDonough/llvm-project that referenced this pull request Aug 13, 2024
To detect features we either use HWCAPs or directly extract system
register bitfields and compare with a value. In many cases equality
comparisons give wrong results for example FEAT_SVE is not set if SVE2
is available (see the issue llvm#93651). I am also making the access to
__aarch64_cpu_features atomic.

The corresponding PR for the ACLE specification is
ARM-software/acle#322.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants