Skip to content

Commit 8b29d2e

Browse files
committed
implement SVE/SVE2 and list out the missing feature flags
1 parent 877328f commit 8b29d2e

File tree

2 files changed

+32
-15
lines changed

2 files changed

+32
-15
lines changed

src/arm/windows/init.c

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,30 @@ static void set_cpuinfo_isa_fields(void) {
195195
const bool dotprod = IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) != 0;
196196
cpuinfo_isa.dot = dotprod;
197197

198-
SYSTEM_INFO system_info;
199-
GetSystemInfo(&system_info);
200-
switch (system_info.wProcessorLevel) {
201-
case 0x803: // Kryo 385 Silver (Snapdragon 850)
202-
cpuinfo_isa.fp16arith = dotprod;
203-
cpuinfo_isa.rdm = dotprod;
204-
break;
205-
default:
206-
// Assume that Dot Product support implies FP16
207-
// arithmetics and RDM support. ARM manuals don't
208-
// guarantee that, but it holds in practice.
209-
cpuinfo_isa.fp16arith = dotprod;
210-
cpuinfo_isa.rdm = dotprod;
211-
break;
212-
}
198+
cpuinfo_isa.sve = IsProcessorFeaturePresent(PF_ARM_SVE_INSTRUCTIONS_AVAILABLE) != 0;
199+
cpuinfo_isa.sve2 = IsProcessorFeaturePresent(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE) != 0;
200+
201+
// TODO:
202+
// - i8mm
203+
// - jscvt
204+
// - fcma
205+
// - sme
206+
// - sme2
207+
// - sme2p1
208+
// - sme_i16i32
209+
// - sme_bi32i32
210+
// - sme_b16b16
211+
// - sme_f16f16
212+
// - bf16
213+
// - fhm
214+
// - svelen
215+
// - smelen
216+
217+
// Assume that Dot Product support implies FP16
218+
// arithmetics and RDM support. ARM manuals don't
219+
// guarantee that, but it holds in practice.
220+
cpuinfo_isa.fp16arith = dotprod;
221+
cpuinfo_isa.rdm = dotprod;
213222

214223
/* Windows API reports all or nothing for cryptographic instructions. */
215224
const bool crypto = IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) != 0;

src/arm/windows/windows-arm-init.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ struct woa_chip_info {
1919
};
2020

2121
bool cpu_info_init_by_logical_sys_info(const struct woa_chip_info* chip_info, enum cpuinfo_vendor vendor);
22+
23+
#ifndef PF_ARM_SVE_INSTRUCTIONS_AVAILABLE
24+
#define PF_ARM_SVE_INSTRUCTIONS_AVAILABLE (46)
25+
#endif
26+
27+
#ifndef PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE
28+
#define PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE (47)
29+
#endif

0 commit comments

Comments
 (0)