-
Notifications
You must be signed in to change notification settings - Fork 88
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
Fix targets registration on Windows #2866
Changes from 18 commits
34bf488
fc29bd6
cd46541
60860e9
7de05db
bbe1d3d
6b14d6d
1e1f4fb
07cc374
4624e43
151dac7
894d40f
45ede6f
caac2b0
0e73fdb
68c049c
f0d79d3
7090c2b
e1f6e2c
9d8bcf8
5e3411f
db78e91
5a235c1
6ec5a5e
31459c7
75a5b61
bbf93b0
52fc7d1
2ad56ac
f00dc28
a3ccae5
2004b73
14bf216
bcd8ad1
165d0ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,28 @@ | |
namespace migraphx { | ||
inline namespace MIGRAPHX_INLINE_NS { | ||
|
||
#ifdef _WIN32 | ||
namespace { | ||
struct auto_load_targets | ||
{ | ||
auto_load_targets() | ||
{ | ||
make_target("ref"); | ||
#ifdef HAVE_CPU | ||
make_target("cpu"); | ||
#endif | ||
#ifdef HAVE_GPU | ||
make_target("gpu"); | ||
#endif | ||
#ifdef HAVE_FPGA | ||
make_target("fpga"); | ||
#endif | ||
} | ||
}; | ||
[[maybe_unused]] static auto load_targets = auto_load_targets{}; | ||
} // namespace | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to go into a static/object library that we only link in for the tests. This prevents lazy loading the targets. |
||
#endif | ||
|
||
void store_target_lib(const dynamic_loader& lib) | ||
{ | ||
static std::vector<dynamic_loader> target_loader; | ||
|
@@ -44,8 +66,6 @@ std::unordered_map<std::string, target>& target_map() | |
return m; | ||
} | ||
|
||
void register_target_init() { (void)target_map(); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dont remove this, I think this was necessary to ensure targets are loaded in some cases. |
||
|
||
void unregister_target(const std::string& name) | ||
{ | ||
assert(target_map().count(name)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont remove this, We still want to provide the option to register a target with CRTP.