From 9a8be20def31758eabd4918963a8d17e7b3569aa Mon Sep 17 00:00:00 2001 From: George Steed Date: Thu, 21 Mar 2024 16:55:31 +0000 Subject: [PATCH] [AArch64] Add :libyuv_sve library in preparation for SVE kernels This commit only adds the bare minimum to get the new library building through GN, the actual content of row_sve.cc is empty for now until we start porting some kernels across. Bug: libyuv:973 Change-Id: Ibdf4fc258761f3e507d700f27a405099c667ac75 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5424738 Reviewed-by: Frank Barchard --- BUILD.gn | 32 ++++++++++++++++++++++++++++++++ libyuv.gni | 1 + source/row_sve.cc | 27 +++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 source/row_sve.cc diff --git a/BUILD.gn b/BUILD.gn index 32cc013f4..5bbf77ee0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -35,6 +35,9 @@ config("libyuv_config") { if (!libyuv_use_neon) { defines += [ "LIBYUV_DISABLE_NEON" ] } + if (!libyuv_use_sve) { + defines += [ "LIBYUV_DISABLE_SVE" ] + } if (libyuv_disable_rvv) { defines += [ "LIBYUV_DISABLE_RVV" ] } @@ -78,6 +81,10 @@ group("libyuv") { deps += [ ":libyuv_neon" ] } + if (libyuv_use_sve) { + deps += [ ":libyuv_sve" ] + } + if (libyuv_use_msa) { deps += [ ":libyuv_msa" ] } @@ -241,6 +248,31 @@ if (libyuv_use_neon) { } } +if (libyuv_use_sve) { + static_library("libyuv_sve") { + sources = [ + "source/row_sve.cc", + ] + + deps = [ ":libyuv_internal" ] + + public_configs = [ ":libyuv_config" ] + + # Always enable optimization for Release and NaCl builds (to workaround + # crbug.com/538243). + if (!is_debug) { + configs -= [ "//build/config/compiler:default_optimization" ] + + # Enable optimize for speed (-O2) over size (-Os). + # TODO(fbarchard): Consider optimize_speed which is O3. + configs += [ "//build/config/compiler:optimize_max" ] + } + + # SVE2 is an Armv9-A feature. + cflags = [ "-march=armv9-a+sve2" ] + } +} + if (libyuv_use_msa) { static_library("libyuv_msa") { sources = [ diff --git a/libyuv.gni b/libyuv.gni index 343160c36..6add96ad9 100644 --- a/libyuv.gni +++ b/libyuv.gni @@ -18,6 +18,7 @@ declare_args() { libyuv_use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)) + libyuv_use_sve = current_cpu == "arm64" libyuv_use_msa = (current_cpu == "mips64el" || current_cpu == "mipsel") && mips_use_msa libyuv_use_mmi = diff --git a/source/row_sve.cc b/source/row_sve.cc new file mode 100644 index 000000000..670403c4a --- /dev/null +++ b/source/row_sve.cc @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "libyuv/row.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +#if !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__) + +// TODO(libyuv:973) Port kernels to SVE/SVE2. + +#endif // !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__) + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif