Skip to content

Commit 555a2c2

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 Differential Revision: [D75027794](https://our.internmc.facebook.com/intern/diff/D75027794/) [ghstack-poisoned]
1 parent bbf5ae5 commit 555a2c2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

shim_et/xplat/executorch/codegen/codegen.bzl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,20 @@ 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("WARNING: dtype_selective_build is only available in xplat. Proceeding without dtype selective build for lib: {}.".format(name))
647+
648+
# Dtype selective build is enabled on portable and optimized kernel libraries.
649+
if (not "//executorch/kernels/portable:operators" in kernel_deps) and (not "//executorch/kernels/optimized:optimized_operators" in kernel_deps):
650+
fail("""Dtype_selective_build is enabled and kernel_deps does not contain portable or optimized dependencies.
651+
Please add one of these to kernel_deps:
652+
//executorch/kernels/portable:operators
653+
//executorch/kernels/optimized:optimized_operators
654+
This will tell the build system to rebuild portable/optimized with dtype selective build enabled.
655+
Currently, kernel_deps contains {}.
656+
""".format(kernel_deps))
657+
644658
aten_suffix = "_aten" if aten_mode else ""
645659

646660
# merge functions.yaml with fallback yaml

0 commit comments

Comments
 (0)