Skip to content

Move ExecuTorch-specific stuff in shim to shim_et (try #3) #8647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
root = .
prelude = third-party/prelude
shim = shim
shim_et = shim_et

[repository_aliases]
config = prelude
ovr_config = prelude
toolchains = shim
fbcode = shim
fbcode_macros = shim
fbsource = shim
toolchains = shim_et
fbcode = shim_et
fbcode_macros = shim_et
fbsource = shim_et
buck = shim

[cxx]
Expand Down
4 changes: 2 additions & 2 deletions build/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ function(extract_sources sources_file)

if(ANDROID_ABI)
if("${ANDROID_ABI}" STREQUAL "arm64-v8a")
set(target_platforms_arg "--target-platforms=shim//:android-arm64")
set(target_platforms_arg "--target-platforms=shim_et//:android-arm64")
elseif("${ANDROID_ABI}" STREQUAL "x86_64")
set(target_platforms_arg "--target-platforms=shim//:android-x86_64")
set(target_platforms_arg "--target-platforms=shim_et//:android-x86_64")
else()
message(
FATAL_ERROR
Expand Down
23 changes: 0 additions & 23 deletions shim/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,3 @@ remote_test_execution_toolchain(
name = "remote_test_execution",
visibility = ["PUBLIC"],
)

execution_platform(
name = "android-arm64",
cpu_configuration = "prelude//cpu:arm64",
os_configuration = "prelude//os:android",
# REVIEW: not sure if this is correct
use_windows_path_separators = host_info().os.is_windows,
visibility = ["PUBLIC"],
)

execution_platform(
name = "android-x86_64",
cpu_configuration = "prelude//cpu:x86_64",
os_configuration = "prelude//os:android",
# REVIEW: not sure if this is correct
use_windows_path_separators = host_info().os.is_windows,
visibility = ["PUBLIC"],
)

noop_test_toolchain(
name = "test",
visibility = ["PUBLIC"],
)
16 changes: 0 additions & 16 deletions shim/README.md

This file was deleted.

57 changes: 57 additions & 0 deletions shim_et/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
load("@prelude//platforms:defs.bzl", "execution_platform")
load("@prelude//tests:test_toolchain.bzl", "noop_test_toolchain")
load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain")
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain", "system_python_toolchain")
load("@prelude//toolchains:remote_test_execution.bzl", "remote_test_execution_toolchain")

# Although the non-Android toolchains below are present in shim/BUCK, it appears that we
# have to duplicate them here or builds won't work.
system_cxx_toolchain(
name = "cxx",
cxx_flags = ["-std=c++20"],
visibility = ["PUBLIC"],
)

system_genrule_toolchain(
name = "genrule",
visibility = ["PUBLIC"],
)

system_python_toolchain(
name = "python",
visibility = ["PUBLIC"],
)

system_python_bootstrap_toolchain(
name = "python_bootstrap",
visibility = ["PUBLIC"],
)

execution_platform(
name = "android-arm64",
cpu_configuration = "prelude//cpu:arm64",
os_configuration = "prelude//os:android",
# REVIEW: not sure if this is correct
use_windows_path_separators = host_info().os.is_windows,
visibility = ["PUBLIC"],
)

execution_platform(
name = "android-x86_64",
cpu_configuration = "prelude//cpu:x86_64",
os_configuration = "prelude//os:android",
# REVIEW: not sure if this is correct
use_windows_path_separators = host_info().os.is_windows,
visibility = ["PUBLIC"],
)

noop_test_toolchain(
name = "test",
visibility = ["PUBLIC"],
)

remote_test_execution_toolchain(
name = "remote_test_execution",
visibility = ["PUBLIC"],
)
19 changes: 19 additions & 0 deletions shim_et/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# buck2 shims

The `shim_et/` subtree helps the Meta-internal buck2 build system also work in the
open-source repo.

Shims are how open-source buck2 supports a [line
like](https://github.com/pytorch/executorch/blob/50aa517549d10324147534d91d04a923b76421d6/kernels/optimized/targets.bzl#L1):

```
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
```

In the open-source repo, `fbsource//xplat` (a Meta-internal root) doesn't exist.
The `fbsource = shim_et` line in `../.buckconfig` tells buck2 to look in
[`shim_et/xplat/executorch/build/runtime_wrapper.bzl`](https://github.com/pytorch/executorch/blob/main/shim_et/xplat/executorch/build/runtime_wrapper.bzl)
instead.

NOTE: `tools` is a symlink to `../shim/tools` because `fbsource//`
must refer here, but `fbsource//tools` in particular lives in `shim/`.
1 change: 1 addition & 0 deletions shim_et/tools
Loading