Skip to content

Fix dtype selective build check in elementwise_util #12183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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)) {
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