blob: 04b6b28f06f95b7ec5ebf040716b50956a067563 [file] [log] [blame]
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <executorch/runtime/core/exec_aten/exec_aten.h>
#ifdef EXECUTORCH_SELECTIVE_BUILD_DTYPE
// include header generated by
// executorch/codegen/tools/gen_selected_op_variants.py
#include <executorch/kernels/portable/cpu/selected_op_variants.h>
#else
// dummy implementation
inline constexpr bool should_include_kernel_dtype(
const char* /*operator_name*/,
exec_aten::ScalarType /*scalar_type*/
) {
return true;
}
#endif
namespace torch {
namespace executor {
#define ET_INTERNAL_CHECK_SELECTIVE_BUILD(enum_type) \
do { \
if (!should_include_kernel_dtype(et_switch_name, enum_type)) { \
ET_LOG( \
Error, \
"dtype '%" PRId8 "' not selected for operator %s", \
static_cast<int8_t>(enum_type), \
et_switch_name); \
torch::executor::runtime_abort(); \
} \
} while (0)
} // namespace executor
} // namespace torch
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>