Skip to content

Commit

Permalink
Don't define aten-mode targets in OSS (#8661)
Browse files Browse the repository at this point in the history
Define get_aten_mode_options in runtime_wrapper and use it.

Test Plan: buck2 build //runtime/... has many fewer errors now (aten-mode targets were failing)
  • Loading branch information
swolchok authored Feb 25, 2025
1 parent e367685 commit f1a7d60
Show file tree
Hide file tree
Showing 30 changed files with 61 additions and 57 deletions.
4 changes: 2 additions & 2 deletions devtools/bundled_program/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")
runtime.cxx_library(
name = "runtime" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions devtools/etdump/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

SCALAR_TYPE_STEM = "scalar_type"
SCALAR_TYPE = SCALAR_TYPE_STEM + ".fbs"
Expand Down Expand Up @@ -87,7 +87,7 @@ def define_common_targets():
exported_external_deps = ["flatccrt"],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""
runtime.cxx_library(
name = "etdump_flatcc" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions extension/evalue_util/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions extension/evalue_util/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

runtime.cxx_test(
Expand Down
4 changes: 2 additions & 2 deletions extension/module/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions extension/module/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load(
"ANDROID",
"CXX",
)
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -12,7 +12,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_test(
Expand Down
4 changes: 2 additions & 2 deletions extension/parallel/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions extension/runner_util/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions extension/runner_util/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets(is_fbcode = False):
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets(is_fbcode = False):
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

# TODO(dbort): Find a way to make these run for ANDROID/APPLE in xplat. The
Expand Down
4 changes: 2 additions & 2 deletions extension/tensor/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions extension/tensor/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_test(
Expand Down
4 changes: 2 additions & 2 deletions extension/training/module/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions extension/training/optimizer/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

# if aten_mode:
Expand Down
4 changes: 2 additions & 2 deletions extension/training/optimizer/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""
runtime.cxx_test(
name = "sgd_test" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions kernels/prim_ops/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions kernels/quantized/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib", "exir_custom_ops_aot_lib")

def define_common_targets():
Expand Down Expand Up @@ -77,7 +77,7 @@ def define_common_targets():
],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions runtime/backend/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")
runtime.cxx_library(
name = "interface" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/exec_aten/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

# Depend on this target if your types (Tensor, ArrayRef, etc) should be flexible between ATen and executor
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/exec_aten/testing_util/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

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
TARGETS and BUCK files that call this function.
"""
for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/exec_aten/util/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets():
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

exported_preprocessor_flags_ = []
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/exec_aten/util/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand Down Expand Up @@ -35,7 +35,7 @@ def define_common_targets():
],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""
runtime.cxx_test(
name = "tensor_util_test" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def event_tracer_enabled():
return native.read_config("executorch", "event_tracer_enabled", "false") == "true"
Expand Down Expand Up @@ -82,7 +82,7 @@ def define_common_targets():
],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")
runtime.cxx_library(
name = "evalue" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
Expand Down Expand Up @@ -102,7 +102,7 @@ def define_common_targets():
],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

runtime.cxx_test(
Expand Down
4 changes: 2 additions & 2 deletions runtime/executor/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def _program_preprocessor_flags():
"""Returns the preprocessor_flags to use when building Program.cpp"""
Expand Down Expand Up @@ -42,7 +42,7 @@ def define_common_targets():
],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""
runtime.cxx_library(
name = "program" + aten_suffix,
Expand Down
4 changes: 2 additions & 2 deletions runtime/executor/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def define_common_targets(is_fbcode = False):
"""Defines targets that should be shared between fbcode and xplat.
Expand All @@ -7,7 +7,7 @@ def define_common_targets(is_fbcode = False):
TARGETS and BUCK files that call this function.
"""

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")

runtime.cxx_library(
Expand Down
4 changes: 2 additions & 2 deletions runtime/kernel/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")

def _operator_registry_preprocessor_flags():
max_kernel_num = native.read_config("executorch", "max_kernel_num", None)
Expand Down Expand Up @@ -51,7 +51,7 @@ def define_common_targets():
preprocessor_flags = ["-DMAX_KERNEL_NUM=1"],
)

for aten_mode in (True, False):
for aten_mode in get_aten_mode_options():
aten_suffix = "_aten" if aten_mode else ""

runtime.cxx_library(
Expand Down
Loading

0 comments on commit f1a7d60

Please sign in to comment.