Skip to content

Commit ce37a0a

Browse files
committed
Dtype selective build: fail if not xplat, if portable/optimized not in kernel_deps
#10985 Try to make user error harder for dtype selective build. Emit warning for now, as too many failures when set to failure :( For example: ``` buck2 build //xplat/sgr/resources/tests/handwriting:pkg buck2 build fbsource//xplat/sgr/resources/mwa:main_pkg_libAndroid Differential Revision: [D75027794](https://our.internmc.facebook.com/intern/diff/D75027794/) [ghstack-poisoned]
1 parent bbf5ae5 commit ce37a0a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

shim_et/xplat/executorch/codegen/codegen.bzl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,26 @@ def executorch_generated_lib(
641641
if not aten_mode and not functions_yaml_target and not custom_ops_yaml_target:
642642
fail("At least one of functions_yaml_target, custom_ops_yaml_target needs to be provided")
643643

644+
if dtype_selective_build:
645+
if not is_xplat():
646+
warning("""
647+
!!WARNING!! Dtype_selective_build is only available in xplat.
648+
Proceeding without dtype selective build for lib: {}.""".format(name))
649+
650+
# Dtype selective build is enabled on portable and optimized kernel libraries.
651+
if (not "//executorch/kernels/portable:operators" in kernel_deps) and (not "//executorch/kernels/optimized:optimized_operators" in kernel_deps):
652+
warning("""
653+
!!WARNING!! Dtype_selective_build is enabled but kernel_deps does not contain portable or optimized dependencies.
654+
Please add one of these to kernel_deps in `executorch_generated_lib`:
655+
//executorch/kernels/portable:operators
656+
//executorch/kernels/optimized:optimized_operators
657+
This will tell the build system to rebuild portable/optimized with dtype selective build enabled.
658+
For examples, see: //executorch/examples/selective_build/targets.bzl
659+
Currently, kernel_deps contains {}.
660+
661+
Proceeding without dtype selective build.
662+
""".format(kernel_deps))
663+
644664
aten_suffix = "_aten" if aten_mode else ""
645665

646666
# merge functions.yaml with fallback yaml

0 commit comments

Comments
 (0)