From 32058ee32af472512e4cbf927600e6c33f8898f1 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 19 Feb 2025 13:27:55 -0800 Subject: [PATCH 1/4] Update [ghstack-poisoned] --- .buckconfig | 9 +-- build/Utils.cmake | 4 +- shim/BUCK | 23 -------- shim_et/BUCK | 57 +++++++++++++++++++ .../xplat/executorch/backends/backends.bzl | 0 .../backends/qualcomm/qnn_version.bzl | 0 .../xnnpack/third-party/third_party_libs.bzl | 0 .../xplat/executorch/build/env_interface.bzl | 0 .../executorch/build/runtime_wrapper.bzl | 0 .../xplat/executorch/build/selects.bzl | 0 .../xplat/executorch/build/type_defs.bzl | 0 .../xplat/executorch/codegen/codegen.bzl | 0 .../extension/pybindings/pybindings.bzl | 0 .../executorch/kernels/optimized/lib_defs.bzl | 0 .../optimized/op_registration_util.bzl | 0 .../kernels/portable/op_registration_util.bzl | 0 .../xplat/executorch/kernels/test/util.bzl | 0 17 files changed, 64 insertions(+), 29 deletions(-) create mode 100644 shim_et/BUCK rename {shim => shim_et}/xplat/executorch/backends/backends.bzl (100%) rename {shim => shim_et}/xplat/executorch/backends/qualcomm/qnn_version.bzl (100%) rename {shim => shim_et}/xplat/executorch/backends/xnnpack/third-party/third_party_libs.bzl (100%) rename {shim => shim_et}/xplat/executorch/build/env_interface.bzl (100%) rename {shim => shim_et}/xplat/executorch/build/runtime_wrapper.bzl (100%) rename {shim => shim_et}/xplat/executorch/build/selects.bzl (100%) rename {shim => shim_et}/xplat/executorch/build/type_defs.bzl (100%) rename {shim => shim_et}/xplat/executorch/codegen/codegen.bzl (100%) rename {shim => shim_et}/xplat/executorch/extension/pybindings/pybindings.bzl (100%) rename {shim => shim_et}/xplat/executorch/kernels/optimized/lib_defs.bzl (100%) rename {shim => shim_et}/xplat/executorch/kernels/optimized/op_registration_util.bzl (100%) rename {shim => shim_et}/xplat/executorch/kernels/portable/op_registration_util.bzl (100%) rename {shim => shim_et}/xplat/executorch/kernels/test/util.bzl (100%) diff --git a/.buckconfig b/.buckconfig index 7a4aecd9710..a7c48881bb3 100644 --- a/.buckconfig +++ b/.buckconfig @@ -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] diff --git a/build/Utils.cmake b/build/Utils.cmake index a27edf33669..c26f46545ef 100644 --- a/build/Utils.cmake +++ b/build/Utils.cmake @@ -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 diff --git a/shim/BUCK b/shim/BUCK index 77f3742e2dc..55fdd5bb03f 100644 --- a/shim/BUCK +++ b/shim/BUCK @@ -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"], -) diff --git a/shim_et/BUCK b/shim_et/BUCK new file mode 100644 index 00000000000..a1a9bdaf65d --- /dev/null +++ b/shim_et/BUCK @@ -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"], +) diff --git a/shim/xplat/executorch/backends/backends.bzl b/shim_et/xplat/executorch/backends/backends.bzl similarity index 100% rename from shim/xplat/executorch/backends/backends.bzl rename to shim_et/xplat/executorch/backends/backends.bzl diff --git a/shim/xplat/executorch/backends/qualcomm/qnn_version.bzl b/shim_et/xplat/executorch/backends/qualcomm/qnn_version.bzl similarity index 100% rename from shim/xplat/executorch/backends/qualcomm/qnn_version.bzl rename to shim_et/xplat/executorch/backends/qualcomm/qnn_version.bzl diff --git a/shim/xplat/executorch/backends/xnnpack/third-party/third_party_libs.bzl b/shim_et/xplat/executorch/backends/xnnpack/third-party/third_party_libs.bzl similarity index 100% rename from shim/xplat/executorch/backends/xnnpack/third-party/third_party_libs.bzl rename to shim_et/xplat/executorch/backends/xnnpack/third-party/third_party_libs.bzl diff --git a/shim/xplat/executorch/build/env_interface.bzl b/shim_et/xplat/executorch/build/env_interface.bzl similarity index 100% rename from shim/xplat/executorch/build/env_interface.bzl rename to shim_et/xplat/executorch/build/env_interface.bzl diff --git a/shim/xplat/executorch/build/runtime_wrapper.bzl b/shim_et/xplat/executorch/build/runtime_wrapper.bzl similarity index 100% rename from shim/xplat/executorch/build/runtime_wrapper.bzl rename to shim_et/xplat/executorch/build/runtime_wrapper.bzl diff --git a/shim/xplat/executorch/build/selects.bzl b/shim_et/xplat/executorch/build/selects.bzl similarity index 100% rename from shim/xplat/executorch/build/selects.bzl rename to shim_et/xplat/executorch/build/selects.bzl diff --git a/shim/xplat/executorch/build/type_defs.bzl b/shim_et/xplat/executorch/build/type_defs.bzl similarity index 100% rename from shim/xplat/executorch/build/type_defs.bzl rename to shim_et/xplat/executorch/build/type_defs.bzl diff --git a/shim/xplat/executorch/codegen/codegen.bzl b/shim_et/xplat/executorch/codegen/codegen.bzl similarity index 100% rename from shim/xplat/executorch/codegen/codegen.bzl rename to shim_et/xplat/executorch/codegen/codegen.bzl diff --git a/shim/xplat/executorch/extension/pybindings/pybindings.bzl b/shim_et/xplat/executorch/extension/pybindings/pybindings.bzl similarity index 100% rename from shim/xplat/executorch/extension/pybindings/pybindings.bzl rename to shim_et/xplat/executorch/extension/pybindings/pybindings.bzl diff --git a/shim/xplat/executorch/kernels/optimized/lib_defs.bzl b/shim_et/xplat/executorch/kernels/optimized/lib_defs.bzl similarity index 100% rename from shim/xplat/executorch/kernels/optimized/lib_defs.bzl rename to shim_et/xplat/executorch/kernels/optimized/lib_defs.bzl diff --git a/shim/xplat/executorch/kernels/optimized/op_registration_util.bzl b/shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl similarity index 100% rename from shim/xplat/executorch/kernels/optimized/op_registration_util.bzl rename to shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl diff --git a/shim/xplat/executorch/kernels/portable/op_registration_util.bzl b/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl similarity index 100% rename from shim/xplat/executorch/kernels/portable/op_registration_util.bzl rename to shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl diff --git a/shim/xplat/executorch/kernels/test/util.bzl b/shim_et/xplat/executorch/kernels/test/util.bzl similarity index 100% rename from shim/xplat/executorch/kernels/test/util.bzl rename to shim_et/xplat/executorch/kernels/test/util.bzl From 05d5be1834f0dda4cc92e9aea38dad7cd1287d6a Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 19 Feb 2025 13:33:29 -0800 Subject: [PATCH 2/4] Update [ghstack-poisoned] --- {shim => shim_et}/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {shim => shim_et}/README.md (55%) diff --git a/shim/README.md b/shim_et/README.md similarity index 55% rename from shim/README.md rename to shim_et/README.md index 85933e51b2c..701963aabb5 100644 --- a/shim/README.md +++ b/shim_et/README.md @@ -1,6 +1,6 @@ # buck2 shims -The `shim/` subtree helps the Meta-internal buck2 build system also work in the +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 @@ -11,6 +11,6 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") ``` In the open-source repo, `fbsource//xplat` (a Meta-internal root) doesn't exist. -The `shim = shim` line in `../.buckconfig` tells buck2 to look in -[`shim/xplat/executorch/build/runtime_wrapper.bzl`](https://github.com/pytorch/executorch/blob/main/shim/xplat/executorch/build/runtime_wrapper.bzl) +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. From 77189afb6c468e2855df022e0da78148d7ed4250 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 19 Feb 2025 14:09:11 -0800 Subject: [PATCH 3/4] Update [ghstack-poisoned] --- shim_et/tools | 1 + 1 file changed, 1 insertion(+) create mode 120000 shim_et/tools diff --git a/shim_et/tools b/shim_et/tools new file mode 120000 index 00000000000..0b2cfeed777 --- /dev/null +++ b/shim_et/tools @@ -0,0 +1 @@ +../shim/tools \ No newline at end of file From 8574dc7bcd9de99fcb034b49f291ba1ff0714a1d Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 19 Feb 2025 14:10:47 -0800 Subject: [PATCH 4/4] Update [ghstack-poisoned] --- shim_et/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shim_et/README.md b/shim_et/README.md index 701963aabb5..a9e55273b0b 100644 --- a/shim_et/README.md +++ b/shim_et/README.md @@ -14,3 +14,6 @@ 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/`.