PandA-2024.02
e1_mlp.cc
Go to the documentation of this file.
1 #include "tvm/runtime/c_runtime_api.h"
2 #include "tvm/runtime/c_backend_api.h"
3 extern void* __tvm_module_ctx = NULL;
4 #ifdef __cplusplus
5 extern "C"
6 #endif
7 TVM_DLL int32_t fused_nn_dense_add( void* args, void* arg_type_ids, int32_t num_args) {
8  void* arg0 = (((TVMValue*)args)[0].v_handle);
9  int32_t arg0_code = (( int32_t*)arg_type_ids)[0];
10  void* arg1 = (((TVMValue*)args)[1].v_handle);
11  int32_t arg1_code = (( int32_t*)arg_type_ids)[1];
12  void* arg2 = (((TVMValue*)args)[2].v_handle);
13  int32_t arg2_code = (( int32_t*)arg_type_ids)[2];
14  void* arg3 = (((TVMValue*)args)[3].v_handle);
15  int32_t arg3_code = (( int32_t*)arg_type_ids)[3];
16  float* placeholder = (float*)(((TVMArray*)arg0)[0].data);
17  int64_t* arg0_shape = (int64_t*)(((TVMArray*)arg0)[0].shape);
18  int64_t* arg0_strides = (int64_t*)(((TVMArray*)arg0)[0].strides);
19  int32_t dev_type = (((TVMArray*)arg0)[0].ctx.device_type);
20  int32_t dev_id = (((TVMArray*)arg0)[0].ctx.device_id);
21  float* placeholder1 = (float*)(((TVMArray*)arg1)[0].data);
22  int64_t* arg1_shape = (int64_t*)(((TVMArray*)arg1)[0].shape);
23  int64_t* arg1_strides = (int64_t*)(((TVMArray*)arg1)[0].strides);
24  float* placeholder2 = (float*)(((TVMArray*)arg2)[0].data);
25  int64_t* arg2_shape = (int64_t*)(((TVMArray*)arg2)[0].shape);
26  int64_t* arg2_strides = (int64_t*)(((TVMArray*)arg2)[0].strides);
27  float* T_add = (float*)(((TVMArray*)arg3)[0].data);
28  int64_t* arg3_shape = (int64_t*)(((TVMArray*)arg3)[0].shape);
29  int64_t* arg3_strides = (int64_t*)(((TVMArray*)arg3)[0].strides);
30  if (!(arg0_strides == NULL)) {
31  }
32  if (!(arg1_strides == NULL)) {
33  }
34  if (!(arg2_strides == NULL)) {
35  }
36  if (!(arg3_strides == NULL)) {
37  }
38  float compute[10];
39  for (int32_t y_outer_x_outer_fused = 0; y_outer_x_outer_fused < 10; ++y_outer_x_outer_fused) {
40  float compute1[16];
41  (( float16*)(compute1 + 0))[0] = ((float16)(0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f));
42  for (int32_t k = 0; k < 49; ++k) {
43  (( float16*)(compute1 + 0))[0] = ((( float16*)(compute1 + 0))[0] + ((( float16*)(placeholder + (k * 16)))[0] * (( float16*)(placeholder1 + ((y_outer_x_outer_fused * 784) + (k * 16))))[0]));
44  }
45  compute[y_outer_x_outer_fused] = 0.000000e+00f;
46  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[0]);
47  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[1]);
48  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[2]);
49  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[3]);
50  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[4]);
51  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[5]);
52  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[6]);
53  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[7]);
54  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[8]);
55  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[9]);
56  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[10]);
57  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[11]);
58  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[12]);
59  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[13]);
60  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[14]);
61  compute[y_outer_x_outer_fused] = (compute[y_outer_x_outer_fused] + compute1[15]);
62  }
63  for (int32_t ax1 = 0; ax1 < 10; ++ax1) {
64  T_add[ax1] = (compute[ax1] + placeholder2[ax1]);
65  }
66  return 0;
67 }
68 
69 #ifdef __cplusplus
70 extern "C"
71 #endif
72 TVM_DLL int32_t fused_nn_softmax( void* args, void* arg_type_ids, int32_t num_args) {
73  void* arg0 = (((TVMValue*)args)[0].v_handle);
74  int32_t arg0_code = (( int32_t*)arg_type_ids)[0];
75  void* arg1 = (((TVMValue*)args)[1].v_handle);
76  int32_t arg1_code = (( int32_t*)arg_type_ids)[1];
77  float* placeholder = (float*)(((TVMArray*)arg0)[0].data);
78  int64_t* arg0_shape = (int64_t*)(((TVMArray*)arg0)[0].shape);
79  int64_t* arg0_strides = (int64_t*)(((TVMArray*)arg0)[0].strides);
80  int32_t dev_type = (((TVMArray*)arg0)[0].ctx.device_type);
81  int32_t dev_id = (((TVMArray*)arg0)[0].ctx.device_id);
82  float* tensor = (float*)(((TVMArray*)arg1)[0].data);
83  int64_t* arg1_shape = (int64_t*)(((TVMArray*)arg1)[0].shape);
84  int64_t* arg1_strides = (int64_t*)(((TVMArray*)arg1)[0].strides);
85  if (!(arg0_strides == NULL)) {
86  }
87  if (!(arg1_strides == NULL)) {
88  }
89  float tensor1[1];
90  float tensor2[10];
91  float tensor3[1];
92  tensor1[0] = -3.402823e+38f;
93  for (int32_t k1 = 0; k1 < 10; ++k1) {
94  float _1 = tensor1[0];
95  float _2 = placeholder[k1];
96  tensor1[0] = ((_1) > (_2) ? (_1) : (_2));
97  }
98  for (int32_t ax1 = 0; ax1 < 10; ++ax1) {
99  tensor2[ax1] = expf((placeholder[ax1] - tensor1[0]));
100  }
101  tensor3[0] = 0.000000e+00f;
102  for (int32_t k2 = 0; k2 < 10; ++k2) {
103  tensor3[0] = (tensor3[0] + tensor2[k2]);
104  }
105  for (int32_t ax11 = 0; ax11 < 10; ++ax11) {
106  tensor[ax11] = (tensor2[ax11] / tensor3[0]);
107  }
108  return 0;
109 }
110 
#define NULL
int compute(int a, int b, int c, int d, int e, int f, int g, int expected)
Definition: main.c:10
Union type of values being passed through API and function calls.
void * __tvm_module_ctx
static const uint32_t k[]
Definition: sha-256.c:22
#define TVM_DLL
Definition: c_runtime_api.h:59
Plain C Tensor object, does not manage memory.
Definition: dlpack.h:111
TVM_DLL int32_t fused_nn_softmax(void *args, void *arg_type_ids, int32_t num_args)
Definition: e1_mlp.cc:72
TVM_DLL int32_t fused_nn_dense_add(void *args, void *arg_type_ids, int32_t num_args)
Definition: e1_mlp.cc:7

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13