Skip to content

[Executorch] Update EXECUTORCH_LIBRARY macro #5620

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

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 13 additions & 4 deletions extension/kernel_util/make_boxed_from_unboxed_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,19 @@ static executorch::runtime::Kernel make_boxed_kernel(
} // namespace extension
} // namespace executorch

#define EXECUTORCH_LIBRARY(ns, op_name, func) \
static auto res_##ns = ::executorch::runtime::register_kernel( \
::executorch::extension::make_boxed_kernel( \
#ns "::" op_name, EXECUTORCH_FN(func)))
// Inspired from C10_CONCATENATE
#define ET_CONCATENATE_IMPL(s1, s2) s1##s2
#define ET_CONCATENATE(s1, s2) ET_CONCATENATE_IMPL(s1, s2)
#define ET_UID __LINE__

#define EXECUTORCH_LIBRARY(ns, op_name, func) \
_EXECUTORCH_LIBRARY_IMPL(ns, op_name, func, ET_UID)

#define _EXECUTORCH_LIBRARY_IMPL(ns, op_name, func, uid) \
static auto ET_CONCATENATE(res_##ns##_, uid) = \
::executorch::runtime::register_kernel( \
::executorch::extension::make_boxed_kernel( \
#ns "::" op_name, EXECUTORCH_FN(func)))

namespace torch {
namespace executor {
Expand Down
Loading