google / highway

Performance-portable, length-agnostic SIMD with runtime dispatch
Apache License 2.0
3.95k stars 305 forks source link

Question: how to declare template method for dynamic dispatch ? #2251

Closed boxerab closed 1 week ago

boxerab commented 1 week ago

I am able to set up dynamic dispatch for non-template methods. But for the following method, for example, how can I set up dynamic dispatch ?

 template<typename T>
  void fetch_cols(const T* res, T* scratch, uint32_t height, uint32_t stride, uint32_t numcols) {
}

Thanks!

jan-wassenberg commented 1 week ago

Hi, we recently added HWY_EXPORT_T for this purpose, check out the comments in highway.h :)

boxerab commented 1 week ago

thanks, will try that out.