From patchwork Tue Sep 17 12:14:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 51633 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d32e:0:b0:48e:c0f8:d0de with SMTP id cf14csp211255vqb; Tue, 17 Sep 2024 05:15:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+HU+HWCQpMXSTFR4NNtUgjSfqEkfuxpFXgpCdQPzA1Rf4sPW0uqQd/JHT8c3JOQeo+fdmBy8xRC6yHWKtXOYz@gmail.com X-Google-Smtp-Source: AGHT+IH5LoI8x/bQx/TS6AX/aOyjmcjbDT9DNBHNeV80cDKwxIW/+wH2zYIbwJ52eaB/BPKtqYcb X-Received: by 2002:a05:651c:2227:b0:2f7:5337:52ce with SMTP id 38308e7fff4ca-2f7919045d9mr95809691fa.11.1726575301530; Tue, 17 Sep 2024 05:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726575301; cv=none; d=google.com; s=arc-20240605; b=NdQVAuAKDFzha8liy9bgmJAwFbLvAgFiYJHL3MAGwMH3If76A6RkOS0YhmVT2vnKXn DGpS1nw/PDb47ht//VinXQ7Pl1lGM1h1+bMrXsWhp7dT+hK48QUS5Cv0G3t47xgwP8q8 gj6Ns9TTO6hUIu1Qd9TKt2sOR8ad5FWpa6wcB9OYezcqqDRI0crOY7T1X3xVeoo60MU8 +YXXFWWQemz9exY7J9hlkbZtXVlpXyvXRKmSO4xrtk45z/Odjh+x9ogqF93PijYLn6OW z9f777GxXQDzf9d7bRIHy/AQCRAaSBt6HtTkEV/RRoEvz9+F/Ho+iI7Smubbnlvu6DUM 5skg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:dkim-signature:delivered-to; bh=Dj+zJo+i88iErtts+FVlPt8cEHNzdbXvtfyn9wxLKEI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Gw1776niRBXMiRgB1WlyulokJh1t1D7gTiXNCYw2/5vfrtftqpR9oGl572spU4coIx pOWIAv8v+zFQkxOEdJUqGxyuOeG2ANFuPeXpdhQGi6A2dTkF8AnynJitie3oW13RuNNG 3iwG/0MMejLV8a7B7fPm5wPZyoe96gnvvPRj8KpFJoIBk67J+U0SOD0TGBIOTYAbrHRs wbAY2NWsPg2fBfrWHAQgJkR20YaKlQ3Xbuj2TT4Tj9h3HgXUda7Y+aMVrGHzmZqy0bjQ IP/bVrHLuk5rlPz4alaZmW4PMBMdE47wSiMIEJOqRLN047XdlThkaNbbpm2bPoNJ05rj TwSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b="V8vM5j/W"; 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; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2f79d35da99si21788991fa.216.2024.09.17.05.15.00; Tue, 17 Sep 2024 05:15:01 -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=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b="V8vM5j/W"; 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; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0D4FA68DB24; Tue, 17 Sep 2024 15:14:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE22F68DAE3 for ; Tue, 17 Sep 2024 15:14:22 +0300 (EEST) Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2f029e9c9cfso45729041fa.2 for ; Tue, 17 Sep 2024 05:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1726575262; x=1727180062; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yLvHGR7jbqUYwAKPmUFdkjuEBjP0PmE/qvNomr8Z6g8=; b=V8vM5j/W/KWytPa9Eireoe1NAs3KP4Scbpi5/HyurltOW8YRqcmW9lydzpU28qF8UQ Lyzrj1WOLRrxC2/ugE97+qnE0CH/bDbf4kk6CvG8hs6wN5I9zd1BrMGHileH6hRB3bGU PMlOlyDMIr/Iu6/BOff0PsdL4Tuq4/CBy4S5cjMHNrvKkZm/fexGtY3m6rCHWUpK2Kl4 YkBvfVikfAvxcKRLDKtdRM2v+LrCNAe6wanwriiFsTwJ2PAiYawz/CWBFW0W+ttpYtwP b9Rae0DCxgQa0iEUomdIhnuWhvpUvbxvUR5eVyobz8/bBNYNQ0x1Ekyt8safPSUduexh 3thQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726575262; x=1727180062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yLvHGR7jbqUYwAKPmUFdkjuEBjP0PmE/qvNomr8Z6g8=; b=fMsgsNA6u4HrLTXTSx7K6aR7V0my+OiG/bzRo7CC7gtmrHQLj1qc3OKu8jo5bjv4dc LTKUr76O4EnRoH5nt3OB94VaHm5Ry6Xi4rBPXZlChiNsg5k23GJVCBaBt7vmYoixI2AY iBzJSUtontuT5kneaoYPAkWrqIo8vA/ZOvPgc48pDgiUF60FM1UedMMwQozYrSH+ZfEe nedpjIOIMdGPqkMQET1A9C6ZHtql0+k7mTJblqqqa9rmt2bjih1a51cwoi3196DsrI9V aMiH4whxM42dpNhE207qd4NgJvVnOEBXtsP53M9NQyx3qrixEU7ruuLkq4/z5cmRiLOu H3AA== X-Gm-Message-State: AOJu0Yz2OeYoUQV/4/8QOYEbt16LrJO+4QojGApegARLvI04IzQ6uKXX X6ZRnR7QassF+r8lqkLG8QT9yxMEsNUDDEiWUzXDvKqELgFFy2VhcR/Bx/Ir98MyRjHolOd4H0C CNA== X-Received: by 2002:a05:651c:211b:b0:2f1:750d:53a7 with SMTP id 38308e7fff4ca-2f7918e4cabmr96838181fa.8.1726575261925; Tue, 17 Sep 2024 05:14:21 -0700 (PDT) Received: from localhost (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f79d59d494sm10148981fa.140.2024.09.17.05.14.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 05:14:21 -0700 (PDT) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Sep 2024 15:14:17 +0300 Message-Id: <20240917121419.610349-4-martin@martin.st> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240917121419.610349-1-martin@martin.st> References: <20240917121419.610349-1-martin@martin.st> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] aarch64: Print the SVE vector length in libavutil/tests/cpu.c 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: EEcm4ES+dtUW This makes this aspect more visible in test logs. --- libavutil/aarch64/Makefile | 2 ++ libavutil/aarch64/cpu.h | 4 ++++ libavutil/aarch64/cpu_sve.S | 29 +++++++++++++++++++++++++++++ libavutil/tests/cpu.c | 8 ++++++++ 4 files changed, 43 insertions(+) create mode 100644 libavutil/aarch64/cpu_sve.S diff --git a/libavutil/aarch64/Makefile b/libavutil/aarch64/Makefile index eba0151337..992e95e4df 100644 --- a/libavutil/aarch64/Makefile +++ b/libavutil/aarch64/Makefile @@ -4,3 +4,5 @@ OBJS += aarch64/cpu.o \ NEON-OBJS += aarch64/float_dsp_neon.o \ aarch64/tx_float_neon.o \ + +SVE-OBJS += aarch64/cpu_sve.o \ diff --git a/libavutil/aarch64/cpu.h b/libavutil/aarch64/cpu.h index df7becca30..a41b729659 100644 --- a/libavutil/aarch64/cpu.h +++ b/libavutil/aarch64/cpu.h @@ -30,4 +30,8 @@ #define have_sve(flags) CPUEXT(flags, SVE) #define have_sve2(flags) CPUEXT(flags, SVE2) +#if HAVE_SVE +int ff_aarch64_sve_length(void); +#endif + #endif /* AVUTIL_AARCH64_CPU_H */ diff --git a/libavutil/aarch64/cpu_sve.S b/libavutil/aarch64/cpu_sve.S new file mode 100644 index 0000000000..d216ed2c49 --- /dev/null +++ b/libavutil/aarch64/cpu_sve.S @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Martin Storsjo + * + * 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 + */ + +#include "config.h" +#include "asm.S" + +ENABLE_SVE + +function ff_aarch64_sve_length, export=1 + cntb x0 + ret +endfunc diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index 679b538f0f..abe2b057d7 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -23,6 +23,10 @@ #include "libavutil/cpu.h" #include "libavutil/avstring.h" +#if ARCH_AARCH64 +#include "libavutil/aarch64/cpu.h" +#endif + #if HAVE_UNISTD_H #include #endif @@ -161,6 +165,10 @@ int main(int argc, char **argv) print_cpu_flags(cpu_flags_raw, "raw"); print_cpu_flags(cpu_flags_eff, "effective"); printf("threads = %s (cpu_count = %d)\n", threads, cpu_count); +#if ARCH_AARCH64 + if (cpu_flags_raw & AV_CPU_FLAG_SVE) + printf("sve_vector_length = %d\n", 8 * ff_aarch64_sve_length()); +#endif return 0; }