Skip to content

Commit 18859b0

Browse files
authored
Dtype selective build: fail if not xplat, if portable/optimized not in kernel_deps (#11020)
Pull Request resolved: #10990 #10985 Try to make user error harder for dtype selective build. Currently, if dtype selective build cannot be enabled we silently fallback to regular dtype selective build. This diff: 1. Emits failure when there is nothing in kernel_deps and dtype_selective_build=True. 2. Remove dtype_selective_build=True for cases in (1). 3. Warning that dtype selective build is not enabled if user is not in xplat. ghstack-source-id: 285201952 Differential Revision: [D75027794](https://our.internmc.facebook.com/intern/diff/D75027794/)
1 parent 3e2d104 commit 18859b0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

shim_et/xplat/executorch/codegen/codegen.bzl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,21 @@ 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 "//executorch/kernels/portable:operators" in kernel_deps) and (not "//executorch/kernels/optimized:optimized_operators" in kernel_deps):
646+
fail("""
647+
!!WARNING!! Dtype selective build is available for the portable and optimized kernel libraries.
648+
If you are using those, please add them to `kernel_deps` in `executorch_generated_lib`:
649+
//executorch/kernels/portable:operators
650+
//executorch/kernels/optimized:optimized_operators
651+
This will tell the build system to rebuild portable/optimized with the dtype selective build header.
652+
For examples, see: //executorch/examples/selective_build/targets.bzl
653+
Currently, kernel_deps contains {}.
654+
655+
If you have a custom kernel library, please remove `dtype_selective_build=True`
656+
and use regular selective build.
657+
""".format(kernel_deps))
658+
644659
aten_suffix = "_aten" if aten_mode else ""
645660

646661
# merge functions.yaml with fallback yaml

0 commit comments

Comments
 (0)