[FFmpeg-cvslog] aarch64: Print the SVE vector length in libavutil/tests/cpu.c
Martin Storsjö
git at videolan.org
Fri Sep 27 00:09:45 EEST 2024
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Dec 5 00:09:07 2023 +0200| [b1ee2af8432e2720009df92f4ee49d98b05dc2ce] | committer: Martin Storsjö
aarch64: Print the SVE vector length in libavutil/tests/cpu.c
This makes this aspect more visible in test logs.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1ee2af8432e2720009df92f4ee49d98b05dc2ce
---
libavutil/aarch64/Makefile | 2 ++
libavutil/aarch64/cpu.h | 4 ++++
libavutil/aarch64/cpu_sve.S | 29 +++++++++++++++++++++++++++++
libavutil/tests/cpu.c | 8 ++++++++
4 files changed, 43 insertions(+)
diff --git a/libavutil/aarch64/Makefile b/libavutil/aarch64/Makefile
index eba0151337..992e95e4df 100644
--- a/libavutil/aarch64/Makefile
+++ b/libavutil/aarch64/Makefile
@@ -4,3 +4,5 @@ OBJS += aarch64/cpu.o \
NEON-OBJS += aarch64/float_dsp_neon.o \
aarch64/tx_float_neon.o \
+
+SVE-OBJS += aarch64/cpu_sve.o \
diff --git a/libavutil/aarch64/cpu.h b/libavutil/aarch64/cpu.h
index df7becca30..a41b729659 100644
--- a/libavutil/aarch64/cpu.h
+++ b/libavutil/aarch64/cpu.h
@@ -30,4 +30,8 @@
#define have_sve(flags) CPUEXT(flags, SVE)
#define have_sve2(flags) CPUEXT(flags, SVE2)
+#if HAVE_SVE
+int ff_aarch64_sve_length(void);
+#endif
+
#endif /* AVUTIL_AARCH64_CPU_H */
diff --git a/libavutil/aarch64/cpu_sve.S b/libavutil/aarch64/cpu_sve.S
new file mode 100644
index 0000000000..d216ed2c49
--- /dev/null
+++ b/libavutil/aarch64/cpu_sve.S
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2023 Martin Storsjo
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "asm.S"
+
+ENABLE_SVE
+
+function ff_aarch64_sve_length, export=1
+ cntb x0
+ ret
+endfunc
diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
index 679b538f0f..abe2b057d7 100644
--- a/libavutil/tests/cpu.c
+++ b/libavutil/tests/cpu.c
@@ -23,6 +23,10 @@
#include "libavutil/cpu.h"
#include "libavutil/avstring.h"
+#if ARCH_AARCH64
+#include "libavutil/aarch64/cpu.h"
+#endif
+
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -161,6 +165,10 @@ int main(int argc, char **argv)
print_cpu_flags(cpu_flags_raw, "raw");
print_cpu_flags(cpu_flags_eff, "effective");
printf("threads = %s (cpu_count = %d)\n", threads, cpu_count);
+#if ARCH_AARCH64
+ if (cpu_flags_raw & AV_CPU_FLAG_SVE)
+ printf("sve_vector_length = %d\n", 8 * ff_aarch64_sve_length());
+#endif
return 0;
}
More information about the ffmpeg-cvslog
mailing list