From patchwork Sat Jul 15 20:57:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42747 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp4510592pzb; Sat, 15 Jul 2023 13:57:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlFd5HEcKZLjg3bm+3CyS0VGaWKgatYCJ8r9lS2azkwvzEGEBY84Q/0ZM+Nsr+whJSAjl1H0 X-Received: by 2002:a17:906:749c:b0:96f:d345:d0f7 with SMTP id e28-20020a170906749c00b0096fd345d0f7mr7388336ejl.62.1689454636886; Sat, 15 Jul 2023 13:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689454636; cv=none; d=google.com; s=arc-20160816; b=sdONrSy4iqT5cuJPuxW9/+AUBxrzLdhqPVf9o4Hgz7Svv51QMIzyOV5eTCkxtNp+qj 4oSqhvHcBGl9TnOOVfKTRDIkuPTo7a62+/Xt2jHFLhXphzOCPNi9RMMEXHDCFv0cqR6a HvmlFCEByaRr1uMgQ3o/jFh7Z6ry56pjNZBgm+3/aGyHWohVjtyHwYWlnq+vyCHF2iQI NFTxylYeMp5Ztc1IGVdjAYuo2WsVA87ZGQt62UjzoEhmF8NPKrWNsoW1b1f6nCDIVY1R +SnkaH9TvtuO6pWPBHg1tVYNvPH+kjrTvElC7UKTOYRncMgXZ22FGj9RIq5HVmUZS6z+ Gw5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=MGZrsAS4hztIl9g/DR88sqFiOBWYj/7peRtCLfV5V5A=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=kLRewEUrmQN1/QHQWhIYMRWOEdJ5qHRbVixCDiDnc4IZnvDzVDYbj8/cA/kba4TKPc VOG8A31X9MfJWaTRYfLa4ZPjzPsYNq9DcUyJI3uHqBBFX8VLQs1NGFTHDHbyy9lJ469E giQt1HxY2BmCefGWj6h8/+V40+/KdZm3UWZlB7tHtbfNwQaX8vLS5ytJeIvKYjJctfjW 1dp4V7lyW2GyFdyN49ioS4kObUF0nyHPk8k7J1P1hmO31G6sn3f5vlLke9rupnHnHf7q nrIr3gRje40B/ECcLjCENO9RqvFxorjmc1/sHgHXmoNd+n1VhsPQEbCTosFlmCv175Ji UPQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ox10-20020a170907100a00b00993a37985dfsi11369753ejb.179.2023.07.15.13.57.16; Sat, 15 Jul 2023 13:57:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E26D168C653; Sat, 15 Jul 2023 23:57:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8CAF168C59B for ; Sat, 15 Jul 2023 23:57:06 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 1BB23C0010 for ; Sat, 15 Jul 2023 23:57:06 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 15 Jul 2023 23:57:04 +0300 Message-Id: <20230715205705.34475-1-remi@remlab.net> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavc/aacpsdsp: rework RISC-V add_squares X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: K8lnNAIDRvDI Segmented loads are kinda slow, so this advantageously uses a unit-strided load and narrowing shifts instead. Before: ps_add_squares_rvv_f32: 30352.2 After: ps_add_squares_rvv_f32: 11973.7 --- libavcodec/riscv/aacpsdsp_rvv.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/riscv/aacpsdsp_rvv.S b/libavcodec/riscv/aacpsdsp_rvv.S index 80bd19f6ad..b7ea314fc3 100644 --- a/libavcodec/riscv/aacpsdsp_rvv.S +++ b/libavcodec/riscv/aacpsdsp_rvv.S @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Rémi Denis-Courmont. + * Copyright © 2022-2023 Rémi Denis-Courmont. * * This file is part of FFmpeg. * @@ -21,13 +21,16 @@ #include "libavutil/riscv/asm.S" func ff_ps_add_squares_rvv, zve32f + li t1, 32 1: vsetvli t0, a2, e32, m1, ta, ma - vlseg2e32.v v24, (a1) - sub a2, a2, t0 + vle64.v v8, (a1) + vnsrl.wx v24, v8, zero vle32.v v16, (a0) - sh3add a1, t0, a1 + sub a2, a2, t0 + vnsrl.wx v25, v8, t1 vfmacc.vv v16, v24, v24 + sh3add a1, t0, a1 vfmacc.vv v16, v25, v25 vse32.v v16, (a0) sh2add a0, t0, a0 From patchwork Sat Jul 15 20:57:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42748 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp4510637pzb; Sat, 15 Jul 2023 13:57:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlHneoD8InAqCXa7oP36h+jAXWFTiAHsvj5nAjamPVQZvH2yj5TuqUp93aqfDQHZkRKbNdBr X-Received: by 2002:a17:906:151:b0:993:f497:adc2 with SMTP id 17-20020a170906015100b00993f497adc2mr7819181ejh.18.1689454645975; Sat, 15 Jul 2023 13:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689454645; cv=none; d=google.com; s=arc-20160816; b=m84VGU1R3LCxu7eAXbOR2Qs489AmIliI67CrtUGEnANQUCh+x9/7DgFdNiSAVsnTpO Xi1KGuTObfqIPxVOZWNGq5SqevhPmUgAY1045gShLOU/oFXrpWmPE0gQSyxpXAe6xtoD Ky6DtNwwabAPQe0sqWpavhq7lhfiMxOa2gzz1257QBsJEpkzuNVR+XjlHMuGnynYzMIW JNoy4d+1XLEQB3q4AU6+bzJvcTnGpSH/MNMb+KCIugqH60bA8RtdK+bmxoAUZSRMQ2KI mZ6/FremgkrCtAqUqJAMOl0j1wAbtEclj2rHDtSuWAp1RfAsQtF1YXvS7bHMb91NSltz +w9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=xHvhaE8nTqg+LgAbQpMZ3vL24TuUT91Mm5cF+QWyoxc=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=sqvWviDxcVeTShqTh26wtM5b5ssMlvj4ZtDj+wFDP62iierDAXvd8Jwf8TDEXfqacQ hX4k3Me1exXKa843YULF3MEzFTdEund69BnO6RRsPjicwZNNKxITbvVcsqA5oZXxzfoE 1RdNUHV+wbJAFMj35DfZtelFPt8iErgQxJA/XZitjwXaG62P6dKVHkZF+NfCP/0bgvuH /HkqnH2BZvhksMlrNhExknzbMdsPRw74KFO+e4pcF3vtHRJ3gOFVS6MlgYi19CHleQVA qtnBoUgT4g/7P2ve2oyDI9i+StLdZcTJF/ImWn4ObbN2nfGCdO7iW/42inu9IK8TZJVO JHow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b18-20020a170906709200b009934728f33bsi10747629ejk.533.2023.07.15.13.57.25; Sat, 15 Jul 2023 13:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E29B268C67F; Sat, 15 Jul 2023 23:57:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B5FCB68C59B for ; Sat, 15 Jul 2023 23:57:06 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 513D2C0017 for ; Sat, 15 Jul 2023 23:57:06 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 15 Jul 2023 23:57:05 +0300 Message-Id: <20230715205705.34475-2-remi@remlab.net> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/aacpsdsp: unroll RISC-V V add_squares X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: X6Lu0s3RdzO7 This does not make much difference with the Device Under Test, but since we can: Before: ps_add_squares_rvv_f32: 11973.7 After: ps_add_squares_rvv_f32: 11958.2 --- libavcodec/riscv/aacpsdsp_rvv.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/riscv/aacpsdsp_rvv.S b/libavcodec/riscv/aacpsdsp_rvv.S index b7ea314fc3..bd8f905334 100644 --- a/libavcodec/riscv/aacpsdsp_rvv.S +++ b/libavcodec/riscv/aacpsdsp_rvv.S @@ -23,15 +23,15 @@ func ff_ps_add_squares_rvv, zve32f li t1, 32 1: - vsetvli t0, a2, e32, m1, ta, ma + vsetvli t0, a2, e32, m4, ta, ma vle64.v v8, (a1) vnsrl.wx v24, v8, zero vle32.v v16, (a0) sub a2, a2, t0 - vnsrl.wx v25, v8, t1 + vnsrl.wx v28, v8, t1 vfmacc.vv v16, v24, v24 sh3add a1, t0, a1 - vfmacc.vv v16, v25, v25 + vfmacc.vv v16, v28, v28 vse32.v v16, (a0) sh2add a0, t0, a0 bnez a2, 1b