Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions kernels/portable/cpu/util/elementwise_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,13 @@ inline void apply_elementwise_fn(
}

constexpr auto compute_type = CppTypeToScalarType<CTYPE_COMPUTE>::value;
if constexpr (should_include_kernel_dtype(op_name, compute_type)) {
constexpr ScalarType out_specialized_scalar_type =
specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes);
if constexpr (should_include_kernel_dtype(
op_name, out_specialized_scalar_type)) {
Comment on lines +322 to +325
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use of should_include_kernel_dtype is behind a macro, should we not continue with that convention?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ET_INTERNAL_CHECK_SELECTIVE_BUILD depends implicitly on et_switch_name being defined, which doesn't make sense here, and should_include_kernel_dtype is a perfectly good constexpr function so I don't see why we shouldn't call it

const bool all_inputs_compute_dtype =
((inputs.first->scalar_type() == compute_type) && ...);

constexpr ScalarType out_specialized_scalar_type =
specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes);
if (all_inputs_compute_dtype &&
out.scalar_type() == out_specialized_scalar_type) {
using CTYPE_OUT =
Expand Down
Loading