Skip to content

Commit

Permalink
test with vec_add
Browse files Browse the repository at this point in the history
Addresses #628.
  • Loading branch information
PeiMu committed Dec 20, 2022
1 parent 4734b12 commit 37e3e14
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
46 changes: 46 additions & 0 deletions analysis/statistics/8233e1e4129aa152a49219c2d00a6f1fcb8f785c.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

changeset: 1364:8233e1e4129aa152a49219c2d00a6f1fcb8f785c
char kNewtonVersion[] = "0.3-alpha-1364 (8233e1e4129aa152a49219c2d00a6f1fcb8f785c) (build 12-20-2022-17:[email protected]_64)";
\n./src/noisy/noisy-linux-EN -O0 applications/noisy/helloWorld.n -s
\n./src/newton/newton-linux-EN -v 0 -eP applications/newton/invariants/ViolinWithTemperatureDependence-pigroups.nt

Informational Report:
---------------------
Invariant "ViolinWithTemperatureDependenceForPiGroups" has 2 unique kernels, each with 2 column(s)...

Kernel 0 is a valid kernel:

1 1
-0.5 -0
1 0
0.5 0
0 -1
-0 -1


The ordering of parameters is: P1 P0 P3 P2 P4 P5

Pi group 0, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^( 0) P5^(-0)

Pi group 0, Pi 1 is: P0^(-0) P1^( 1) P2^( 0) P3^( 0) P4^(-1) P5^(-1)


Kernel 1 is a valid kernel:

1 0
-0.5 1
1 -2
0.5 -1
-0 -2
0 -2


The ordering of parameters is: P1 P0 P3 P2 P4 P5

Pi group 1, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^(-0) P5^( 0)

Pi group 1, Pi 1 is: P0^( 1) P1^( 0) P2^(-1) P3^(-2) P4^(-2) P5^(-2)




4 changes: 3 additions & 1 deletion applications/newton/llvm-ir/c-files/vec_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ void toc( timespec* start_time, const char* prefix )
*start_time = current_time;
}

typedef int32_t bmx055fAcceleration;

#define NUM 102400

void vec_add(int32_t *vec_A, int32_t *vec_B, int32_t *vec_C, int len_vec) {
void vec_add(bmx055fAcceleration *vec_A, bmx055fAcceleration *vec_B, bmx055fAcceleration *vec_C, int len_vec) {
int i;
for (i=0; i<len_vec; i++) {
vec_C[i] = vec_A[i] + vec_B[i];
Expand Down
16 changes: 16 additions & 0 deletions applications/newton/llvm-ir/c-files/vectorize_experiment.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,19 @@ opt vec_add_8.ll --O1 --loop-vectorize -S -o vec_add_8_opt.ll
clang --target=aarch64-arm-none-eabi vec_add_8_opt.ll -o vec_add_8_opt
./vec_add_8_opt # 0.000227494 s
```

## Run with Newton Compiler
```bash
cd ../../../../src/newton
./newton-linux-EN --llvm-ir=../../applications/newton/llvm-ir/vec_add.ll --llvm-ir-liveness-check ../../applications/newton/sensors/test.nt
cd -
llvm-dis ../vec_add_output.bc

opt ../vec_add.ll --O1 --loop-vectorize -S -o vec_add_opt.ll
clang vec_add_opt.ll -o vec_add_opt
./vec_add_opt # 0.000318110 s

opt ../vec_add_output.ll --O1 --loop-vectorize -S -o vec_add_output_opt.ll
clang vec_add_output_opt.ll -o vec_add_output_opt
./vec_add_output_opt # 0.000205080 s
```

0 comments on commit 37e3e14

Please sign in to comment.