chromium/third_party/xnnpack/src/src/configs/cmul-config.c

// Copyright 2023 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.

#include <assert.h>
#include <stddef.h>

#ifdef _WIN32
  #include <windows.h>
#else
  #include <pthread.h>
#endif

#include "xnnpack/common.h"
#include "xnnpack/config.h"
#include "xnnpack/microfnptr.h"
#include "xnnpack/vbinary.h"

#if XNN_ARCH_ARM || XNN_ARCH_ARM64
  static struct xnn_cmul_config f16_cmul_config = {0};
#endif
static struct xnn_cmul_config f32_cmul_config =;


#if XNN_PLATFORM_WINDOWS
  #if XNN_ARCH_ARM || XNN_ARCH_ARM64
    static INIT_ONCE init_guard_f16_cmul = INIT_ONCE_STATIC_INIT;
  #endif
  static INIT_ONCE init_guard_f32_cmul = INIT_ONCE_STATIC_INIT;
#else
  #if XNN_ARCH_ARM || XNN_ARCH_ARM64
    static pthread_once_t init_guard_f16_cmul = PTHREAD_ONCE_INIT;
  #endif
  static pthread_once_t init_guard_f32_cmul =;
#endif


#if XNN_ARCH_ARM || XNN_ARCH_ARM64
  static void init_f16_cmul_config(void) {
      f16_cmul_config.ukernel = (xnn_vbinary_ukernel_fn) xnn_f16_vcmul_ukernel__neonfp16arith_u16;
      f16_cmul_config.element_tile = 16;
  }
#endif

static void init_f32_cmul_config(void) {}


#if XNN_PLATFORM_WINDOWS && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
  static BOOL CALLBACK init_f16_cmul_config_windows(PINIT_ONCE init_once, PVOID parameter, PVOID* context) {
    init_f16_cmul_config();
    return TRUE;
  }
#endif

#if XNN_PLATFORM_WINDOWS
  static BOOL CALLBACK init_f32_cmul_config_windows(PINIT_ONCE init_once, PVOID parameter, PVOID* context) {
    init_f32_cmul_config();
    return TRUE;
  }
#endif


const struct xnn_cmul_config* xnn_init_f16_cmul_config() {}

const struct xnn_cmul_config* xnn_init_f32_cmul_config() {}