From patchwork Tue Aug 13 14:03:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 50997 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a746:0:b0:489:2eb3:e4c4 with SMTP id f6csp285086vqm; Tue, 13 Aug 2024 07:04:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVQ/+v2IOrfwleSeO/NJ+kw61GlwFiUjCCpjEzgVqbgCK6Wv8HCg4IeXJ5NUdtuuliZHbfYf0V9QzYDt+YGaBKXPn2uNa7PYdFUGw== X-Google-Smtp-Source: AGHT+IE+15QSFjy9rNGvjBI1UicWAL897I8FAsLLev9LV03YLAHfWB0HlQprrtRwWnccf8yf/p9X X-Received: by 2002:a17:907:f194:b0:a7a:a960:99ee with SMTP id a640c23a62f3a-a80ed24e7b3mr281411966b.32.1723557849774; Tue, 13 Aug 2024 07:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723557849; cv=none; d=google.com; s=arc-20160816; b=PeMNGuyybHxm1WIkIUPOqju5uYQMZfkG12saPznSph8/r1Dimy/Db4nZIOV9HqKC4h wXmjBcHx4cQDkuswB3DwH/RSy8bJqGhRqO4YuMjqDQHB/5o67Ys6TNR7FY/eHu8+zpYf Ayp8+Odn7uMwjpD1rs2y7rmC4h1Fw5gG8QGf568yhf1gVqJdEI8uSpXWUaVWGw465mWn O3RWTd6nj8llsMxl10QUnW+o247JnPjFfbH23cPnUTV18mPjPdl4sEhprenQfAwaxI+j /D7fAv2Krxx3BAEepiVaFs8giP5XHHKO+ejZyX2x6DRLQcM7jUxKZXdnJCNBqBFFy90R Y6vw== 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:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=10TNryaY+3LoMoypS6bre5L3bTKlxi5TdM+KellSyiA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=kS6gRyEWV4qkljOdIdCWJKmsI6u8wInWY7xT8eWmDT7F3xmdpvfeAIHfXsCUAkQQrL WHZyuJ4PSI814VjJW6eEwYT4GIKqIEC19toiZCUeoI2E6IxiEDUs5+GgjBbrq9KEFvnE kD2Srw0TqTNujfZB0n92O+zOn1NbcRErv+OdyMIag2JrxpFZRjQiENg1k2dtY/skDYnI Rs9MYWT0jAeouZ6d7n7D/2MaDgU+0EqwU7OJ/6kjwIW9WHe/uBRjY+eUyX1xHzkYrest 7sLUMprLPeuGZivlqpcr6hbvDc4eBaTjpv79gEsO1fsnNgJ6s0hLA6+4iM2MZd4BgSYf 6jBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=cLcs7kM1; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=H++jkjPC; 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 a640c23a62f3a-a80f3f4e9afsi97186266b.131.2024.08.13.07.04.08; Tue, 13 Aug 2024 07:04:09 -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; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=cLcs7kM1; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=H++jkjPC; 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 3316068DA3F; Tue, 13 Aug 2024 17:03:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from fhigh8-smtp.messagingengine.com (fhigh8-smtp.messagingengine.com [103.168.172.159]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 92D4568D52A for ; Tue, 13 Aug 2024 17:03:43 +0300 (EEST) Received: from phl-compute-05.internal (phl-compute-05.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id A0247114C2AA for ; Tue, 13 Aug 2024 10:03:42 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 13 Aug 2024 10:03:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1723557822; x=1723644222; bh=AIEgQLDfmn7uWr9Lnk21S5lq9E/d2xLmFMc+MuGSpSk=; b= cLcs7kM1Zjyd2OTfZMkPiLVVZrOpsZkxZRWj0l69bEr4DWYeHy1qzwOMBoZ9N8rO Y9xnEuYhBVhNSLLzZKnWh8qrSx6K9sqg6xs3bwkfJlnBYk6guSwCUbYEThPNknRp cbHsbH8DmHhPMC9v43BY9wd750odc3Vwt3dtqP/91sDhFKOPz6r2KNu6iDVDMC+c 8sF2YV0OKjOWN0NXscGTf6D+PDgPY4q1RZab7CHZHzVwDdJxyjht37EIcOMCwEg+ 28QAMmwYWvbEcxvlVfvpwubRbRYnDTouTsP5PTT6n55dqPlin7M/dDvlh4q85+ZG JPIh7r4OrfJjViYupPQT7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1723557822; x= 1723644222; bh=AIEgQLDfmn7uWr9Lnk21S5lq9E/d2xLmFMc+MuGSpSk=; b=H ++jkjPCbkHuujTN0DGDA5zqonGQRKgoYbyfoC5gwfAwBqnwn4jaReAsnXSQC7BLF kTRxQs+t5m0aH/HvVRhckSnYQN5Hd/9G/2KwJDgrxmimk+ALif/paxF/VHAVi4oa piVTrk0OcjuHi94/d029ViJJ8fn6Yp97zd/mytHQrDyj/1tOr6EeIsUa9irgCHki PFzaCOTfxshActdI2+IAa4F3liKwQVVh4QM3AxK340ek3sCr8+AJmtpGganelwhe dDQVAVZIJOrR0KnQZX1vxPIGiG3FVbhIDCyBScwOFsTMfqu2B3wNXdhR50TzqRBY Yu8j/WdYdLy8xVJ56JqKA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddtvddgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceo jhguvghksehithgrnhhimhhulhdrlhhiqeenucggtffrrghtthgvrhhnpeekvedvudevfe eufffhffeluedvgeefgedtgefhhffhtdevudegfeekffffieetgfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuh hlrdhlihdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 13 Aug 2024 10:03:42 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Aug 2024 16:03:31 +0200 Message-ID: <20240813140338.143045-2-jdek@itanimul.li> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240813140338.143045-1-jdek@itanimul.li> References: <20240813140338.143045-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/7] checkasm: improve print format 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: 3XGhsB/xdysR Port dav1d's checkasm output format to FFmpeg's checkasm, includes relative speedups and aligns results. Signed-off-by: J. Dekker --- tests/checkasm/checkasm.c | 53 +++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index f82ee0864f..0095758268 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -18,6 +18,31 @@ * You should have received a copy of the GNU 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. + * + * Copyright © 2018, VideoLAN and dav1d authors + * Copyright © 2018, Two Orioles, LLC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -575,6 +600,16 @@ static int measure_nop_time(void) return nop_sum / 500; } +static inline double avg_cycles_per_call(const CheckasmPerf *const p) +{ + if (p->iterations) { + const double cycles = (double)(10 * p->cycles) / p->iterations - state.nop_time; + if (cycles > 0.0) + return cycles / 4.0; /* 4 calls per iteration */ + } + return 0.0; +} + /* Print benchmark results */ static void print_benchs(CheckasmFunc *f) { @@ -584,17 +619,25 @@ static void print_benchs(CheckasmFunc *f) /* Only print functions with at least one assembly version */ if (f->versions.cpu || f->versions.next) { CheckasmFuncVersion *v = &f->versions; + const CheckasmPerf *p = &v->perf; + const double baseline = avg_cycles_per_call(p); + double decicycles; do { - CheckasmPerf *p = &v->perf; if (p->iterations) { - int decicycles = (10*p->cycles/p->iterations - state.nop_time) / 4; + p = &v->perf; + decicycles = avg_cycles_per_call(p); if (state.csv) { const char sep = state.tsv ? '\t' : ','; - printf("%s%c%s%c%d.%d\n", f->name, sep, + printf("%s%c%s%c%.1f\n", f->name, sep, cpu_suffix(v->cpu), sep, - decicycles / 10, decicycles % 10); + decicycles / 10.0); } else { - printf("%s_%s: %d.%d\n", f->name, cpu_suffix(v->cpu), decicycles/10, decicycles%10); + const int pad_length = 10 + 50 - + printf("%s_%s:", f->name, cpu_suffix(v->cpu)); + const double ratio = decicycles ? + baseline / decicycles : 0.0; + printf("%*.1f (%5.2fx)\n", FFMAX(pad_length, 0), + decicycles / 10.0, ratio); } } } while ((v = v->next));