merge fbcode-only TARGETS rules into existing targets.bzl files (#21145)#21145
merge fbcode-only TARGETS rules into existing targets.bzl files (#21145)#21145bigfootjon wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21145
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 6181ea1 with merge base 007fc2b ( 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 D109082046. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Migrates fbcode-only Buck TARGETS rules into the corresponding targets.bzl files (with an is_fbcode gate) and replaces TARGETS with thin BUCK wrappers that call define_common_targets(is_fbcode = is_fbcode()), supporting the ongoing TARGETS→BUCK migration while keeping xplat behavior unchanged.
Changes:
- Introduces/updates
define_common_targets(is_fbcode = False)and gates fbcode-only rules behindif is_fbcode. - Replaces legacy
TARGETSfiles withBUCKwrappers that call intotargets.bzl. - Adds required fbcode-only loads to
targets.bzlwhere needed.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/end2end/targets.bzl | New fbcode-gated target definitions migrated from TARGETS. |
| test/end2end/TARGETS | Removed; content migrated into targets.bzl. |
| test/end2end/BUCK | Now calls define_common_targets(is_fbcode = is_fbcode()). |
| exir/tests/targets.bzl | New fbcode-gated test/library targets migrated from TARGETS. |
| exir/tests/TARGETS | Removed; content migrated into targets.bzl. |
| exir/tests/BUCK | Now calls define_common_targets(is_fbcode = is_fbcode()). |
| exir/dialects/edge/test/targets.bzl | New fbcode-gated test targets migrated from TARGETS. |
| exir/dialects/edge/test/TARGETS | Removed; content migrated into targets.bzl. |
| exir/dialects/edge/test/BUCK | Now calls define_common_targets(is_fbcode = is_fbcode()). |
| examples/qualcomm/oss_scripts/whisper/targets.bzl | Adds is_fbcode gating for fbcode-only Python targets; keeps OSS targets unconditional. |
| examples/qualcomm/oss_scripts/whisper/TARGETS | Removed; content migrated into targets.bzl. |
| examples/qualcomm/oss_scripts/whisper/BUCK | Now calls define_common_targets(is_fbcode = is_fbcode()). |
| examples/qualcomm/oss_scripts/llama/targets.bzl | Adds is_fbcode gating for fbcode-only Python targets/aliases; keeps OSS targets unconditional. |
| examples/qualcomm/oss_scripts/llama/TARGETS | Removed; content migrated into targets.bzl. |
| examples/qualcomm/oss_scripts/llama/BUCK | Now calls define_common_targets(is_fbcode = is_fbcode()). |
| backends/cortex_m/test/targets.bzl | Adds is_fbcode gating and inlines the fbcode-only unittest previously in TARGETS. |
| backends/cortex_m/test/TARGETS | Removed; content migrated into targets.bzl. |
| backends/cortex_m/test/BUCK | Now calls define_common_targets(is_fbcode = is_fbcode()). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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", | ||
| ], | ||
| ) |
| # Any targets that should be shared between fbcode and xplat must be defined in | ||
| # targets.bzl. | ||
|
|
||
| load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") | ||
| load(":targets.bzl", "define_common_targets") |
| def define_common_targets(is_fbcode = False): | ||
| if not is_fbcode: | ||
| return | ||
|
|
||
| # @noautodeps | ||
|
|
||
|
|
||
|
|
||
| runtime.python_library( |
fd8d811 to
723c1b7
Compare
…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
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
backends/cortex_m/test/targets.bzl:44
python_unittesthere no longer setsTEST_RUNTIME_IS_NOT_OSS.backends/cortex_m/test/conftest.pychecks this env var inpytest_configure()to decide whether to import torch early; without it, fbcode packaged test runs may import torch during collection/config and fail (this is why the old TARGETS rule set it). Consider restoring the env setting on this test target.
if is_fbcode:
python_unittest(
name = "test_replace_quant_nodes",
srcs = [
"test_helpers_passes_utils.py",
"test_replace_quant_nodes.py",
],
…rch#21145) Summary: Pull Request resolved: pytorch#21145 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
723c1b7 to
6181ea1
Compare
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:
(deduped against already-present loads).
def define_common_targets(...)to acceptis_fbcode = False.an
if is_fbcode:block so xplat continues to skip those rules.define_common_targets(is_fbcode = is_fbcode()).Directories migrated:
Reviewed By: mzlee
Differential Revision: D109082046