* [FFmpeg-devel] [PATCH v2 0/1] lavc/aarch64: add some neon pix_abs functions
@ 2022-04-14 16:22 Swinney, Jonathan
2022-04-15 20:45 ` Martin Storsjö
0 siblings, 1 reply; 3+ messages in thread
From: Swinney, Jonathan @ 2022-04-14 16:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Martin Storsjö, Clément Bœsch, Pop, Sebastian
Thanks Martin for the review. I made some updates according to the suggestions you made.
I added a checkasm function, but I'm new to the test framework, so it may need some work still.
> Would it be beneficial to not do the addv here on each iteration, but
> accumulate in v18.8h, and the just do one single addv at the end?
I did some testing with this, and it is, indeed, faster, however the problem I ran into is that the bounds for the loop can be higher than the capacity of a 16-bit unsigned integer used for accumulating in v16.8h. With the addv inside the loop, this register can hold the maximum possible value without overflowing before we increase the width of the field with the add instruction. If you have a trick or there are restrictions on the inputs that I am not aware of, let me know.
> This version most certainly would be slower indeed. If we could be ok with
> doing a bit of overread, the simplest version might be to load e.g. "ld1
> {v4.16b, v5.16b}, [x2]" followed by "ext v5.16b, v4.16b, v5.16b, #1" to
> shift it. But doing an overlapping unaligned load probably is fine too.
I experimented with these instructions and found that it was marginally faster on Graviton 2, but it was slower on Graviton 3. Graviton 3 has more vector pipelines than Graviton 2 and is therefore a better candidate for video encoding workloads, so I chose to prefer Graviton 3. I didn't test it other chips.
Thank you for reviewing the patch!
Jonathan Swinney
_______________________________________________
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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 0/1] lavc/aarch64: add some neon pix_abs functions
2022-04-14 16:22 [FFmpeg-devel] [PATCH v2 0/1] lavc/aarch64: add some neon pix_abs functions Swinney, Jonathan
@ 2022-04-15 20:45 ` Martin Storsjö
2022-04-16 20:46 ` Martin Storsjö
0 siblings, 1 reply; 3+ messages in thread
From: Martin Storsjö @ 2022-04-15 20:45 UTC (permalink / raw)
To: Swinney, Jonathan; +Cc: Clément Bœsch, Pop, Sebastian, ffmpeg-devel
On Thu, 14 Apr 2022, Swinney, Jonathan wrote:
> Thanks Martin for the review. I made some updates according to the
> suggestions you made.
>
> I added a checkasm function, but I'm new to the test framework, so it
> may need some work still.
Thanks for putting in the effort to make a test - that adds a lot of value
to the project! I'll follow up with a review of the newly added test.
>> Would it be beneficial to not do the addv here on each iteration, but
>> accumulate in v18.8h, and the just do one single addv at the end?
>
> I did some testing with this, and it is, indeed, faster, however the
> problem I ran into is that the bounds for the loop can be higher than
> the capacity of a 16-bit unsigned integer used for accumulating in
> v16.8h. With the addv inside the loop, this register can hold the
> maximum possible value without overflowing before we increase the width
> of the field with the add instruction. If you have a trick or there are
> restrictions on the inputs that I am not aware of, let me know.
Ok, I see! Can the accumulation be done with widening, i.e. uaddw v18.4s,
v18.4s, v16.4h, uaddw2 v19.4s, v19.4s, v16.8h? (Or you could add both
halves into the same v18.4s, but using two destination registers there
probably helps.) That would keep the logic more SIMD-like while doing the
flattening to one scalar value only once at the end.
>> This version most certainly would be slower indeed. If we could be ok with
>> doing a bit of overread, the simplest version might be to load e.g. "ld1
>> {v4.16b, v5.16b}, [x2]" followed by "ext v5.16b, v4.16b, v5.16b, #1" to
>> shift it. But doing an overlapping unaligned load probably is fine too.
>
> I experimented with these instructions and found that it was marginally
> faster on Graviton 2, but it was slower on Graviton 3. Graviton 3 has
> more vector pipelines than Graviton 2 and is therefore a better
> candidate for video encoding workloads, so I chose to prefer Graviton 3.
> I didn't test it other chips.
Ok - I guess the current implementation of that aspect is fine then!
// 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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 0/1] lavc/aarch64: add some neon pix_abs functions
2022-04-15 20:45 ` Martin Storsjö
@ 2022-04-16 20:46 ` Martin Storsjö
0 siblings, 0 replies; 3+ messages in thread
From: Martin Storsjö @ 2022-04-16 20:46 UTC (permalink / raw)
To: Swinney, Jonathan; +Cc: Clément Bœsch, Pop, Sebastian, ffmpeg-devel
On Fri, 15 Apr 2022, Martin Storsjö wrote:
> On Thu, 14 Apr 2022, Swinney, Jonathan wrote:
>
>> Thanks Martin for the review. I made some updates according to the
>> suggestions you made.
>>
>> I added a checkasm function, but I'm new to the test framework, so it may
>> need some work still.
>
> Thanks for putting in the effort to make a test - that adds a lot of value to
> the project! I'll follow up with a review of the newly added test.
Btw, for a guide on how checkasm tests, see
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-March/294400.html as a bit
of a walkthrough.
// 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] 3+ messages in thread
end of thread, other threads:[~2022-04-16 20:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 16:22 [FFmpeg-devel] [PATCH v2 0/1] lavc/aarch64: add some neon pix_abs functions Swinney, Jonathan
2022-04-15 20:45 ` Martin Storsjö
2022-04-16 20:46 ` Martin Storsjö
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