You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A set of tensor utility functions have been implemented (as described in `include/trace_driver.h`), and `example/tensor/ts.cpp` is a good starting point to learn how to import tensors from data files and operate them.
23
+
24
+
Some snippets in `ggml/src/ggml.c` show how to export a tensor into data file, such as:
25
+
```c
26
+
#include"trace_driver.h"
27
+
28
+
stuct ggml_tensor * src0 = ...
29
+
...
30
+
constchar* filenamea = "a.tensor";
31
+
tensor_export(src0, filenamea);
32
+
```
33
+
34
+
`example/tensor/ts.cpp` will be built as `llama-ts` after the upper `make` command.
35
+
36
+
37
+
## 4. More details
38
+
### 4.1 How we control the model layers computed on PIM
39
+
There are several macros defined in `include/llama.h` that controls the bahavior of llama-cli:
40
+
41
+
```c++
42
+
#ifdef PIM_KERNEL
43
+
#define NR_DPUS 64
44
+
#define NR_LAYER 2
45
+
#define DPU_BINARY "./dpu/gemv_dpu"
46
+
...
47
+
#endif // PIM_KERNEL
48
+
```
49
+
50
+
### 4.2 The PIM function(s) implementation
51
+
The PIM binary `dpu/gemv_dpu` is built from `dpu/dpu_main.c` by typing:
52
+
```shell
53
+
cd dpu
54
+
./pim_build.sh
55
+
```
56
+
So check `dpu/dpu_main.c` to find out how the kernel is implemented.
0 commit comments