[AArch64] Add initial build system support for SME

Extend both the CMake and BUILD.gn configurations to support building a
library with the Arm Scalable Matrix Extension (SME). Add an initial
(empty) rotate_sme.cc source file to populate the library for now.

Change-Id: Icd4bd6a8ce72ba132299b00c99478a18a85d869a
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5588664
Reviewed-by: Justin Green <greenjustin@google.com>
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
George Steed 2024-05-22 10:05:29 +01:00 committed by Frank Barchard
parent 3f657221f0
commit a68b959873
4 changed files with 65 additions and 0 deletions

View File

@ -38,6 +38,9 @@ config("libyuv_config") {
if (!libyuv_use_sve) {
defines += [ "LIBYUV_DISABLE_SVE" ]
}
if (!libyuv_use_sme) {
defines += [ "LIBYUV_DISABLE_SME" ]
}
if (libyuv_disable_rvv) {
defines += [ "LIBYUV_DISABLE_RVV" ]
}
@ -273,6 +276,31 @@ if (libyuv_use_sve) {
}
}
if (libyuv_use_sme) {
static_library("libyuv_sme") {
sources = [
"source/rotate_sme.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" ]
}
# SME is an Armv9-A feature.
cflags = [ "-march=armv9-a+sme" ]
}
}
if (libyuv_use_msa) {
static_library("libyuv_msa") {
sources = [

View File

@ -110,6 +110,12 @@ if(NOT MSVC)
${ly_src_dir}/row_sve.cc)
TARGET_COMPILE_OPTIONS(${ly_lib_name}_sve PRIVATE -march=armv9-a+sve2)
LIST(APPEND ly_lib_parts $<TARGET_OBJECTS:${ly_lib_name}_sve>)
# Enable AArch64 SME kernels.
ADD_LIBRARY(${ly_lib_name}_sme OBJECT
${ly_src_dir}/rotate_sme.cc)
TARGET_COMPILE_OPTIONS(${ly_lib_name}_sme PRIVATE -march=armv9-a+sme)
LIST(APPEND ly_lib_parts $<TARGET_OBJECTS:${ly_lib_name}_sme>)
endif()
endif()

View File

@ -19,6 +19,7 @@ declare_args() {
current_cpu == "arm64" ||
(current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon))
libyuv_use_sve = current_cpu == "arm64"
libyuv_use_sme = current_cpu == "arm64"
libyuv_use_msa =
(current_cpu == "mips64el" || current_cpu == "mipsel") && mips_use_msa
libyuv_use_mmi =

30
source/rotate_sme.cc Normal file
View File

@ -0,0 +1,30 @@
/*
* 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/rotate_row.h"
#include "libyuv/row.h"
#include "libyuv/basic_types.h"
#ifdef __cplusplus
namespace libyuv {
extern "C" {
#endif
#if !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__)
// TODO: Port rotate kernels to SME.
#endif // !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__)
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
#endif