@@ -641,6 +641,20 @@ def executorch_generated_lib(
641
641
if not aten_mode and not functions_yaml_target and not custom_ops_yaml_target :
642
642
fail ("At least one of functions_yaml_target, custom_ops_yaml_target needs to be provided" )
643
643
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
+
644
658
aten_suffix = "_aten" if aten_mode else ""
645
659
646
660
# merge functions.yaml with fallback yaml
@@ -725,7 +739,7 @@ def executorch_generated_lib(
725
739
726
740
portable_lib = []
727
741
optimized_lib = []
728
- if dtype_selective_build and is_xplat () :
742
+ if dtype_selective_build :
729
743
# Build portable headers lib. Used for portable and optimized kernel libraries.
730
744
portable_header_lib = name + "_portable_header_lib"
731
745
build_portable_header_lib (portable_header_lib , oplist_header_name , feature )
0 commit comments