Skip to content

Commit

Permalink
Add sme/sme2 detection to mach/init.c.
Browse files Browse the repository at this point in the history
I forgot to add this for `mach` when I did it for `linux` a while back (pytorch#262).

I could not find `hw.optional.arm.FEAT_SME_*` features for all the `sme`-related bits in `cpuinfo_arm_isa`, but I've added the ones I could find.
  • Loading branch information
gonnet authored Oct 22, 2024
1 parent 1e83a2f commit 973ec72
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/arm/mach/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,31 @@ void cpuinfo_arm_mach_init(void) {
cpuinfo_isa.i8mm = true;
}

const uint32_t has_feat_sme = get_sys_info_by_name("hw.optional.arm.FEAT_SME");
if (has_feat_sme != 0) {
cpuinfo_isa.sme = true;
}

const uint32_t has_feat_sme2 = get_sys_info_by_name("hw.optional.arm.FEAT_SME2");
if (has_feat_sme2 != 0) {
cpuinfo_isa.sme2 = true;
}

const uint32_t has_feat_sme2p1 = get_sys_info_by_name("hw.optional.arm.FEAT_SME2p1");
if (has_feat_sme2p1 != 0) {
cpuinfo_isa.sme2p1 = true;
}

const uint32_t has_feat_sme_b16b16 = get_sys_info_by_name("hw.optional.arm.FEAT_SME_B16B16");
if (has_feat_sme_b16b16 != 0) {
cpuinfo_isa.sme_b16b16 = true;
}

const uint32_t has_feat_sme_f16f16 = get_sys_info_by_name("hw.optional.arm.FEAT_SME_F16F16");
if (has_feat_sme_f16f16 != 0) {
cpuinfo_isa.sme_f16f16 = true;
}

uint32_t num_clusters = 1;
for (uint32_t i = 0; i < mach_topology.cores; i++) {
cores[i] = (struct cpuinfo_core){
Expand Down

0 comments on commit 973ec72

Please sign in to comment.