Skip to content

Commit 2329c70

Browse files
author
Rajat Sarkari
committed
Chain example updated to show speedup
1 parent c051a3f commit 2329c70

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cpp_kernels/kernel_chain/src/krnl_chain_mmult.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ void krnl_chain_mmult(int* a, int* b, int* c, int* d, int* output, int dim) {
4545
int tmp = dim;
4646
strm_ctrl_trans1.write(tmp);
4747

48-
#pragma HLS STREAM variable = strm_ctrl_trans1 depth = 2
49-
#pragma HLS STREAM variable = strm_ctrl_trans2 depth = 2
50-
#pragma HLS STREAM variable = strm_ctrl_trans3 depth = 2
51-
#pragma HLS STREAM variable = strm_ctrl_trans4 depth = 2
52-
#pragma HLS STREAM variable = strm_ctrl_trans5 depth = 2
48+
#pragma HLS STREAM variable = strm_ctrl_trans1 depth = 4
49+
#pragma HLS STREAM variable = strm_ctrl_trans2 depth = 4
50+
#pragma HLS STREAM variable = strm_ctrl_trans3 depth = 4
51+
#pragma HLS STREAM variable = strm_ctrl_trans4 depth = 4
52+
#pragma HLS STREAM variable = strm_ctrl_trans5 depth = 4
5353

54-
#pragma HLS STREAM variable = strm_a depth = 64
55-
#pragma HLS STREAM variable = strm_b depth = 64
56-
#pragma HLS STREAM variable = strm_c depth = 64
57-
#pragma HLS STREAM variable = strm_d depth = 64
54+
#pragma HLS STREAM variable = strm_a depth = 4
55+
#pragma HLS STREAM variable = strm_b depth = 4
56+
#pragma HLS STREAM variable = strm_c depth = 4
57+
#pragma HLS STREAM variable = strm_d depth = 4
5858

5959
#pragma HLS DATAFLOW
6060

cpp_kernels/kernel_chain/src/krnl_mmult.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ typedef int pkt;
2323
template <int DUMMY = 0>
2424
void mm2s(int* a, hls::stream<pkt>& strm_a, hls::stream<int>& strm_ctrl_trans1, hls::stream<int>& strm_ctrl_trans2) {
2525
int dim = strm_ctrl_trans1.read();
26+
strm_ctrl_trans2.write(dim);
2627
int size = dim * dim;
2728

2829
// Auto-pipeline is going to apply pipeline to this loop
@@ -33,7 +34,6 @@ void mm2s(int* a, hls::stream<pkt>& strm_a, hls::stream<int>& strm_ctrl_trans1,
3334

3435
strm_a.write(p1);
3536
}
36-
strm_ctrl_trans2.write(dim);
3737
}
3838

3939
// Template to avoid signature conflict in sw_em
@@ -44,6 +44,7 @@ void mmult(hls::stream<pkt>& strm_a,
4444
hls::stream<pkt>& strm_out,
4545
hls::stream<int>& strm_ctrl_trans3) {
4646
int dim = strm_ctrl_trans2.read();
47+
strm_ctrl_trans3.write(dim);
4748
int size = dim * dim;
4849

4950
int buf_a[MAT_DIM][MAT_DIM];
@@ -96,7 +97,6 @@ void mmult(hls::stream<pkt>& strm_a,
9697

9798
strm_out.write(temp);
9899
}
99-
strm_ctrl_trans3.write(dim);
100100
}
101101

102102
// Template to avoid signature conflict in sw_em

0 commit comments

Comments
 (0)