MCPcopy Create free account
hub / github.com/conflow-dev/ConFlow / ecall_dot

Function ecall_dot

sgx_tf_ops/Enclave/Enclave.cpp:4054–4246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4052}
4053
4054void ecall_dot(float* input1,float* input2, int N1,int N2,int* shape1, int* shape2,int ndims,float* output){
4055 float *x1 = (float*)malloc(sizeof(float)*N1);
4056 memset(x1, 0, sizeof(float)*N1);
4057 for(int j=0;j<N1;j++){
4058 x1[j] = 0.0f;
4059 float sum = input1[insert*N1+j];
4060 float c = 0.0f;
4061 for(int i=0;i<Nt;i++){
4062 float y = input1[indexs[i]*N1+j] - c;
4063 float t = sum + y;
4064 c = (t - sum) - y;
4065 sum = t;
4066 }
4067 x1[j] = sum;
4068 }
4069
4070 float *x2 = (float*)malloc(sizeof(float)*N2);
4071 memset(x2, 0, sizeof(float)*N2);
4072 for(int j=0;j<N2;j++){
4073 x2[j] = 0.0f;
4074 float sum = input2[insert*N2+j];
4075 float c = 0.0f;
4076 for(int i=0;i<Nt;i++){
4077 float y = input2[indexs[i]*N2+j] - c;
4078 float t = sum + y;
4079 c = (t - sum) - y;
4080 sum = t;
4081 }
4082 x2[j] = sum;
4083 }
4084
4085 if(ndims == 2){
4086 if(shape1[1] > shape2[1]){
4087 int M = shape1[0]/Ne;
4088 int L = shape1[1];
4089 for(int i=0;i<M;i++){
4090 for(int j=0;j<L;j++){
4091 x1[i*L+j] = x1[i*L+j] * x2[i];
4092 }
4093 }
4094 }
4095 else if(shape1[1] < shape2[1]){
4096 int M = shape1[0]/Ne;
4097 int L = shape2[1];
4098 for(int i=0;i<M;i++){
4099 for(int j=0;j<L;j++){
4100 x2[i*L+j] = x2[i*L+j] * x1[i];
4101 }
4102 }
4103 }
4104 else{
4105 int M = shape1[0]/Ne;
4106 int L = shape1[1];
4107 for(int i=0;i<M;i++){
4108 for(int j=0;j<L;j++){
4109 x1[i*L+j] = x1[i*L+j] * x2[i*L+j];
4110 }
4111 }

Callers 1

dotFunction · 0.85

Calls 1

gaussrandFunction · 0.85

Tested by

no test coverage detected