Skip to content

Commit 7ac1e7a

Browse files
committed
(release branch only) Revert "Respect selective build for dtype_specialized_elementwise_fn_impl in elementwise_util (#11975)"
This reverts commit 8bc99d3. See comment on the original PR; I believe it has a bug and IIUC the correct action for the release branch is to revert to safety.
1 parent 82a5bec commit 7ac1e7a

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

kernels/portable/cpu/util/elementwise_util.h

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <c10/util/irange.h>
1212
#include <executorch/kernels/portable/cpu/scalar_utils.h>
13-
#include <executorch/kernels/portable/cpu/selective_build.h>
1413
#include <executorch/kernels/portable/cpu/util/broadcast_indexes_range.h>
1514
#include <executorch/kernels/portable/cpu/util/broadcast_util.h>
1615
#include <executorch/kernels/portable/cpu/util/dtype_util.h>
@@ -319,22 +318,20 @@ inline void apply_elementwise_fn(
319318
}
320319

321320
constexpr auto compute_type = CppTypeToScalarType<CTYPE_COMPUTE>::value;
322-
if constexpr (should_include_kernel_dtype(op_name, compute_type)) {
323-
const bool all_inputs_compute_dtype =
324-
((inputs.first->scalar_type() == compute_type) && ...);
325-
326-
constexpr ScalarType out_specialized_scalar_type =
327-
specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes);
328-
if (all_inputs_compute_dtype &&
329-
out.scalar_type() == out_specialized_scalar_type) {
330-
using CTYPE_OUT =
331-
typename ScalarTypeToCppType<out_specialized_scalar_type>::type;
332-
dtype_specialized_elementwise_fn_impl<
333-
CTYPE_COMPUTE,
334-
CTYPE_OUT,
335-
support_noncontiguous_tensors>(compute_fun, ctx, out, inputs...);
336-
return;
337-
}
321+
const bool all_inputs_compute_dtype =
322+
((inputs.first->scalar_type() == compute_type) && ...);
323+
324+
constexpr ScalarType out_specialized_scalar_type =
325+
specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes);
326+
if (all_inputs_compute_dtype &&
327+
out.scalar_type() == out_specialized_scalar_type) {
328+
using CTYPE_OUT =
329+
typename ScalarTypeToCppType<out_specialized_scalar_type>::type;
330+
dtype_specialized_elementwise_fn_impl<
331+
CTYPE_COMPUTE,
332+
CTYPE_OUT,
333+
support_noncontiguous_tensors>(compute_fun, ctx, out, inputs...);
334+
return;
338335
}
339336

340337
apply_elementwise_fn_generic_impl<

kernels/portable/cpu/util/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def define_common_targets():
115115
":vectorized_math",
116116
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
117117
"//executorch/runtime/kernel:kernel_runtime_context",
118-
"//executorch/kernels/portable/cpu:scalar_utils",
119118
"//executorch/extension/threadpool:threadpool",
120119
"//executorch/kernels/portable/cpu:scalar_utils",
121120
],
122121
deps = [
122+
"//executorch/kernels/portable/cpu:scalar_utils",
123123
"//executorch/runtime/kernel:kernel_includes",
124124
],
125125
visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS"],

0 commit comments

Comments
 (0)