Skip to content

Commit 37d3ed6

Browse files
committed
[do not merge] temporary fix
[ghstack-poisoned]
1 parent 847ab16 commit 37d3ed6

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tools/codegen/dest/gen_external_aten_fallbacks.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from tools.codegen.context import method_with_native_function
77
from tools.codegen.utils import Target, mapMaybe
88
from tools.codegen.model import (Argument, ExternalBackendFunction,
9-
ExternalBackendFunctionsGroup,
9+
ExternalBackendFunctionsGroup, SchemaKind,
1010
assert_never, Return, is_generic_dispatch_key,
1111
ListType, OptionalType, BaseType, BaseTy, Variant)
1212
from tools.codegen.api.types import DispatcherSignature, CppSignatureGroup
@@ -66,8 +66,14 @@
6666
'var',
6767
]
6868

69+
# TODO: delete and re-use the one from gen.py
70+
def has_autogenerated_composite_kernel(f: ExternalBackendFunction) -> bool:
71+
return (f.native_function.structured or f.native_function.structured_delegate is not None) and \
72+
(f.native_function.func.kind() == SchemaKind.functional or f.native_function.func.kind() == SchemaKind.inplace)
73+
6974
def requires_backend_wrapper(f: ExternalBackendFunction) -> bool:
70-
requires_lowering = not any(is_generic_dispatch_key(k) for k in f.native_function.dispatch)
75+
requires_lowering = not any(is_generic_dispatch_key(k) for k in f.native_function.dispatch) \
76+
and not has_autogenerated_composite_kernel(f)
7177
has_xla_lowering = f.metadata is not None
7278
in_denylist = any([re.match(frx, str(f.native_function.func.name)) for frx in _FN_DENYLIST_REGEX])
7379
return not in_denylist and (requires_lowering or has_xla_lowering)

0 commit comments

Comments
 (0)