migrate chunk-6 skip-list dirs (existing targets.bzl + extra TARGETS rules)#21382
Conversation
…rch#21145) Summary: Chunk 7B of fbcode/executorch TARGETS->BUCK migration. 5 directories where both a TARGETS file (with extra fbcode-only rules) and a targets.bzl existed. For each: 1. Added the new fbcode-only loads from TARGETS to the top of targets.bzl (deduped against already-present loads). 2. Updated `def define_common_targets(...)` to accept `is_fbcode = False`. 3. Appended the fbcode-only TARGETS body at the end of the function inside an `if is_fbcode:` block so xplat continues to skip those rules. 4. Replaced TARGETS with a thin BUCK calling `define_common_targets(is_fbcode = is_fbcode())`. Directories migrated: - backends/cortex_m/test - examples/models/llama/fb - examples/qualcomm/oss_scripts/llama - examples/qualcomm/oss_scripts/whisper - kernels/fb/custom_ops Reviewed By: mzlee Differential Revision: D109082046
…rules)
Summary:
Chunk 8 of fbcode/executorch TARGETS->BUCK migration. 3 directories that
were skipped from chunk 6 because they already had a targets.bzl, but
their TARGETS file still contained extra fbcode-only rules.
- devtools/etdump/fb/tests: TARGETS adds a python_unittest serialize_test
on top of the cxx_test in targets.bzl. Merged via 7B pattern.
- devtools/etdump/tests: same shape as above. Merged via 7B pattern.
- exir/fb: targets.bzl previously had only module-level constants
(executorch_portable_kernel_lib, executorch_aten_mode_lib) and no
define_common_targets function. Added a new define_common_targets
that early-returns when not is_fbcode and otherwise defines the
bento_deps_* python_library rules from the old TARGETS.
For each, the BUCK file now calls
`define_common_targets(is_fbcode = is_fbcode())` via fbsource_utils.
Differential Revision: D109082055
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21382
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 3 Unrelated FailuresAs of commit e3b6247 with merge base fbd14e6 ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@bigfootjon has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109082055. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Migrates several directories away from TARGETS by moving fbcode-only rules into existing targets.bzl files behind an is_fbcode parameter, and updating BUCK files to call define_common_targets(is_fbcode = is_fbcode()). This continues the TARGETS→BUCK consolidation pattern while keeping shared targets centralized.
Changes:
- Add
is_fbcodeplumbing todefine_common_targets(...)and fold formerTARGETS-only Python rules intotargets.bzlunder fbcode-only conditionals. - Delete
TARGETSfiles and replace them withBUCKfiles that invokedefine_common_targetswithfbsource_utils.is_fbcode(). - Add/adjust fbcode-only test/binary definitions (Python) for these directories as part of the migration.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/qualcomm/oss_scripts/whisper/targets.bzl | Adds is_fbcode param and moves former TARGETS Python rules into fbcode-only branch. |
| examples/qualcomm/oss_scripts/whisper/TARGETS | Deleted; rules migrated into targets.bzl. |
| examples/qualcomm/oss_scripts/whisper/BUCK | Calls define_common_targets(is_fbcode = is_fbcode()). |
| examples/qualcomm/oss_scripts/llama/targets.bzl | Adds is_fbcode param and migrates Python rules from TARGETS; also restructures fbcode vs non-fbcode rule definition. |
| examples/qualcomm/oss_scripts/llama/TARGETS | Deleted; rules migrated into targets.bzl. |
| examples/qualcomm/oss_scripts/llama/BUCK | Calls define_common_targets(is_fbcode = is_fbcode()). |
| devtools/etdump/tests/targets.bzl | Adds is_fbcode param and migrates a Python unittest from deleted TARGETS. |
| devtools/etdump/tests/TARGETS | Deleted; rules migrated into targets.bzl. |
| devtools/etdump/tests/BUCK | New; calls define_common_targets(is_fbcode = is_fbcode()). |
| backends/cortex_m/test/targets.bzl | Adds is_fbcode param and migrates Python unittest from deleted TARGETS. |
| backends/cortex_m/test/TARGETS | Deleted; rules migrated into targets.bzl. |
| backends/cortex_m/test/BUCK | Updates invocation to pass is_fbcode = is_fbcode(). |
Comments suppressed due to low confidence (1)
devtools/etdump/tests/targets.bzl:8
- This docstring still claims the directory should contain both TARGETS and BUCK files, but this PR deletes TARGETS and adds BUCK. Updating the docstring avoids misleading future migrations/refactors.
def define_common_targets(is_fbcode = False):
"""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.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if is_fbcode: | ||
| python_unittest( | ||
| name = "test_replace_quant_nodes", | ||
| srcs = [ | ||
| "test_helpers_passes_utils.py", | ||
| "test_replace_quant_nodes.py", | ||
| ], | ||
| deps = [ | ||
| "//pytorch/ao:torchao", # @manual | ||
| "//caffe2:torch", | ||
| "//executorch/backends/cortex_m/passes:replace_quant_nodes_pass", | ||
| "//executorch/backends/cortex_m/ops:ops", | ||
| ], | ||
| ) |
| def define_common_targets(is_fbcode = False): | ||
| if not is_fbcode: | ||
| runtime.cxx_library( | ||
| name = "runner_lib", |
| # Any targets that should be shared between fbcode and xplat must be defined in | ||
| # targets.bzl. This file can contain xplat-only targets. | ||
| # targets.bzl. | ||
|
|
||
| load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") | ||
| load(":targets.bzl", "define_common_targets") |
Summary:
Chunk 8 of fbcode/executorch TARGETS->BUCK migration. 3 directories that
were skipped from chunk 6 because they already had a targets.bzl, but
their TARGETS file still contained extra fbcode-only rules.
on top of the cxx_test in targets.bzl. Merged via 7B pattern.
(executorch_portable_kernel_lib, executorch_aten_mode_lib) and no
define_common_targets function. Added a new define_common_targets
that early-returns when not is_fbcode and otherwise defines the
bento_deps_* python_library rules from the old TARGETS.
For each, the BUCK file now calls
define_common_targets(is_fbcode = is_fbcode())via fbsource_utils.Differential Revision: D109082055