Skip to content

Commit

Permalink
update polybench to use invokeable sqrt
Browse files Browse the repository at this point in the history
  • Loading branch information
rachitnigam committed Jan 30, 2021
1 parent acf96be commit 7117bb0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions benchmarks/polybench/linear-algebra-cholesky.fuse
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import c++("math.h")
vivado("math.h") {
def sqrt(x: ubit<32>): ubit<32>;
vivado("math.h")
futil("primitives/bitnum/math.futil") {
def sqrt(in: ubit<32>): ubit<32>;
}

decl A_int: ubit<32>[8][8];
Expand Down Expand Up @@ -55,5 +56,6 @@ for (let i: ubit<4> = 0..8) {
---
let A_i_i = A_int[i][i];
---
A_int[i][i] := sqrt(A_i_i);
let sq = sqrt(A_i_i);
A_int[i][i] := sq;
}
8 changes: 5 additions & 3 deletions benchmarks/polybench/linear-algebra-gramschmidt.fuse
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import c++("math.h")
vivado("math.h") {
def sqrt(x: ubit<32>): ubit<32>;
vivado("math.h")
futil("primitives/bitnum/math.futil") {
def sqrt(in: ubit<32>): ubit<32>;
}

decl A_int: ubit<32>[8][12];
Expand Down Expand Up @@ -39,7 +40,8 @@ for (let k: ubit<4> = 0..12) {
nrm += A_i_k * A_i_k;
}

R[k][k] := sqrt(nrm);
let sq = sqrt(nrm);
R[k][k] := sq;
---
for (let i: ubit<4> = 0..8) {
Q[i][k] := A[i][k] / R[k][k];
Expand Down
10 changes: 6 additions & 4 deletions benchmarks/unrolled/linear-algebra-gramschmidt.fuse
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import vivado("math.h")
cpp("math.h") {
def sqrt(x: ubit<32>): ubit<32>;
import c++("math.h")
vivado("math.h")
futil("primitives/bitnum/math.futil") {
def sqrt(in: ubit<32>): ubit<32>;
}

decl A_int: ubit<32>[8][12];
Expand Down Expand Up @@ -39,7 +40,8 @@ for (let k: ubit<4> = 0..12) {
nrm += A_i_k * A_i_k;
}

R[k][k] := sqrt(nrm);
let sq = sqrt(nrm);
R[k][k] := sq;
---
for (let i: ubit<4> = 0..8) unroll 4 {
Q[i][k] := A[i][k] / R[k][k];
Expand Down

0 comments on commit 7117bb0

Please sign in to comment.