Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v7] libavfilter/x86/vf_convolution: add sobel filter optimization and unit test with intel AVX512 VNNI
Date: Mon, 14 Nov 2022 08:34:54 -0300
Message-ID: <d6b36de2-1903-2b45-c870-b3fe90343cb9@gmail.com> (raw)
In-Reply-To: <BN6PR11MB1746A6A751B39DC5253030809B059@BN6PR11MB1746.namprd11.prod.outlook.com>

On 11/14/2022 2:58 AM, Wang, Bin wrote:
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of James Almer
> Sent: Monday, November 14, 2022 10:43 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v7] libavfilter/x86/vf_convolution: add sobel filter optimization and unit test with intel AVX512 VNNI
> 
> On 11/4/2022 5:29 AM, bin.wang-at-intel.com@ffmpeg.org wrote:
>> +%macro FILTER_SOBEL 0
>> +%if UNIX64
>> +cglobal filter_sobel, 4, 15, 7, dst, width, matrix, ptr, c0, c1, c2,
>> +c3, c4, c5, c6, c7, c8, r, x %else cglobal filter_sobel, 4, 15, 7,
>> +dst, width, rdiv, bias, matrix, ptr, c0, c1, c2, c3, c4, c5, c6, c7,
>> +c8, r, x %endif %if WIN64
>> +    SWAP xmm0, xmm2
>> +    SWAP xmm1, xmm3
>> +    mov  r2q, matrixmp
>> +    mov  r3q, ptrmp
>> +    DEFINE_ARGS dst, width, matrix, ptr, c0, c1, c2, c3, c4, c5, c6,
>> +c7, c8, r, x %endif
>> +    movsxdifnidn widthq, widthd
>> +    VBROADCASTSS m0, xmm0
>> +    VBROADCASTSS m1, xmm1
> 
>> + This and every other xmm# case should instead be xm#, to ensure the swapping is taken into account.
> 
> Sorry, I can't get your point, could you please help to explain why I have to use xm# to ensure the swapping operation(swap xmm# can't work in WIN64 asm)? And How to do it ?

SWAP only affects the x86inc defined macros m#, xm#, ym#, and zm#, so 
those instructions above end up encoded as vbroadcastss zmm2, xmm0 and
vbroadcastss zmm3, xmm1 on WIN64.
In fact, now that i check it they end up as vbroadcastss zmm18, xmm0 and 
vbroadcastss zmm19, xmm1 because x86inc is purposely using the higher 16 
regs with these macros on all targets to avoid having to call vzeroupper 
at the end. This works on unix64 by pure chance because the floats were 
effectively in xmm0 and xmm1 and all calculations then happen on m#, xm# 
and ym#.

So you'll have to duplicate the VBROADCASTSS lines to broadcast xmm2 and 
xmm3 to m0 and m1 on WIN64 instead of using SWAP.
_______________________________________________
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".

  reply	other threads:[~2022-11-14 11:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  8:29 bin.wang-at-intel.com
2022-11-07  5:24 ` Xiang, Haihao
2022-11-11  3:00   ` Xiang, Haihao
2022-11-14  2:12     ` Xiang, Haihao
2022-11-14  2:42 ` James Almer
2022-11-14  5:58   ` Wang, Bin
2022-11-14 11:34     ` James Almer [this message]
2022-11-14 12:54 ` James Almer
2022-11-14 13:30   ` Wang, Bin
2022-11-14 13:35     ` James Almer
2022-11-14 13:54       ` Wang, Bin
2022-11-14 14:31         ` James Almer
2022-11-14 15:18           ` Wang, Bin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6b36de2-1903-2b45-c870-b3fe90343cb9@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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