From patchwork Sun Jul 28 17:10:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nathan E. Egge" X-Patchwork-Id: 50804 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:16f:b0:489:2eb3:e4c4 with SMTP id h47csp730575vqi; Sun, 28 Jul 2024 10:11:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHE241fKAZpy67K4knykCHABjD/HBoO+OItyWnQGJp0QISKiJjl9BR7V0kgzM97RBw5HYwcy+IfAnLIMxNi+NWqJH3V8kY438/rw== X-Google-Smtp-Source: AGHT+IEdcv7CsUTyewzB5Bb60LIOsOegkfkU0VwgIShE9OfMB92lCSQGummQxEGFKJNpKfZtEq3b X-Received: by 2002:a05:651c:545:b0:2f0:1fd5:2f29 with SMTP id 38308e7fff4ca-2f12edfef11mr37027741fa.19.1722186676534; Sun, 28 Jul 2024 10:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722186676; cv=none; d=google.com; s=arc-20160816; b=lWc/ot+ZUb6Td6tKRL8P/iR7br047nFQ3nsy3glpFbH4aiieN9271LzV3tkPBTzQ8/ yzK046OnDJNbfcs805TrDTszwp3MLqsUH0fGVAhoOjDWSR7j+9XK0cQTTLKbyaX5eGtB hzLmm4sXkGmw1Fkyt4BVKgT/Eofys59ZVPO2Lm8XbSx8vq97GBQhFKRIk7oUFmqDxC11 V5G3hMcNdezs9v8DLNmCIhyPz43HAFLRjnQGBBpMvNlwYWDXSA9LGHane6g6n26j62bw FtUf0qDKdRVsWs49t2/fKwAdeRV1/uXVAlkLpnCX4G93PoItFo2Gxj0tOS0nCDKocUQ9 2b2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=nS7XzW7shvKKRbkoWCdLJO/HlAn1FnZIiAF/dhHZWbY=; fh=TODjjcnpj5nBXiuj6eH/UWpjG3lYe0u7hmMnTCRmegc=; b=IZmd+1ZCIPSPKL61zQBXAcappaUx6ep5Muu9sNLFOS5Hv0L1ZUhdhtmoqu1g8/1xan Gjn2tc8CFMZ1l1DaHWj0rpPzdY/vJKYnBSIRKg0NRNHnFJD3dMZpeXKRWjiV5WzAJDe4 yjCmFe306NvCeQeoainPN1aKU2fcDKGcpcWVulpyDSBE2Nuvakds0m6x98tZLJuwdmbi w64K5QKqLXIawKxyyvV1i5WARHEfkfQlLrCcN/+Crac1HOP0a3nzS3l6BimOEQOqYfkH +OkKeD0TP62ScAPpzzOPEUvcIS7yC70A1NlQiSaDSYZ/HdmCWxeBC4n4O60R2Fwaq8IE OYww==; dara=google.com 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 4fb4d7f45d1cf-5afff346ec2si2847021a12.233.2024.07.28.10.11.16; Sun, 28 Jul 2024 10:11: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 0B10168D8BE; Sun, 28 Jul 2024 20:11:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mailfish.xiph.org (mailfish.xiph.osuosl.org [140.211.166.35]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 12BC968D712 for ; Sun, 28 Jul 2024 20:11:05 +0300 (EEST) Received: from localhost.localdomain (c-24-126-94-29.hsd1.va.comcast.net [24.126.94.29]) by mailfish.xiph.org (Postfix) with ESMTPSA id E35AB9F770; Sun, 28 Jul 2024 17:11:03 +0000 (UTC) From: "Nathan E. Egge" To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Jul 2024 17:10:51 +0000 Message-ID: <20240728171051.29078-1-unlord@xiph.org> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/riscv: Revert d808070, removing AV_READ_TIME 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 Cc: "Nathan E. Egge" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SOFZJfbphhmk The implementation of ff_read_time() for RISC-V uses rdtime which has precision on existing hardware too low (!) for benchmarking purposes. Deleting this implementation falls back on clock_gettime() which was added as the default ff_read_time() implementation in 33e4cc9. Below are metrics gathered on SpacemiT K1, before and after this commit: Before: $ tests/checkasm/checkasm --bench benchmarking with native FFmpeg timers nop: 0.0 checkasm: using random seed 3473665261 checkasm: bench runs 1024 (1 << 10) RVI: - pixblockdsp.get_pixels [OK] - vc1dsp.mspel_pixels [OK] RVF: - audiodsp.audiodsp [OK] checkasm: all 4 tests passed audiodsp.vector_clipf_c: 1388.7 audiodsp.vector_clipf_rvf: 261.5 get_pixels_c: 2.0 get_pixels_rvi: 1.5 vc1dsp.put_vc1_mspel_pixels_tab[0][0]_c: 8.0 vc1dsp.put_vc1_mspel_pixels_tab[0][0]_rvi: 1.0 vc1dsp.put_vc1_mspel_pixels_tab[1][0]_c: 2.0 vc1dsp.put_vc1_mspel_pixels_tab[1][0]_rvi: 0.5 After: $ tests/checkasm/checkasm --bench benchmarking with native FFmpeg timers nop: 56.4 checkasm: using random seed 1021411603 checkasm: bench runs 1024 (1 << 10) RVI: - pixblockdsp.get_pixels [OK] - vc1dsp.mspel_pixels [OK] RVF: - audiodsp.audiodsp [OK] checkasm: all 4 tests passed audiodsp.vector_clipf_c: 23236.4 audiodsp.vector_clipf_rvf: 11038.4 get_pixels_c: 79.6 get_pixels_rvi: 48.4 vc1dsp.put_vc1_mspel_pixels_tab[0][0]_c: 329.6 vc1dsp.put_vc1_mspel_pixels_tab[0][0]_rvi: 38.1 vc1dsp.put_vc1_mspel_pixels_tab[1][0]_c: 89.9 vc1dsp.put_vc1_mspel_pixels_tab[1][0]_rvi: 17.1 --- libavutil/riscv/timer.h | 54 ----------------------------------------- libavutil/timer.h | 2 -- 2 files changed, 56 deletions(-) delete mode 100644 libavutil/riscv/timer.h diff --git a/libavutil/riscv/timer.h b/libavutil/riscv/timer.h deleted file mode 100644 index 174b469cbe..0000000000 --- a/libavutil/riscv/timer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_RISCV_TIMER_H -#define AVUTIL_RISCV_TIMER_H - -#include "config.h" - -#if HAVE_INLINE_ASM -#include - -static inline uint64_t ff_read_time(void) -{ -#if (__riscv_xlen >= 64) - uintptr_t cycles; - - __asm__ volatile ("rdtime %0" : "=r" (cycles)); - -#else - uint64_t cycles; - uint32_t hi, lo, check; - - __asm__ volatile ( - "1: rdtimeh %0\n" - " rdtime %1\n" - " rdtimeh %2\n" - " bne %0, %2, 1b\n" : "=r" (hi), "=r" (lo), "=r" (check)); - - cycles = (((uint64_t)hi) << 32) | lo; - -#endif - return cycles; -} - -#define AV_READ_TIME ff_read_time -#define FF_TIMER_UNITS "ticks" - -#endif -#endif /* AVUTIL_RISCV_TIMER_H */ diff --git a/libavutil/timer.h b/libavutil/timer.h index 9fe6aa1385..663daf81c6 100644 --- a/libavutil/timer.h +++ b/libavutil/timer.h @@ -61,8 +61,6 @@ # include "arm/timer.h" #elif ARCH_PPC # include "ppc/timer.h" -#elif ARCH_RISCV -# include "riscv/timer.h" #elif ARCH_X86 # include "x86/timer.h" #elif ARCH_LOONGARCH