Skip to content

Commit

Permalink
revert some more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apwojcik committed Jun 6, 2024
1 parent bcd8ad1 commit 165d0ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/include/migraphx/register_target.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -52,6 +53,7 @@ struct target_handler
template <class T>
void register_target()
{
register_target_init();
static auto t_h = detail::target_handler(T{});
register_target(t_h.t);
}
Expand All @@ -65,6 +67,9 @@ struct register_target_action
}
};

template <class T>
using auto_register_target = auto_register<register_target_action, T>;

#define MIGRAPHX_REGISTER_TARGET(...) MIGRAPHX_AUTO_REGISTER(register_target_action, __VA_ARGS__)

} // namespace MIGRAPHX_INLINE_NS
Expand Down
2 changes: 2 additions & 0 deletions src/register_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ std::unordered_map<std::string, target>& target_map()
return m;
}

void register_target_init() { (void)target_map(); }

void unregister_target(const std::string& name)
{
assert(target_map().count(name));
Expand Down

0 comments on commit 165d0ec

Please sign in to comment.