Line data Source code
1 : // SPDX-License-Identifier: Apache-2.0
2 : /**
3 : * @file util_simd.cpp
4 : * @date 09 Jan 2024
5 : * @brief This is a collection of simd util functions. Aim of this file is to
6 : * directly call SIMD implemented functions without Tensor.
7 : * @see https://github.com/nnstreamer/nntrainer
8 : * @author Sungsik Kong <ss.kong@samsung.com>
9 : * @bug No known bugs except for NYI items
10 : */
11 :
12 : #include <algorithm>
13 : #include <cmath>
14 : #include <cpu_backend.h>
15 : #include <util_simd.h>
16 :
17 : namespace nntrainer {
18 :
19 0 : void calc_trigonometric_vals_dup_util(unsigned int N_half, float *angle,
20 : float *cos_, float *sin_,
21 : unsigned int from,
22 : float attention_scaling) {
23 0 : calc_trigonometric_vals_dup(N_half, angle, cos_, sin_, from,
24 : attention_scaling);
25 0 : }
26 :
27 0 : void swiglu_util(const unsigned int N, float *X, float *Y, float *Z) {
28 0 : swiglu(N, X, Y, Z);
29 0 : }
30 :
31 0 : float max_util(const unsigned int N, float *X) { return max_val(N, X); }
32 :
33 0 : void softmax_util(const unsigned int N, float *X, float *Y) {
34 0 : softmax(N, X, Y);
35 0 : }
36 :
37 : } // namespace nntrainer
|