Skip to content

Commit

Permalink
Remove buck-config dtype selective build (#3931)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #3931

Remove tests and deps used in previous dtype selective build.

Reviewed By: larryliu0820

Differential Revision: D58394394

fbshipit-source-id: bc8b69aa1509e4550e0b1b3cbf605810a973f0e3
  • Loading branch information
lucylq authored and facebook-github-bot committed Jun 11, 2024
1 parent dcf00b7 commit 0ed71a2
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 133 deletions.
2 changes: 1 addition & 1 deletion kernels/portable/cpu/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets(is_fbcode = True)
define_common_targets()
64 changes: 1 addition & 63 deletions kernels/portable/cpu/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib")
load("@fbsource//xplat/executorch/kernels/portable:op_registration_util.bzl", "define_op_target", "op_target")

# Operators that are listed in `functions.yaml`, and are thus compatible with
Expand Down Expand Up @@ -1008,7 +1007,7 @@ _CUSTOM_OPS = (
),
)

def define_common_targets(is_fbcode = False):
def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
Expand Down Expand Up @@ -1065,30 +1064,11 @@ def define_common_targets(is_fbcode = False):
],
)

dtype_selective_build_lib = native.read_config("executorch", "dtype_selective_build_lib", None)
if dtype_selective_build_lib != None:
# retrieve selected_op_variants.h from codegen
genrule_name = dtype_selective_build_lib + "_et_op_dtype_gen[selected_op_variants]"
runtime.cxx_library(
name = "dtype_headers",
srcs = [],
exported_headers = {
"selected_op_variants.h": genrule_name,
},
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)

# Only for use by targets in this directory.
runtime.cxx_library(
name = "scalar_utils",
srcs = [],
# include dtype selective build flag and header
exported_preprocessor_flags = ["-DEXECUTORCH_SELECTIVE_BUILD_DTYPE"] if dtype_selective_build_lib != None else [],
exported_headers = ["scalar_utils.h", "selective_build.h"],
exported_deps = [":dtype_headers"] if dtype_selective_build_lib != None else [],
visibility = [
"//executorch/kernels/portable/cpu/...",
"//executorch/kernels/optimized/cpu/...",
Expand All @@ -1100,48 +1080,6 @@ def define_common_targets(is_fbcode = False):
],
)

# dtype selective build test artifacts
if is_fbcode:
et_operator_library(
name = "add_model",
model = "fbcode//executorch/test/models:exported_programs[ModuleAdd.pte]",
)

executorch_generated_lib(
name = "add_model_lib",
functions_yaml_target = "//executorch/kernels/portable:functions.yaml",
kernel_deps = ["//executorch/kernels/portable:operators"],
deps = [":add_model"],
visibility = ["//executorch/kernels/..."],
)

runtime.cxx_library(
name = "dtype_headers_TEST_ONLY",
srcs = [],
exported_headers = {
"selected_op_variants.h": ":add_model_lib_et_op_dtype_gen[selected_op_variants]",
},
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)

runtime.cxx_library(
name = "scalar_utils_TEST_ONLY",
srcs = [],
exported_preprocessor_flags = ["-DEXECUTORCH_SELECTIVE_BUILD_DTYPE"],
exported_headers = ["scalar_utils.h", "selective_build.h"],
exported_deps = [":dtype_headers_TEST_ONLY"],
visibility = [
"//executorch/kernels/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/runtime/core/exec_aten/util:scalar_type_util",
],
)

# Used for dtype selective build. Collect source and header files.
runtime.filegroup(
name = "portable_source_files",
Expand Down
2 changes: 1 addition & 1 deletion kernels/portable/cpu/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def define_common_targets():
name = "scalar_utils_test",
srcs = ["scalar_utils_test.cpp"],
deps = [
"//executorch/kernels/portable/cpu:scalar_utils_TEST_ONLY",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/runtime/core/exec_aten/util:tensor_util",
],
)
Expand Down
2 changes: 1 addition & 1 deletion kernels/test/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets(is_fbcode = True)
define_common_targets()

python_unittest(
name = "gen_supported_features_test",
Expand Down
54 changes: 0 additions & 54 deletions kernels/test/dtype_selective_build_test.cpp

This file was deleted.

14 changes: 1 addition & 13 deletions kernels/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def make_example_generated_op_test_target():
"//executorch/kernels/test:function_header_wrapper_portable",
)

def define_common_targets(is_fbcode = False):
def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
Expand Down Expand Up @@ -303,15 +303,3 @@ def define_common_targets(is_fbcode = False):
_common_op_test("op_zeros_test", ["aten", "portable"])

make_example_generated_op_test_target()

# dtype selective build test
if is_fbcode:
runtime.cxx_test(
name = "dtype_selective_build_test",
srcs = ["dtype_selective_build_test.cpp"],
deps = [
"//executorch/kernels/portable/cpu:scalar_utils_TEST_ONLY",
"//executorch/runtime/core/exec_aten:lib",
],
preprocessor_flags = ["-DEXECUTORCH_SELECTIVE_BUILD_DTYPE"],
)

0 comments on commit 0ed71a2

Please sign in to comment.