From 165d0ec9d5922c91993bc1717bebdaf9be9c0f78 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Thu, 6 Jun 2024 16:23:33 +0200 Subject: [PATCH] revert some more changes --- src/include/migraphx/register_target.hpp | 5 +++++ src/register_target.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/include/migraphx/register_target.hpp b/src/include/migraphx/register_target.hpp index ab71d5967d7..1d274433e91 100644 --- a/src/include/migraphx/register_target.hpp +++ b/src/include/migraphx/register_target.hpp @@ -34,6 +34,7 @@ namespace migraphx { inline namespace MIGRAPHX_INLINE_NS { +MIGRAPHX_EXPORT void register_target_init(); MIGRAPHX_EXPORT void register_target(const target& t); MIGRAPHX_EXPORT void unregister_target(const std::string& name); MIGRAPHX_EXPORT target make_target(const std::string& name); @@ -52,6 +53,7 @@ struct target_handler template void register_target() { + register_target_init(); static auto t_h = detail::target_handler(T{}); register_target(t_h.t); } @@ -65,6 +67,9 @@ struct register_target_action } }; +template +using auto_register_target = auto_register; + #define MIGRAPHX_REGISTER_TARGET(...) MIGRAPHX_AUTO_REGISTER(register_target_action, __VA_ARGS__) } // namespace MIGRAPHX_INLINE_NS diff --git a/src/register_target.cpp b/src/register_target.cpp index cd8c075da1a..241b080c0e6 100644 --- a/src/register_target.cpp +++ b/src/register_target.cpp @@ -44,6 +44,8 @@ std::unordered_map& target_map() return m; } +void register_target_init() { (void)target_map(); } + void unregister_target(const std::string& name) { assert(target_map().count(name));