Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] riscv: fix scalar product initialisation
@ 2022-10-03 15:06 remi
  2022-10-12 17:04 ` Rémi Denis-Courmont
  0 siblings, 1 reply; 2+ messages in thread
From: remi @ 2022-10-03 15:06 UTC (permalink / raw)
  To: ffmpeg-devel

From: Rémi Denis-Courmont <remi@remlab.net>

VSETVLI xd, x0, ...' has rather nonobvious semantics:
- If xd is x0, then it preserves the current vector length.
- If xd is not x0, it sets the vector length to the supported maximum.

Also somewhat confusingly, while VMV.X.S always does its thing
regardless of the selected vector length, VMV.S.X does _nothing_ if the
selected vector length is zero.

So the current code breaks fails to initialise the accumulator if we
are unlucky to have a selected vector length of zero on entry. Fix it
by forcing the vector length to one.
---
 libavcodec/riscv/audiodsp_rvv.S | 2 +-
 libavutil/riscv/float_dsp_rvv.S | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/riscv/audiodsp_rvv.S b/libavcodec/riscv/audiodsp_rvv.S
index f4308f27c5..8e8bbd2058 100644
--- a/libavcodec/riscv/audiodsp_rvv.S
+++ b/libavcodec/riscv/audiodsp_rvv.S
@@ -21,7 +21,7 @@
 #include "libavutil/riscv/asm.S"
 
 func ff_scalarproduct_int16_rvv, zve32x
-        vsetvli     zero, zero, e16, m1, ta, ma
+        vsetivli    zero, 1, e16, m1, ta, ma
         vmv.s.x     v8, zero
 1:
         vsetvli     t0, a2, e16, m1, ta, ma
diff --git a/libavutil/riscv/float_dsp_rvv.S b/libavutil/riscv/float_dsp_rvv.S
index ab2e0c42d7..e105f2d574 100644
--- a/libavutil/riscv/float_dsp_rvv.S
+++ b/libavutil/riscv/float_dsp_rvv.S
@@ -167,7 +167,7 @@ endfunc
 
 // a0 = (a0).(a1) [0..a2-1]
 func ff_scalarproduct_float_rvv, zve32f
-        vsetvli      zero, zero, e32, m1, ta, ma
+        vsetivli     zero, 1, e32, m1, ta, ma
         vmv.s.x      v8, zero
 1:
         vsetvli      t0, a2, e32, m1, ta, ma
-- 
2.37.2

_______________________________________________
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] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] riscv: fix scalar product initialisation
  2022-10-03 15:06 [FFmpeg-devel] [PATCH] riscv: fix scalar product initialisation remi
@ 2022-10-12 17:04 ` Rémi Denis-Courmont
  0 siblings, 0 replies; 2+ messages in thread
From: Rémi Denis-Courmont @ 2022-10-12 17:04 UTC (permalink / raw)
  To: ffmpeg-devel

Le maanantaina 3. lokakuuta 2022, 18.06.42 EEST remi@remlab.net a écrit :
> From: Rémi Denis-Courmont <remi@remlab.net>
> 
> VSETVLI xd, x0, ...' has rather nonobvious semantics:
> - If xd is x0, then it preserves the current vector length.
> - If xd is not x0, it sets the vector length to the supported maximum.
> 
> Also somewhat confusingly, while VMV.X.S always does its thing
> regardless of the selected vector length, VMV.S.X does _nothing_ if the
> selected vector length is zero.
> 
> So the current code breaks fails to initialise the accumulator if we
> are unlucky to have a selected vector length of zero on entry. Fix it
> by forcing the vector length to one.

Ping.

The issue becomes systematically reproducible with the checkasm support.

-- 
雷米‧德尼-库尔蒙
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] 2+ messages in thread

end of thread, other threads:[~2022-10-12 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 15:06 [FFmpeg-devel] [PATCH] riscv: fix scalar product initialisation remi
2022-10-12 17:04 ` 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