Skip to content

Commit 3d80471

Browse files
committed
Dtype selective build: fail if portable/optimized not in kernel_deps
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: 285196226 Differential Revision: [D75027794](https://our.internmc.facebook.com/intern/diff/D75027794/)
1 parent 7d194cf commit 3d80471

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
@@ -546,6 +546,21 @@ def executorch_generated_lib(
546546
if not aten_mode and not functions_yaml_target and not custom_ops_yaml_target:
547547
fail("At least one of functions_yaml_target, custom_ops_yaml_target needs to be provided")
548548

549+
if dtype_selective_build:
550+
if (not "//executorch/kernels/portable:operators" in kernel_deps) and (not "//executorch/kernels/optimized:optimized_operators" in kernel_deps):
551+
fail("""
552+
!!WARNING!! Dtype selective build is available for the portable and optimized kernel libraries.
553+
If you are using those, please add them to `kernel_deps` in `executorch_generated_lib`:
554+
//executorch/kernels/portable:operators
555+
//executorch/kernels/optimized:optimized_operators
556+
This will tell the build system to rebuild portable/optimized with the dtype selective build header.
557+
For examples, see: //executorch/examples/selective_build/targets.bzl
558+
Currently, kernel_deps contains {}.
559+
560+
If you have a custom kernel library, please remove `dtype_selective_build=True`
561+
and use regular selective build.
562+
""".format(kernel_deps))
563+
549564
aten_suffix = "_aten" if aten_mode else ""
550565

551566
# merge functions.yaml with fallback yaml

0 commit comments

Comments
 (0)