-
Notifications
You must be signed in to change notification settings - Fork 322
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
HWY_EXPORT_AND_DYNAMIC_DISPATCH_T for multiple template parameters function with Clang/GCC #2260
Comments
Hi, we do document that this is intended for a single template argument. Likely easier: is it an option for you to wrap your i and j into a struct (with static constexpr kJ=j;) so that it can be a single template arg? |
Hi, Thanks for the answer, I noticed the HWY_EXPORT_AND_DYNAMIC_DISPATCH_T was documented for 1 params, but it didn't fit what I wanted to do unfortunately so I tried and MSVC was ok with it. -It seems to work to add SINGLE_ARG all the way on FUNC_NAME with Clang, didn't try GCC. Will a HWY_EXPORT_AND_DYNAMIC_DISPATCH_T for multi template parameters be considered in a future release ? thanks. |
Makes sense. Thanks for confirming! |
update : this also seems to work for GCC, MSVC to be tested. My situation is I'm trying to port some x86 SIMD code to highway, and there are a sizable number of template functions. so clearly the easiest for me is HWY_EXPORT_AND_DYNAMIC_DISPATCH_T for multi template parameters function working. I understand this impact some base macro from the API and is this a risk. So is that feature mandatory no, there are workarounds, is it practical and useful I think so yes. |
Yes, it's mainly MSVC that differs in its macro/comma parsing. |
Hi,
I'm facing difficulties to compile or execute properly with dynamic dispatch multi template parameter functions. The code compile and seems to work fine on MSVC but no luck with Clang and GCC. I tried to expand partially the HWY_EXPORT_AND_DYNAMIC_DISPATCH_T macro and managed to compile with clang, however at run time dynamic dispatch mechanism may call wrong functions (not always). See below a small reproduction for this issue.
``
#undef HWY_TARGET_INCLUDE
#define HWY_TARGET_INCLUDE "example.cpp"
#include <hwy/foreach_target.h>
#include <hwy/highway.h>
HWY_BEFORE_NAMESPACE();
namespace Test {
namespace HWY_NAMESPACE {
namespace hn = hwy::HWY_NAMESPACE;
template
void func1() {}
} // namespace SLHDR
HWY_AFTER_NAMESPACE();
#define SINGLE_ARG(...) VA_ARGS
#if HWY_ONCE
namespace Test {
}
#endif // HWY_ONCE
``
Thanks,
Anarchitectus
The text was updated successfully, but these errors were encountered: