Skip to content

Commit a7db36b

Browse files
authored
Fix dtype selective build check in elementwise_util (#12183)
I think I got this wrong in #11975 -- the compute_dtype is the one type that is NOT related to selective build.
1 parent a022db0 commit a7db36b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kernels/portable/cpu/util/elementwise_util.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,13 @@ inline void apply_elementwise_fn(
319319
}
320320

321321
constexpr auto compute_type = CppTypeToScalarType<CTYPE_COMPUTE>::value;
322-
if constexpr (should_include_kernel_dtype(op_name, compute_type)) {
322+
constexpr ScalarType out_specialized_scalar_type =
323+
specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes);
324+
if constexpr (should_include_kernel_dtype(
325+
op_name, out_specialized_scalar_type)) {
323326
const bool all_inputs_compute_dtype =
324327
((inputs.first->scalar_type() == compute_type) && ...);
325328

326-
constexpr ScalarType out_specialized_scalar_type =
327-
specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes);
328329
if (all_inputs_compute_dtype &&
329330
out.scalar_type() == out_specialized_scalar_type) {
330331
using CTYPE_OUT =

0 commit comments

Comments
 (0)