/* This needs to be called in order to initialize the dispatch pointers at runtime.
 * This function simply checks what SIMD extensions are available, and then walks the dispatch table
 * to choose the best function.
 * NOTE: As implemented, it will initialize the dispatch pointer to the first supported function.
 *       This means that in the dispatch tables, implementations supporting more recent extensions
 *       need to come first
 */
void THVector_(vectorDispatchInit)(void)
{
  uint32_t hostSimdExts = detectHostSIMDExtensions();
  INIT_DISPATCH_PTR(fill);
  INIT_DISPATCH_PTR(cadd);
  INIT_DISPATCH_PTR(adds);
  INIT_DISPATCH_PTR(cmul);
  INIT_DISPATCH_PTR(muls);
  INIT_DISPATCH_PTR(cdiv);
  INIT_DISPATCH_PTR(divs);
  INIT_DISPATCH_PTR(copy);
  INIT_DISPATCH_PTR(normal_fill);
}
Esempio n. 2
0
  THVector_(startup)() {
    uint32_t hostSimdExts = detectHostSIMDExtensions();
    INIT_DISPATCH_PTR(fill);
    INIT_DISPATCH_PTR(cadd);
    INIT_DISPATCH_PTR(adds);
    INIT_DISPATCH_PTR(cmul);
    INIT_DISPATCH_PTR(muls);
    INIT_DISPATCH_PTR(cdiv);
    INIT_DISPATCH_PTR(divs);
    INIT_DISPATCH_PTR(copy);
    INIT_DISPATCH_PTR(normal_fill);

#ifndef TH_REAL_IS_INT
    INIT_DISPATCH_PTR(cvtFromInt);
#endif

#if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE)
    INIT_DISPATCH_PTR(sigmoid);
#endif
  }