Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions kernels/aten/cpu/util/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ def define_common_targets():
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
"ovr_config//os:windows": [],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses
# this branch via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else select({
"DEFAULT": ["-Wno-missing-prototypes"],
"ovr_config//os:windows": [],
}),
deps = [
"//executorch/runtime/kernel:kernel_includes_aten",
Expand Down
6 changes: 5 additions & 1 deletion kernels/portable/cpu/pattern/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def define_common_targets():
exported_headers = [
"pattern.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
exported_deps = [
"//executorch/kernels/portable/cpu/util:broadcast_util",
"//executorch/kernels/portable/cpu/util:functional_util",
Expand Down
60 changes: 50 additions & 10 deletions kernels/portable/cpu/util/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ def define_common_targets():
exported_headers = [
"activation_ops_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
"//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string",
"//executorch/runtime/kernel:kernel_includes",
Expand Down Expand Up @@ -97,7 +101,11 @@ def define_common_targets():
exported_headers = [
"dtype_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
Expand All @@ -109,7 +117,11 @@ def define_common_targets():
exported_headers = [
"elementwise_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
exported_deps = [
":broadcast_indexes_range",
":broadcast_util",
Expand Down Expand Up @@ -141,7 +153,11 @@ def define_common_targets():
exported_headers = [
"advanced_index_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
":broadcast_util",
"//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string",
Expand All @@ -156,7 +172,11 @@ def define_common_targets():
exported_headers = [
"copy_ops_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
exported_deps = [
":broadcast_util",
],
Expand All @@ -172,7 +192,11 @@ def define_common_targets():
exported_headers = [
"distance_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
Expand All @@ -188,7 +212,11 @@ def define_common_targets():
exported_headers = [
"kernel_ops_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
Expand All @@ -201,7 +229,11 @@ def define_common_targets():
exported_headers = [
"matmul_ops_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
":broadcast_util",
"//executorch/runtime/kernel:kernel_includes",
Expand All @@ -218,7 +250,11 @@ def define_common_targets():
exported_headers = [
"padding_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
Expand All @@ -231,7 +267,11 @@ def define_common_targets():
exported_headers = [
"normalization_ops_util.h",
],
compiler_flags = ["-Wno-missing-prototypes"],
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
# ovr_config//os:zephyr is fbsource-internal; OSS bypasses this select via runtime.is_oss.
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"],
deps = [
"//executorch/runtime/kernel:kernel_includes",
],
Expand Down
18 changes: 16 additions & 2 deletions shim_et/xplat/executorch/codegen/codegen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,14 @@ def build_portable_lib(
# Currently fbcode links all dependent libraries through shared
# library, and it blocks users like unit tests to use kernel
# implementation directly. So we enable this for xplat only.
compiler_flags = ["-Wno-missing-prototypes"]
# -Wno-missing-prototypes is Clang-only for C++; GCC (used by Zephyr ARM
# cross-compilation) rejects it with -Werror, so exclude it for Zephyr.
# OSS bypasses the select since ovr_config//os:zephyr is not in the OSS
# buck2 prelude.
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes"],
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else ["-Wno-missing-prototypes"]
if not expose_operator_symbols and is_xplat():
# Removing '-fvisibility=hidden' exposes operator symbols.
# This allows operators to be called outside of the kernel registry.
Expand Down Expand Up @@ -678,7 +685,14 @@ def build_optimized_lib(name, oplist_header_name, portable_header_lib, feature =
# Currently fbcode links all dependent libraries through shared
# library, and it blocks users like unit tests to use kernel
# implementation directly. So we enable this for xplat only.
compiler_flags = ["-Wno-missing-prototypes", "-Wno-pass-failed", "-Wno-global-constructors", "-Wno-shadow"]
# -Wno-missing-prototypes and -Wno-global-constructors are Clang-only for
# C++; GCC (used by Zephyr ARM cross-compilation) rejects them with
# -Werror, so exclude them for Zephyr. OSS bypasses the select since
# ovr_config//os:zephyr is not in the OSS buck2 prelude.
compiler_flags = select({
"DEFAULT": ["-Wno-missing-prototypes", "-Wno-pass-failed", "-Wno-global-constructors", "-Wno-shadow"],
"ovr_config//os:zephyr": ["-Wno-pass-failed", "-Wno-shadow"],
}) if not runtime.is_oss else ["-Wno-missing-prototypes", "-Wno-pass-failed", "-Wno-global-constructors", "-Wno-shadow"]
if not expose_operator_symbols and is_xplat():
# Removing '-fvisibility=hidden' exposes operator symbols.
# This allows operators to be called outside of the kernel registry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,26 @@ def define_op_library(name, compiler_flags, deps):
"{}.cpp".format(name),
],
visibility = ["PUBLIC"],
compiler_flags = [
compiler_flags = (select({
# kernels often have helpers with no prototypes just disabling the warning here as the headers
# are codegend and linked in later
# -Wno-missing-prototypes is Clang-only for C++; GCC (used by
# Zephyr ARM cross-compilation) rejects it with -Werror, so
# exclude it for Zephyr. OSS bypasses the select since
# ovr_config//os:zephyr is not in the OSS buck2 prelude.
"DEFAULT": [
"-Wno-missing-prototypes",
# pragma unroll fails with -Os, don't need to warn us and
# fail Werror builds; see https://godbolt.org/z/zvf85vTsr
"-Wno-pass-failed",
],
"ovr_config//os:zephyr": [
"-Wno-pass-failed",
],
}) if not runtime.is_oss else [
"-Wno-missing-prototypes",
# pragma unroll fails with -Os, don't need to warn us and
# fail Werror builds; see https://godbolt.org/z/zvf85vTsr
"-Wno-pass-failed",
] + compiler_flags + get_compiler_optimization_flags(),
]) + compiler_flags + get_compiler_optimization_flags(),
# sleef needs to be added as a direct dependency of the operator target when building for Android,
# or a linker error may occur. Not sure why this happens; it seems that fbandroid_platform_deps of
# dependencies are not transitive
Expand Down
13 changes: 11 additions & 2 deletions shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,19 @@ def define_op_library(name, deps, android_deps, aten_target, _allow_third_party_
visibility = ["PUBLIC"],
# kernels often have helpers with no prototypes just disabling the warning here as the headers
# are codegend and linked in later
compiler_flags = select({
# -Wno-missing-prototypes is Clang-only for C++; GCC (used by Zephyr
# ARM cross-compilation) rejects it with -Werror, so exclude it for
# Zephyr and Windows builds. OSS bypasses the zephyr branch via
# runtime.is_oss since ovr_config//os:zephyr is not in the OSS
# buck2 prelude.
compiler_flags = (select({
"DEFAULT": ["-Wno-missing-prototypes"],
"ovr_config//os:windows": [],
}) + (
"ovr_config//os:zephyr": [],
}) if not runtime.is_oss else select({
"DEFAULT": ["-Wno-missing-prototypes"],
"ovr_config//os:windows": [],
})) + (
# For shared library build, we don't want to expose symbols of
# kernel implementation (ex torch::executor::native::tanh_out)
# to library users. They should use kernels through registry only.
Expand Down
Loading