Skip to content

Commit 81aa3d3

Browse files
committed
Dtype selective build: fail if not xplat, if portable/optimized not in kernel_deps
Differential Revision: [D75027794](https://our.internmc.facebook.com/intern/diff/D75027794/) ghstack-source-id: 284959143 Pull Request resolved: #10985
1 parent 0f9bd74 commit 81aa3d3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

shim_et/xplat/executorch/codegen/codegen.bzl

Lines changed: 15 additions & 1 deletion
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+
fail("Dtype_selective_build is only available in xplat.")
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
@@ -725,7 +739,7 @@ def executorch_generated_lib(
725739

726740
portable_lib = []
727741
optimized_lib = []
728-
if dtype_selective_build and is_xplat():
742+
if dtype_selective_build:
729743
# Build portable headers lib. Used for portable and optimized kernel libraries.
730744
portable_header_lib = name + "_portable_header_lib"
731745
build_portable_header_lib(portable_header_lib, oplist_header_name, feature)

0 commit comments

Comments
 (0)