* [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
@ 2023-12-15 20:52 Martin Storsjö
2023-12-17 8:37 ` Rémi Denis-Courmont
0 siblings, 1 reply; 4+ messages in thread
From: Martin Storsjö @ 2023-12-15 20:52 UTC (permalink / raw)
To: ffmpeg-devel
The names of the cpu flags, when parsed from a string with
av_parse_cpu_caps, are parsed by the libavutil eval functions. These
interpret dashes as subtractions. Therefore, these previous cpu flag
names haven't been possible to set.
Use the official names for these extensions, as the previous ad-hoc
names wasn't parseable.
libavutil/tests/cpu tests that the cpu flags can be set, and prints
the detected flags.
---
libavutil/cpu.c | 12 ++++++------
libavutil/tests/cpu.c | 10 ++++++++++
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 1e0607d581..f04068acda 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
{ "rvi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI }, .unit = "flags" },
{ "rvf", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVF }, .unit = "flags" },
{ "rvd", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD }, .unit = "flags" },
- { "rvv-i32", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 }, .unit = "flags" },
- { "rvv-f32", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags" },
- { "rvv-i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 }, .unit = "flags" },
- { "rvv", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags" },
- { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" },
- { "rvb-basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags" },
+ { "zve32x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 }, .unit = "flags" },
+ { "zve32f", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags" },
+ { "zve64x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 }, .unit = "flags" },
+ { "zve64f", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags" },
+ { "zba", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" },
+ { "zbb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags" },
#endif
{ NULL },
};
diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
index 200f20388a..6b27bcdbad 100644
--- a/libavutil/tests/cpu.c
+++ b/libavutil/tests/cpu.c
@@ -84,6 +84,16 @@ static const struct {
#elif ARCH_LOONGARCH
{ AV_CPU_FLAG_LSX, "lsx" },
{ AV_CPU_FLAG_LASX, "lasx" },
+#elif ARCH_RISCV
+ { AV_CPU_FLAG_RVI, "rvi" },
+ { AV_CPU_FLAG_RVF, "rvf" },
+ { AV_CPU_FLAG_RVD, "rvd" },
+ { AV_CPU_FLAG_RVB_ADDR, "zba" },
+ { AV_CPU_FLAG_RVB_BASIC, "zbb" },
+ { AV_CPU_FLAG_RVV_I32, "zve32x" },
+ { AV_CPU_FLAG_RVV_F32, "zve32f" },
+ { AV_CPU_FLAG_RVV_I64, "zve64x" },
+ { AV_CPU_FLAG_RVV_F64, "zve64f" },
#endif
{ 0 }
};
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
2023-12-15 20:52 [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu Martin Storsjö
@ 2023-12-17 8:37 ` Rémi Denis-Courmont
2023-12-17 9:11 ` Martin Storsjö
0 siblings, 1 reply; 4+ messages in thread
From: Rémi Denis-Courmont @ 2023-12-17 8:37 UTC (permalink / raw)
To: ffmpeg-devel
Le perjantaina 15. joulukuuta 2023, 22.52.51 EET Martin Storsjö a écrit :
> The names of the cpu flags, when parsed from a string with
> av_parse_cpu_caps, are parsed by the libavutil eval functions. These
> interpret dashes as subtractions. Therefore, these previous cpu flag
> names haven't been possible to set.
>
> Use the official names for these extensions, as the previous ad-hoc
> names wasn't parseable.
>
> libavutil/tests/cpu tests that the cpu flags can be set, and prints
> the detected flags.
> ---
> libavutil/cpu.c | 12 ++++++------
> libavutil/tests/cpu.c | 10 ++++++++++
> 2 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
> index 1e0607d581..f04068acda 100644
> --- a/libavutil/cpu.c
> +++ b/libavutil/cpu.c
> @@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
> { "rvi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI
> }, .unit = "flags" }, { "rvf", NULL, 0, AV_OPT_TYPE_CONST, {
> .i64 = AV_CPU_FLAG_RVF }, .unit = "flags" }, { "rvd", NULL, 0,
> AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD }, .unit = "flags" }, -
> { "rvv-i32", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, - { "rvv-f32", NULL,
> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags"
> }, - { "rvv-i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> AV_CPU_FLAG_RVV_I64 }, .unit = "flags" }, - { "rvv", NULL,
> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags"
> }, - { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, - { "rvb-basic",NULL,
> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags"
> }, + { "zve32x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, + { "zve32f", NULL,
> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags"
> }, + { "zve64x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> AV_CPU_FLAG_RVV_I64 }, .unit = "flags" },
> + { "zve64f", NULL,
> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags"
That's Zve64d. Or V though strictly speaking V also implies a vector length of
at least 128 bits, while Zve64d only implies 64 bits.
> }, + { "zba", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, + { "zbb", NULL,
> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags"
> }, #endif
> { NULL },
> };
> diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c
> index 200f20388a..6b27bcdbad 100644
> --- a/libavutil/tests/cpu.c
> +++ b/libavutil/tests/cpu.c
> @@ -84,6 +84,16 @@ static const struct {
> #elif ARCH_LOONGARCH
> { AV_CPU_FLAG_LSX, "lsx" },
> { AV_CPU_FLAG_LASX, "lasx" },
> +#elif ARCH_RISCV
> + { AV_CPU_FLAG_RVI, "rvi" },
> + { AV_CPU_FLAG_RVF, "rvf" },
> + { AV_CPU_FLAG_RVD, "rvd" },
> + { AV_CPU_FLAG_RVB_ADDR, "zba" },
> + { AV_CPU_FLAG_RVB_BASIC, "zbb" },
> + { AV_CPU_FLAG_RVV_I32, "zve32x" },
> + { AV_CPU_FLAG_RVV_F32, "zve32f" },
> + { AV_CPU_FLAG_RVV_I64, "zve64x" },
> + { AV_CPU_FLAG_RVV_F64, "zve64f" },
> #endif
> { 0 }
> };
--
レミ・デニ-クールモン
http://www.remlab.net/
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
2023-12-17 8:37 ` Rémi Denis-Courmont
@ 2023-12-17 9:11 ` Martin Storsjö
2023-12-17 9:27 ` Rémi Denis-Courmont
0 siblings, 1 reply; 4+ messages in thread
From: Martin Storsjö @ 2023-12-17 9:11 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sun, 17 Dec 2023, Rémi Denis-Courmont wrote:
> Le perjantaina 15. joulukuuta 2023, 22.52.51 EET Martin Storsjö a écrit :
>> The names of the cpu flags, when parsed from a string with
>> av_parse_cpu_caps, are parsed by the libavutil eval functions. These
>> interpret dashes as subtractions. Therefore, these previous cpu flag
>> names haven't been possible to set.
>>
>> Use the official names for these extensions, as the previous ad-hoc
>> names wasn't parseable.
>>
>> libavutil/tests/cpu tests that the cpu flags can be set, and prints
>> the detected flags.
>> ---
>> libavutil/cpu.c | 12 ++++++------
>> libavutil/tests/cpu.c | 10 ++++++++++
>> 2 files changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
>> index 1e0607d581..f04068acda 100644
>> --- a/libavutil/cpu.c
>> +++ b/libavutil/cpu.c
>> @@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
>> { "rvi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI
>> }, .unit = "flags" }, { "rvf", NULL, 0, AV_OPT_TYPE_CONST, {
>> .i64 = AV_CPU_FLAG_RVF }, .unit = "flags" }, { "rvd", NULL, 0,
>> AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD }, .unit = "flags" }, -
>> { "rvv-i32", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
>> AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, - { "rvv-f32", NULL,
>> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags"
>> }, - { "rvv-i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
>> AV_CPU_FLAG_RVV_I64 }, .unit = "flags" }, - { "rvv", NULL,
>> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags"
>> }, - { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
>> AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, - { "rvb-basic",NULL,
>> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags"
>> }, + { "zve32x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
>> AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, + { "zve32f", NULL,
>> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags"
>> }, + { "zve64x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
>> AV_CPU_FLAG_RVV_I64 }, .unit = "flags" },
>> + { "zve64f", NULL,
>> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags"
>
> That's Zve64d. Or V though strictly speaking V also implies a vector length of
> at least 128 bits, while Zve64d only implies 64 bits.
Oh, right. But we'd use it lowercased here, as "zve64d", as that's what we
use with the function macros and with .option arch, +<foo>, right?
Using the single-letter forms here for cpu flags would probably feel a bit
obscure... Is there some similar names like these, that would be used for
.option arch, for what we call rvi/rvf/rvd above?
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
2023-12-17 9:11 ` Martin Storsjö
@ 2023-12-17 9:27 ` Rémi Denis-Courmont
0 siblings, 0 replies; 4+ messages in thread
From: Rémi Denis-Courmont @ 2023-12-17 9:27 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Le sunnuntaina 17. joulukuuta 2023, 11.11.30 EET Martin Storsjö a écrit :
> >> AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, - { "rvv-f32",
> >> NULL,
> >> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags"
> >> }, - { "rvv-i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> >> AV_CPU_FLAG_RVV_I64 }, .unit = "flags" }, - { "rvv",
> >> NULL,
> >> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags"
> >> }, - { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> >> AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, - { "rvb-basic",NULL,
> >> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags"
> >> }, + { "zve32x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> >> AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, + { "zve32f",
> >> NULL,
> >> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags"
> >> }, + { "zve64x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> >> AV_CPU_FLAG_RVV_I64 }, .unit = "flags" },
> >> + { "zve64f", NULL,
> >> 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags"
> >
> > That's Zve64d. Or V though strictly speaking V also implies a vector
> > length of at least 128 bits, while Zve64d only implies 64 bits.
>
> Oh, right. But we'd use it lowercased here, as "zve64d", as that's what we
> use with the function macros and with .option arch, +<foo>, right?
`.option arch` wants lower case names.
> Using the single-letter forms here for cpu flags would probably feel a bit
> obscure...
> Is there some similar names like these, that would be used for
> .option arch, for what we call rvi/rvf/rvd above?
I is the base Integer set, not an extension. F and D mean Float and Double,
but I don't think that they have formal names. They only exists because
checkasm wants flags for everything. You're not supposed to check those at run-
time.
Also D is not used for anything. I don't know how feasible it would be to
rework the C versions of pixblockdsp and audiodsp to purge I and F.
--
Rémi Denis-Courmont
http://www.remlab.net/
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-17 9:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15 20:52 [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu Martin Storsjö
2023-12-17 8:37 ` Rémi Denis-Courmont
2023-12-17 9:11 ` Martin Storsjö
2023-12-17 9:27 ` Rémi Denis-Courmont
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git