ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dspm_mult.h
Go to the documentation of this file.
1// Copyright 2018-2023 Espressif Systems (Shanghai) PTE LTD
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef _dspm_mult_H_
16#define _dspm_mult_H_
17
18#include "dsp_err.h"
19#include "dspm_mult_platform.h"
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif
25
44esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k);
45esp_err_t dspm_mult_f32_ae32(const float *A, const float *B, float *C, int m, int n, int k);
46esp_err_t dspm_mult_f32_aes3(const float *A, const float *B, float *C, int m, int n, int k);
47esp_err_t dspm_mult_f32_arp4(const float *A, const float *B, float *C, int m, int n, int k);
49
50
64esp_err_t dspm_mult_3x3x1_f32_ae32(const float *A, const float *B, float *C);
65
79esp_err_t dspm_mult_3x3x3_f32_ae32(const float *A, const float *B, float *C);
80
94
95esp_err_t dspm_mult_4x4x1_f32_ae32(const float *A, const float *B, float *C);
96
110esp_err_t dspm_mult_4x4x4_f32_ae32(const float *A, const float *B, float *C);
111
131esp_err_t dspm_mult_s16_ansi(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift);
132esp_err_t dspm_mult_s16_ae32(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift);
133esp_err_t dspm_mult_s16_aes3(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift);
134esp_err_t dspm_mult_s16_arp4(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift);
136
159esp_err_t dspm_mult_ex_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd);
160esp_err_t dspm_mult_ex_f32_ae32(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd);
161esp_err_t dspm_mult_ex_f32_aes3(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd);
162esp_err_t dspm_mult_ex_f32_arp4(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd);
163
164#ifdef __cplusplus
165}
166#endif
167
168#if CONFIG_DSP_OPTIMIZED
169
170
171#if (dspm_mult_s16_aes3_enabled == 1)
172#define dspm_mult_s16 dspm_mult_s16_aes3
173#elif (dspm_mult_s16_ae32_enabled == 1)
174#define dspm_mult_s16 dspm_mult_s16_ae32
175#elif (dspm_mult_s16_arp4_enabled == 1)
176#define dspm_mult_s16 dspm_mult_s16_arp4
177#else
178#define dspm_mult_s16 dspm_mult_s16_ansi
179#endif
180
181#if (dspm_mult_f32_aes3_enabled == 1)
182#define dspm_mult_f32 dspm_mult_f32_aes3
183#define dspm_mult_ex_f32 dspm_mult_ex_f32_aes3
184#elif (dspm_mult_f32_ae32_enabled == 1)
185#define dspm_mult_f32 dspm_mult_f32_ae32
186#define dspm_mult_ex_f32 dspm_mult_ex_f32_ae32
187#elif (dspm_mult_f32_arp4_enabled == 1)
188#define dspm_mult_f32 dspm_mult_f32_arp4
189#define dspm_mult_ex_f32 dspm_mult_ex_f32_arp4
190#else
191#define dspm_mult_f32 dspm_mult_f32_ansi
192#define dspm_mult_ex_f32 dspm_mult_ex_f32_ansi
193#endif
194
195#if (dspm_mult_3x3x1_f32_ae32_enabled == 1)
196#define dspm_mult_3x3x1_f32 dspm_mult_3x3x1_f32_ae32
197#else
198#define dspm_mult_3x3x1_f32(A,B,C) dspm_mult_f32(A,B,C, 3, 3, 1)
199#endif
200#if (dspm_mult_3x3x3_f32_ae32_enabled == 1)
201#define dspm_mult_3x3x3_f32(A,B,C) dspm_mult_3x3x3_f32_ae32(A,B,C)
202#else
203#define dspm_mult_3x3x3_f32(A,B,C) dspm_mult_f32(A,B,C,3,3,3);
204#endif
205#if (dspm_mult_4x4x1_f32_ae32_enabled == 1)
206#define dspm_mult_4x4x1_f32(A,B,C) dspm_mult_4x4x1_f32_ae32(A,B,C)
207#else
208#define dspm_mult_4x4x1_f32(A,B,C) dspm_mult_f32(A,B,C, 4, 4, 1)
209#endif
210
211#if (dspm_mult_f32_aes3_enabled == 1)
212#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32_aes3(A,B,C, 4, 4, 4)
213#elif (dspm_mult_4x4x4_f32_ae32_enabled == 1)
214#define dspm_mult_4x4x4_f32 dspm_mult_4x4x4_f32_ae32
215#else
216#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32(A,B,C, 4, 4, 4)
217#endif
218
219#else
220#define dspm_mult_s16 dspm_mult_s16_ansi
221#define dspm_mult_f32 dspm_mult_f32_ansi
222#define dspm_mult_3x3x1_f32(A,B,C) dspm_mult_f32(A,B,C, 3, 3, 1)
223#define dsps_sub_f32 dsps_sub_f32_ansi
224#define dsps_add_f32 dsps_add_f32_ansi
225#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32(A,B,C, 4, 4, 4)
226#define dspm_mult_ex_f32 dspm_mult_ex_f32_ansi
227#define dspm_mult_3x3x3_f32(A,B,C) dspm_mult_f32(A,B,C,3,3,3);
228#define dspm_mult_4x4x1_f32(A,B,C) dspm_mult_f32(A,B,C, 4, 4, 1)
229#endif // CONFIG_DSP_OPTIMIZED
230
231
232#endif // _dspm_mult_H_
esp_err_t dspm_mult_3x3x3_f32_ae32(const float *A, const float *B, float *C)
Matrix multiplication A[3x3]xB[3x3].
esp_err_t dspm_mult_s16_arp4(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift)
esp_err_t dspm_mult_f32_aes3(const float *A, const float *B, float *C, int m, int n, int k)
esp_err_t dspm_mult_4x4x4_f32_ae32(const float *A, const float *B, float *C)
Matrix multiplication A[4x4]xB[4x4].
esp_err_t dspm_mult_s16_ansi(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift)
Matrix multiplication 16 bit signeg int.
esp_err_t dspm_mult_ex_f32_ae32(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd)
esp_err_t dspm_mult_f32_arp4(const float *A, const float *B, float *C, int m, int n, int k)
esp_err_t dspm_mult_3x3x1_f32_ae32(const float *A, const float *B, float *C)
Matrix multiplication A[3x3]xB[3x1].
esp_err_t dspm_mult_s16_aes3(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift)
esp_err_t dspm_mult_f32_ae32(const float *A, const float *B, float *C, int m, int n, int k)
esp_err_t dspm_mult_ex_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd)
Matrix subset multiplication.
esp_err_t dspm_mult_4x4x1_f32_ae32(const float *A, const float *B, float *C)
Matrix multiplication A[4x4]xB[4x1].
esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k)
Matrix multiplication.
esp_err_t dspm_mult_s16_ae32(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift)
esp_err_t dspm_mult_ex_f32_arp4(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd)
esp_err_t dspm_mult_ex_f32_aes3(const float *A, const float *B, float *C, int m, int n, int k, int A_padd, int B_padd, int C_padd)
int esp_err_t
Definition esp_err.h:21
float C[4][16]
Definition test_mmult.c:22
const int m
Definition test_mmult.c:16
float B[8][16]
Definition test_mmult.c:21
float A[4][8]
Definition test_mmult.c:20
const int n
Definition test_mmult.c:17
const int k
Definition test_mmult.c:18