-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvecadd_lib.cpp
More file actions
26 lines (22 loc) · 777 Bytes
/
Copy pathvecadd_lib.cpp
File metadata and controls
26 lines (22 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <cblas.h>
#include <mlir_runner_utils.h>
extern "C" void linalg_fill_viewsxf32_f32(StridedMemRefType<float, 1> *X,
float f) {
for (unsigned i = 0; i < X->sizes[0]; ++i)
*(X->data + X->offset + i * X->strides[0]) = f;
}
__attribute__((always_inline)) extern "C" void
external_func(
StridedMemRefType<float, 1> *A, StridedMemRefType<float, 1> *B,
StridedMemRefType<float, 1> *C) {
//std::cout << std::endl;
//printMemRefMetaData(std::cerr, *A);
//std::cout << std::endl;
//printMemRefMetaData(std::cerr, *B);
//std::cout << std::endl;
//printMemRefMetaData(std::cerr, *C);
//std::cout << std::endl;
for (int64_t i = 0; i < A->sizes[0]; ++i) {
C->data[i] = A->data[i] + B->data[i];
}
}