aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2024-04-26 11:29:29 +0300
committerMartin Storsjö <martin@martin.st>2024-04-26 15:09:19 +0000
commit236e1d19125c41c5bd978bd55838a74611448cba (patch)
treee27266daf540065f09b1ba3d35937830af1770d4
parent1776c45a087845efad28e893ce4414a2a91786a3 (diff)
downloadlibdav1d-236e1d19125c41c5bd978bd55838a74611448cba.tar.gz
tools: Make ARM cpu flags imply relevant lower level flags
The --cpumask flag only takes one single flag name, one can't set a combination like neon+dotprod. Therefore, apply the same pattern as for x86, by adding mask values that contain all the implied lower level flags. This is somewhat complicated, as the set of features isn't entirely linear - in particular, SVE doesn't imply either dotprod or i8mm, and SVE2 only implies dotprod, but not i8mm. This makes sure that "dav1d --cpumask dotprod" actually uses any SIMD at all, as it previously only set the dotprod flag but not neon, which essentially opted out from all SIMD.
-rw-r--r--tools/dav1d_cli_parse.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/dav1d_cli_parse.c b/tools/dav1d_cli_parse.c
index 0b18ec7..9e51c94 100644
--- a/tools/dav1d_cli_parse.c
+++ b/tools/dav1d_cli_parse.c
@@ -215,16 +215,28 @@ enum CpuMask {
X86_CPU_MASK_AVX2 = DAV1D_X86_CPU_FLAG_AVX2 | X86_CPU_MASK_SSE41,
X86_CPU_MASK_AVX512ICL = DAV1D_X86_CPU_FLAG_AVX512ICL | X86_CPU_MASK_AVX2,
};
+#elif ARCH_AARCH64 || ARCH_ARM
+enum CpuMask {
+ ARM_CPU_MASK_NEON = DAV1D_ARM_CPU_FLAG_NEON,
+ ARM_CPU_MASK_DOTPROD = DAV1D_ARM_CPU_FLAG_DOTPROD | ARM_CPU_MASK_NEON,
+ ARM_CPU_MASK_I8MM = DAV1D_ARM_CPU_FLAG_I8MM | ARM_CPU_MASK_DOTPROD,
+#if ARCH_AARCH64
+ // SVE doesn't imply DOTPROD or I8MM.
+ ARM_CPU_MASK_SVE = DAV1D_ARM_CPU_FLAG_SVE | ARM_CPU_MASK_NEON,
+ // SVE2 implies DOTPROD, but not I8MM.
+ ARM_CPU_MASK_SVE2 = DAV1D_ARM_CPU_FLAG_SVE2 | ARM_CPU_MASK_SVE | ARM_CPU_MASK_DOTPROD,
+#endif
+};
#endif
static const EnumParseTable cpu_mask_tbl[] = {
#if ARCH_AARCH64 || ARCH_ARM
- { "neon", DAV1D_ARM_CPU_FLAG_NEON },
- { "dotprod", DAV1D_ARM_CPU_FLAG_DOTPROD },
- { "i8mm", DAV1D_ARM_CPU_FLAG_I8MM },
+ { "neon", ARM_CPU_MASK_NEON },
+ { "dotprod", ARM_CPU_MASK_DOTPROD },
+ { "i8mm", ARM_CPU_MASK_I8MM },
#if ARCH_AARCH64
- { "sve", DAV1D_ARM_CPU_FLAG_SVE },
- { "sve2", DAV1D_ARM_CPU_FLAG_SVE2 },
+ { "sve", ARM_CPU_MASK_SVE },
+ { "sve2", ARM_CPU_MASK_SVE2 },
#endif /* ARCH_AARCH64 */
#elif ARCH_LOONGARCH
{ "lsx", DAV1D_LOONGARCH_CPU_FLAG_LSX },