Skip to content

Commit bccca1b

Browse files
committed
support for back2back aha test with sparse tile pipelining
1 parent 30ae707 commit bccca1b

File tree

7 files changed

+49
-299
lines changed

7 files changed

+49
-299
lines changed

copy_formatted.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def find_tensor(tensor_list, tile_id):
8383

8484
#os.chdir("SPARSE_TESTS")
8585

86-
if app_name == "matmul_ijk" and mode_ns == False:
86+
if "matmul_ijk" in app_name and mode_ns == False:
8787
for b in b_tensors:
8888
for c in c_tensors:
8989
tile_str = str(app_name) + "-" + str(test) + "_tile" + str(tile)
@@ -180,7 +180,7 @@ def find_tensor(tensor_list, tile_id):
180180
tile = tile + 1
181181

182182

183-
if app_name == "matmul_ijk" and mode_ns == True:
183+
if "matmul_ijk" in app_name and mode_ns == True:
184184
for b in b_ns_tensors:
185185
for c in c_ns_tensors:
186186
# mode 2 == mode 0, mode 3 == mode 1

tests/test_app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ compile:
144144

145145
.PHONY: run
146146
run:
147-
@rm -rf *.txt
147+
@rm -rf *.txt; rm -rf ../../SPARSE_TESTS/tensor*
148148
$(RUN) $(DUMP_ARGS) $(RUN_ARGS) $(APP_ARGS)
149149

150150
.PHONY: sim

tests/test_app/lib/map.c

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,41 +57,53 @@ void update_bs_configuration(struct BitstreamInfo *bs_info) {
5757
int glb_map(void *kernel_, int dpr_enabled) {
5858
struct KernelInfo *kernel = kernel_;
5959
int num_groups = kernel->num_groups;
60-
printf("number of groups: %d\n", num_groups);
61-
62-
// This is just greedy algorithm to schedule applications
63-
// TODO: Need a better way to schedule kernels
64-
int group_start = -1;
65-
for (int i = 0; i < monitor.num_groups; i++) {
66-
int success = 0;
67-
for (int j = 0; j < num_groups; j++) {
68-
// if the number of groups required exceeds the hardware resources, then
69-
// fail
70-
if ((i + j) >= monitor.num_groups) {
71-
success = -1;
72-
break;
73-
}
74-
if (monitor.groups[i + j] != 0) {
75-
break;
76-
}
77-
if (j == (num_groups - 1)) {
78-
group_start = i;
79-
success = 1;
80-
}
81-
}
82-
if (success != 0) break;
83-
}
84-
// no available group
85-
if (group_start == -1) {
60+
printf("number of groups: %d\n", kernel->num_groups);
61+
printf("number of inputs: %d\n", kernel->num_inputs);
62+
printf("number of outputs: %d\n", kernel->num_outputs);
63+
64+
printf("monitor.num_groups: %d\n", monitor.num_groups);
65+
66+
if (num_groups > monitor.num_groups) {
8667
printf("Application does not fit on array. Possible error CGRA too small, applications overlapping\n");
8768
return 0;
8869
}
8970

90-
for (int i = group_start; i < group_start + num_groups; i++) {
91-
monitor.groups[i] = 1;
92-
}
71+
int group_start;
72+
// DPR needs to check if enough array space
73+
if (dpr_enabled == 1) {
74+
// This is just greedy algorithm to schedule applications
75+
// TODO: Need a better way to schedule kernels
76+
group_start = -1;
77+
for (int i = 0; i < monitor.num_groups; i++) {
78+
int success = 0;
79+
for (int j = 0; j < num_groups; j++) {
80+
// if the number of groups required exceeds the hardware resources, then
81+
// fail
82+
if ((i + j) >= monitor.num_groups) {
83+
success = -1;
84+
break;
85+
}
86+
if (monitor.groups[i + j] != 0) {
87+
break;
88+
}
89+
if (j == (num_groups - 1)) {
90+
group_start = i;
91+
success = 1;
92+
}
93+
}
94+
if (success != 0) break;
95+
}
96+
// no available group
97+
if (group_start == -1) {
98+
printf("Combination of Applications does not fit on array. Possible error CGRA too small, applications overlapping\n");
99+
return 0;
100+
}
101+
102+
for (int i = group_start; i < group_start + num_groups; i++) {
103+
monitor.groups[i] = 1;
104+
}
93105
// DPR is not enabled so just clear the group start
94-
if(dpr_enabled == 0){
106+
} else {
95107
group_start = 0;
96108
}
97109
kernel->group_start = group_start;

tests/test_app/lib/parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#define MAX_NUM_IO 16
88
#define MAX_NUM_IO_TILES 16
99
#define BUFFER_SIZE 1024
10-
#define MAX_NUM_KERNEL 16
10+
#define MAX_NUM_KERNEL 128
1111
#define MAX_JSON_FIELDS 2048
12-
#define MAX_CONFIG 40
12+
#define MAX_CONFIG 8192
1313

1414
#define GET_BS_INFO(info) struct BitstreamInfo *bs_info = (struct BitstreamInfo *)info
1515
#define GET_KERNEL_INFO(info) struct KernelInfo *kernel_info = (struct KernelInfo *)info

tests/test_app/map.c

Lines changed: 0 additions & 262 deletions
This file was deleted.

tests/test_app/tb/garnet_test.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import "DPI-C" function int initialize_monitor(int num_cols);
99

1010
program garnet_test #(
11-
parameter int MAX_NUM_APPS = 3
11+
parameter int MAX_NUM_APPS = 1000
1212
) (
1313
input logic clk,
1414
reset,

0 commit comments

Comments
 (0)