Skip to content

Commit 8cb01a6

Browse files
pytorchbotswolchok
andauthored
Clean up optimized-oss.yaml (#8668)
Pull Request resolved: #8549 We don't need this now that we support log_softmax and gelu in OSS! ghstack-source-id: 268149465 @exported-using-ghexport Differential Revision: [D69475020](https://our.internmc.facebook.com/intern/diff/D69475020/) --------- Co-authored-by: Scott Wolchok <[email protected]>
1 parent a02ba23 commit 8cb01a6

File tree

11 files changed

+27
-155
lines changed

11 files changed

+27
-155
lines changed

build/cmake_deps.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ deps = [
117117
"executorch",
118118
]
119119

120-
[targets.optimized_native_cpu_ops_oss]
120+
[targets.optimized_native_cpu_ops]
121121
buck_targets = [
122-
"//configurations:optimized_native_cpu_ops_oss",
122+
"//configurations:optimized_native_cpu_ops",
123123
]
124124
filters = [
125125
".cpp$",
@@ -437,6 +437,6 @@ deps = [
437437
"portable_kernels",
438438
"quantized_kernels",
439439
"xnnpack_backend",
440-
"optimized_native_cpu_ops_oss",
440+
"optimized_native_cpu_ops",
441441
]
442442
# ---------------------------------- LLama end ----------------------------------

configurations/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ include(${EXECUTORCH_ROOT}/build/Codegen.cmake)
3030
if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
3131
# Merge optimized and portable definitions, taking optimized where available.
3232
merge_yaml(
33-
FUNCTIONS_YAML ${EXECUTORCH_ROOT}/kernels/optimized/optimized-oss.yaml
33+
FUNCTIONS_YAML ${EXECUTORCH_ROOT}/kernels/optimized/optimized.yaml
3434
FALLBACK_YAML ${EXECUTORCH_ROOT}/kernels/portable/functions.yaml OUTPUT_DIR
3535
${CMAKE_CURRENT_BINARY_DIR}
3636
)

configurations/targets.bzl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,3 @@ def define_common_targets():
5050
"@EXECUTORCH_CLIENTS",
5151
],
5252
)
53-
54-
# TODO(T183193812): delete this target after optimized-oss.yaml is gone
55-
executorch_generated_lib(
56-
name = "optimized_native_cpu_ops_oss",
57-
deps = [
58-
"//executorch/kernels/optimized:optimized_operators",
59-
"//executorch/kernels/optimized:optimized_oplist",
60-
"//executorch/kernels/portable:executorch_aten_ops",
61-
"//executorch/kernels/portable:operators",
62-
],
63-
functions_yaml_target = "//executorch/kernels/optimized:optimized-oss.yaml",
64-
fallback_yaml_target = "//executorch/kernels/portable:functions.yaml",
65-
define_static_targets = True,
66-
visibility = [
67-
"//executorch/examples/...",
68-
"@EXECUTORCH_CLIENTS",
69-
],
70-
)

examples/models/llama/runner/targets.bzl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
33
def _get_operator_lib(aten = False):
44
if aten:
55
return ["//executorch/kernels/aten:generated_lib"]
6-
elif runtime.is_oss:
7-
# TODO(T183193812): delete this path after optimized-oss.yaml is no more.
8-
return ["//executorch/configurations:optimized_native_cpu_ops_oss", "//executorch/extension/llm/custom_ops:custom_ops"]
96
else:
107
return ["//executorch/configurations:optimized_native_cpu_ops", "//executorch/extension/llm/custom_ops:custom_ops"]
118

129
def get_qnn_dependency():
1310
# buck build -c executorch.enable_qnn=true //executorch/examples/models/llama/runner:runner
1411
# Check if QNN is enabled before including the dependency
1512
if native.read_config("executorch", "enable_qnn", "false") == "true":
16-
# //executorch/backends/qualcomm:qnn_executorch_backend doesn't work,
13+
# //executorch/backends/qualcomm:qnn_executorch_backend doesn't work,
1714
# likely due to it's an empty library with dependency only
1815
return [
1916
"//executorch/backends/qualcomm/runtime:runtime",

kernels/optimized/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ target_compile_options(cpublas PUBLIC ${_common_compile_options})
4949

5050
# Generate C++ bindings to register kernels into both PyTorch (for AOT) and
5151
# Executorch (for runtime). Here select all ops in optimized.yaml
52-
set(_yaml "${CMAKE_CURRENT_LIST_DIR}/optimized-oss.yaml")
52+
set(_yaml "${CMAKE_CURRENT_LIST_DIR}/optimized.yaml")
5353
gen_selected_ops(LIB_NAME "optimized_ops_lib" OPS_SCHEMA_YAML "${_yaml}")
5454

5555
generate_bindings_for_kernels(
5656
LIB_NAME "optimized_ops_lib" FUNCTIONS_YAML
57-
${CMAKE_CURRENT_SOURCE_DIR}/optimized-oss.yaml
57+
${CMAKE_CURRENT_SOURCE_DIR}/optimized.yaml
5858
ADD_EXCEPTION_BOUNDARY
5959
)
6060
message("Generated files ${gen_command_sources}")

kernels/optimized/cpu/targets.bzl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2-
load("@fbsource//xplat/executorch/kernels/optimized:op_registration_util.bzl", "define_op_target", "is_op_disabled", "op_target")
2+
load("@fbsource//xplat/executorch/kernels/optimized:op_registration_util.bzl", "define_op_target", "op_target")
33

44
_OPTIMIZED_ATEN_OPS = (
55
op_target(
@@ -111,13 +111,11 @@ def define_common_targets():
111111
TARGETS and BUCK files that call this function.
112112
"""
113113

114-
enabled_ops = [op for op in _OPTIMIZED_ATEN_OPS if not is_op_disabled(op["name"])]
115-
116114
# Define build targets for all operators registered in the tables above.
117-
for op in enabled_ops:
115+
for op in _OPTIMIZED_ATEN_OPS:
118116
define_op_target(**op)
119117

120-
aten_op_targets = [":{}".format(op["name"]) for op in enabled_ops]
118+
aten_op_targets = [":{}".format(op["name"]) for op in _OPTIMIZED_ATEN_OPS]
121119
all_op_targets = aten_op_targets
122120

123121
runtime.cxx_library(

kernels/optimized/op_registration_util.bzl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
22
load("@fbsource//xplat/executorch/build:selects.bzl", "selects")
33
load(
44
"@fbsource//xplat/executorch/kernels/optimized:lib_defs.bzl",
5-
"get_vec_preprocessor_flags",
65
"get_vec_deps",
6+
"get_vec_preprocessor_flags",
77
)
88
load(
99
"@fbsource//xplat/executorch/kernels/portable:op_registration_util.bzl",
@@ -137,7 +137,3 @@ def define_op_target(name, compiler_flags, deps):
137137
compiler_flags = compiler_flags,
138138
deps = deps,
139139
)
140-
141-
def is_op_disabled(name):
142-
# All ops are enabled for internal builds.
143-
return False

kernels/optimized/optimized-oss.yaml

Lines changed: 0 additions & 96 deletions
This file was deleted.

kernels/optimized/targets.bzl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ def define_common_targets(is_fbcode=False):
1919
],
2020
)
2121

22-
runtime.export_file(
23-
name = "optimized-oss.yaml",
24-
visibility = [
25-
"//executorch/...",
26-
"@EXECUTORCH_CLIENTS",
27-
],
28-
)
29-
3022
runtime.cxx_library(
3123
name = "optimized_operators",
3224
srcs = [],

kernels/test/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,17 +270,15 @@ set(_optimized_kernels_test_sources
270270
"op_le_test.cpp"
271271
"op_linear_test.cpp"
272272
"op_log_softmax_test.cpp"
273+
"op_mm_test.cpp"
273274
"op_mul_test.cpp"
274275
"op_native_layer_norm_test.cpp"
275276
"op_neg_test.cpp"
276277
"op_sub_test.cpp"
277278
"UnaryUfuncRealHBBF16ToFloatHBF16Test.cpp"
278-
${CMAKE_CURRENT_BINARY_DIR}/include/portable/executorch/kernels/test/supported_features.cpp
279+
${CMAKE_CURRENT_BINARY_DIR}/include/optimized/executorch/kernels/test/supported_features.cpp
279280
)
280281

281-
# We don't have sleef on OSS so we don't have log_softmax
282-
list(REMOVE_ITEM _optimized_kernels_test_sources "op_log_softmax_test.cpp")
283-
284282
et_cxx_test(
285283
optimized_kernels_test
286284
SOURCES

shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
99
load("@fbsource//xplat/executorch/build:selects.bzl", "selects")
1010
load(
1111
"@fbsource//xplat/executorch/kernels/optimized:lib_defs.bzl",
12+
"get_vec_deps",
1213
"get_vec_preprocessor_flags",
1314
)
15+
load(
16+
"@fbsource//xplat/executorch/kernels/portable:op_registration_util.bzl",
17+
"get_compiler_optimization_flags",
18+
)
1419

1520
def op_target(name, deps = [], compiler_flags = []):
1621
"""Registers an optimized implementation for an operator overload group.
@@ -94,12 +99,17 @@ def define_op_library(name, compiler_flags, deps):
9499
"//executorch/kernels/test/...",
95100
"@EXECUTORCH_CLIENTS",
96101
],
97-
# kernels often have helpers with no prototypes just disabling the warning here as the headers
98-
# are codegend and linked in later
99-
compiler_flags = ["-Wno-missing-prototypes"],
102+
compiler_flags = [
103+
# kernels often have helpers with no prototypes just disabling the warning here as the headers
104+
# are codegend and linked in later
105+
"-Wno-missing-prototypes",
106+
# pragma unroll fails with -Os, don't need to warn us and
107+
# fail Werror builds; see https://godbolt.org/z/zvf85vTsr
108+
"-Wno-pass-failed",
109+
] + get_compiler_optimization_flags(),
100110
deps = [
101111
"//executorch/runtime/kernel:kernel_includes",
102-
] + augmented_deps,
112+
] + augmented_deps + get_vec_deps(),
103113
preprocessor_flags = get_vec_preprocessor_flags(),
104114
# sleef needs to be added as a direct dependency of the operator target when building for Android,
105115
# or a linker error may occur. Not sure why this happens; it seems that fbandroid_platform_deps of
@@ -134,8 +144,3 @@ def define_op_target(name, compiler_flags, deps):
134144
compiler_flags = compiler_flags,
135145
deps = deps,
136146
)
137-
138-
def is_op_disabled(name):
139-
# TODO (gjcomer) Enable ops with sleef dependency in OSS
140-
disabled_ops = ["op_log_softmax"]
141-
return name in disabled_ops

0 commit comments

Comments
 (0)