Skip to content

migrate chunk-6 skip-list dirs (existing targets.bzl + extra TARGETS rules)#21382

Merged
meta-codesync[bot] merged 2 commits into
pytorch:mainfrom
bigfootjon:export-D109082055
Jul 24, 2026
Merged

migrate chunk-6 skip-list dirs (existing targets.bzl + extra TARGETS rules)#21382
meta-codesync[bot] merged 2 commits into
pytorch:mainfrom
bigfootjon:export-D109082055

Conversation

@bigfootjon

Copy link
Copy Markdown
Member

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

…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
Copilot AI review requested due to automatic review settings July 24, 2026 15:08
@pytorch-bot

pytorch-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🔗 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 Failures

As of commit e3b6247 with merge base fbd14e6 (image):

NEW FAILURES - The following jobs have failed:

  • Cadence Build & Test / hifi-build / hifi4 (gh)
    Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.
  • Cadence Build & Test / vision-build / vision (gh)
    Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.

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.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 24, 2026
@meta-codesync

meta-codesync Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@bigfootjon has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109082055.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_fbcode plumbing to define_common_targets(...) and fold former TARGETS-only Python rules into targets.bzl under fbcode-only conditionals.
  • Delete TARGETS files and replace them with BUCK files that invoke define_common_targets with fbsource_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.

Comment on lines +38 to +51
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",
],
)
Comment on lines +10 to +13
def define_common_targets(is_fbcode = False):
if not is_fbcode:
runtime.cxx_library(
name = "runner_lib",
Comment on lines 1 to 5
# 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")
@meta-codesync
meta-codesync Bot merged commit 2439920 into pytorch:main Jul 24, 2026
205 of 215 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants