Skip to content

Commit f60f0b4

Browse files
committed
verif: Add framework for benchmarking sweep across different hw configs
1 parent afa2bfc commit f60f0b4

15 files changed

Lines changed: 1948 additions & 24 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ target/verif/vsim/compile.tcl
99
target/verif/vsim/modelsim.ini
1010
target/verif/vsim/transcript
1111
target/verif/vsim/vsim.wlf
12+
target/verif/results

target/verif/config/generated/json_to_mk.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
Templates are automatically discovered based on the config type argument.
77
"""
88

9-
import json
109
import argparse
10+
import json
1111
import sys
1212
from pathlib import Path
1313
from string import Template
@@ -83,9 +83,9 @@ def parse_args(argv=None):
8383
help="Configuration type to generate.",
8484
)
8585
parser.add_argument(
86-
"config_dir",
86+
"config_json",
8787
type=Path,
88-
help="Directory containing source-of-truth JSON files.",
88+
help="Path to selected source-of-truth JSON file.",
8989
)
9090
parser.add_argument(
9191
"generated_dir",
@@ -98,11 +98,10 @@ def parse_args(argv=None):
9898
def main():
9999
args = parse_args()
100100
config_type = args.config_type
101-
config_dir = args.config_dir.resolve()
101+
json_file = args.config_json.resolve()
102+
config_dir = json_file.parent
102103
generated_dir = args.generated_dir.resolve()
103104

104-
# Construct file paths based on config_type argument
105-
json_file = config_dir / f"{config_type}.json"
106105
template_file = generated_dir / f"{config_type}.mk.tpl"
107106

108107
# Load JSON config

target/verif/config/hardware.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"DATA_WIDTH": 32,
1010
"TOT_MEM_SIZE": 256,
1111
"N_BANKS": 64,
12-
"INTERCO_TYPE": "MUX",
12+
"INTERCO_TYPE": "HCI",
1313
"TS_BIT": 21,
1414
"EXPFIFO": 0,
1515
"SEL_LIC": 0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"description": "Hardware configuration parameters for HCI interconnect",
3+
"parameters": {
4+
"N_HWPE": 2,
5+
"HWPE_WIDTH_FACT": 8,
6+
"N_CORE": 8,
7+
"N_DMA": 0,
8+
"N_EXT": 1,
9+
"DATA_WIDTH": 32,
10+
"TOT_MEM_SIZE": 256,
11+
"N_BANKS": 64,
12+
"INTERCO_TYPE": "HCI",
13+
"TS_BIT": 21,
14+
"EXPFIFO": 0,
15+
"SEL_LIC": 0
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"description": "Hardware configuration parameters for HCI interconnect",
3+
"parameters": {
4+
"N_HWPE": 2,
5+
"HWPE_WIDTH_FACT": 8,
6+
"N_CORE": 8,
7+
"N_DMA": 0,
8+
"N_EXT": 1,
9+
"DATA_WIDTH": 32,
10+
"TOT_MEM_SIZE": 256,
11+
"N_BANKS": 64,
12+
"INTERCO_TYPE": "LOG",
13+
"TS_BIT": 21,
14+
"EXPFIFO": 0,
15+
"SEL_LIC": 0
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"description": "Hardware configuration parameters for HCI interconnect",
3+
"parameters": {
4+
"N_HWPE": 2,
5+
"HWPE_WIDTH_FACT": 8,
6+
"N_CORE": 8,
7+
"N_DMA": 0,
8+
"N_EXT": 1,
9+
"DATA_WIDTH": 32,
10+
"TOT_MEM_SIZE": 256,
11+
"N_BANKS": 64,
12+
"INTERCO_TYPE": "MUX",
13+
"TS_BIT": 21,
14+
"EXPFIFO": 0,
15+
"SEL_LIC": 0
16+
}
17+
}

target/verif/config/workload.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
"hwpe_masters": [
1616
{
17-
"id": 1,
17+
"id": 0,
1818
"description": "DMA engine (linear setup + ping/pong prefetch)",
1919
"patterns": [
2020
{
@@ -107,7 +107,7 @@
107107
]
108108
},
109109
{
110-
"id": 0,
110+
"id": 1,
111111
"description": "Single GEMM engine processing 4 tiles with ping/pong buffers",
112112
"patterns": [
113113
{
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{
2+
"description": "Simple 4-tile double-buffer GEMM. DMA uses linear transfers sized only by region_size_bytes.",
3+
"log_masters": [
4+
{ "id": 0, "description": "Core 0 (idle)", "mem_access_type": "idle" },
5+
{ "id": 1, "description": "Core 1 (idle)", "mem_access_type": "idle" },
6+
{ "id": 2, "description": "Core 2 (idle)", "mem_access_type": "idle" },
7+
{ "id": 3, "description": "Core 3 (idle)", "mem_access_type": "idle" },
8+
{ "id": 4, "description": "Core 4 (idle)", "mem_access_type": "idle" },
9+
{ "id": 5, "description": "Core 5 (idle)", "mem_access_type": "idle" },
10+
{ "id": 6, "description": "Core 6 (idle)", "mem_access_type": "idle" },
11+
{ "id": 7, "description": "Core 7 (idle)", "mem_access_type": "idle" },
12+
{ "id": 8, "description": "External 0 (idle)", "mem_access_type": "idle" }
13+
],
14+
15+
"hwpe_masters": [
16+
{
17+
"id": 0,
18+
"description": "DMA engine (linear setup + ping/pong prefetch)",
19+
"patterns": [
20+
{
21+
"description": "Setup preload: B matrix (8 KiB)",
22+
"mem_access_type": "linear",
23+
"job": "dma_load_B",
24+
"traffic_pct": 100,
25+
"traffic_read_pct": 0,
26+
"region_base_address": "0x00000",
27+
"region_size_bytes": 8192
28+
},
29+
{
30+
"description": "Setup preload: tile A0 into buffer #0 (8 KiB)",
31+
"mem_access_type": "linear",
32+
"job": "dma_load_A0_buf0",
33+
"traffic_pct": 100,
34+
"traffic_read_pct": 0,
35+
"region_base_address": "0x02000",
36+
"region_size_bytes": 8192
37+
},
38+
{
39+
"description": "Setup preload: tile A1 into buffer #1 (8 KiB)",
40+
"mem_access_type": "linear",
41+
"job": "dma_load_A1_buf1",
42+
"traffic_pct": 100,
43+
"traffic_read_pct": 0,
44+
"region_base_address": "0x04000",
45+
"region_size_bytes": 8192
46+
},
47+
{
48+
"description": "Prefetch tile A2 into buffer #0 (8 KiB)",
49+
"mem_access_type": "linear",
50+
"job": "dma_load_A2_buf0",
51+
"wait_for_jobs": ["gemm_A0"],
52+
"traffic_pct": 100,
53+
"traffic_read_pct": 0,
54+
"region_base_address": "0x02000",
55+
"region_size_bytes": 8192
56+
},
57+
{
58+
"description": "Read back C0 after GEMM tile A0",
59+
"mem_access_type": "linear",
60+
"job": "dma_store_C0_buf2",
61+
"wait_for_jobs": ["gemm_A0"],
62+
"traffic_pct": 100,
63+
"traffic_read_pct": 100,
64+
"region_base_address": "0x06000",
65+
"region_size_bytes": 8192
66+
},
67+
{
68+
"description": "Prefetch tile A3 into buffer #1 (8 KiB)",
69+
"mem_access_type": "linear",
70+
"job": "dma_load_A3_buf1",
71+
"wait_for_jobs": ["gemm_A1"],
72+
"traffic_pct": 100,
73+
"traffic_read_pct": 0,
74+
"region_base_address": "0x04000",
75+
"region_size_bytes": 8192
76+
},
77+
{
78+
"description": "Read back C1 after GEMM tile A1",
79+
"mem_access_type": "linear",
80+
"job": "dma_store_C1_buf3",
81+
"wait_for_jobs": ["gemm_A1"],
82+
"traffic_pct": 100,
83+
"traffic_read_pct": 100,
84+
"region_base_address": "0x08000",
85+
"region_size_bytes": 8192
86+
},
87+
{
88+
"description": "Read back C0 after GEMM tile A2",
89+
"mem_access_type": "linear",
90+
"job": "dma_store_C2_buf2",
91+
"wait_for_jobs": ["gemm_A2"],
92+
"traffic_pct": 100,
93+
"traffic_read_pct": 100,
94+
"region_base_address": "0x06000",
95+
"region_size_bytes": 8192
96+
},
97+
{
98+
"description": "Read back C1 after GEMM tile A3",
99+
"mem_access_type": "linear",
100+
"job": "dma_store_C3_buf3",
101+
"wait_for_jobs": ["gemm_A3"],
102+
"traffic_pct": 100,
103+
"traffic_read_pct": 100,
104+
"region_base_address": "0x08000",
105+
"region_size_bytes": 8192
106+
}
107+
]
108+
},
109+
{
110+
"id": 1,
111+
"description": "Single GEMM engine processing 4 tiles with ping/pong buffers",
112+
"patterns": [
113+
{
114+
"description": "GEMM tile A0: A0 x B -> C0",
115+
"mem_access_type": "matmul_phased",
116+
"job": "gemm_A0",
117+
"wait_for_jobs": ["dma_load_B", "dma_load_A0_buf0"],
118+
"traffic_pct": 90,
119+
"matrix_m": 16,
120+
"matrix_n": 16,
121+
"matrix_k": 16,
122+
"region_base_address_a": "0x02000",
123+
"region_size_bytes_a": 8192,
124+
"region_base_address_b": "0x00000",
125+
"region_size_bytes_b": 8192,
126+
"region_base_address_c": "0x06000",
127+
"region_size_bytes_c": 8192
128+
},
129+
{
130+
"description": "GEMM tile A1: A1 x B -> C1",
131+
"mem_access_type": "matmul_phased",
132+
"job": "gemm_A1",
133+
"wait_for_jobs": ["dma_load_B", "dma_load_A1_buf1"],
134+
"traffic_pct": 90,
135+
"matrix_m": 16,
136+
"matrix_n": 16,
137+
"matrix_k": 16,
138+
"region_base_address_a": "0x04000",
139+
"region_size_bytes_a": 8192,
140+
"region_base_address_b": "0x00000",
141+
"region_size_bytes_b": 8192,
142+
"region_base_address_c": "0x08000",
143+
"region_size_bytes_c": 8192
144+
},
145+
{
146+
"description": "GEMM tile A2: A0 x B -> C0 (after dma_load_A2_buf0)",
147+
"mem_access_type": "matmul_phased",
148+
"job": "gemm_A2",
149+
"wait_for_jobs": ["dma_load_B", "dma_load_A2_buf0", "dma_store_C0_buf2"],
150+
"traffic_pct": 90,
151+
"matrix_m": 16,
152+
"matrix_n": 16,
153+
"matrix_k": 16,
154+
"region_base_address_a": "0x02000",
155+
"region_size_bytes_a": 8192,
156+
"region_base_address_b": "0x00000",
157+
"region_size_bytes_b": 8192,
158+
"region_base_address_c": "0x06000",
159+
"region_size_bytes_c": 8192
160+
},
161+
{
162+
"description": "GEMM tile A3: A1 x B -> C1 (after dma_load_A3_buf1)",
163+
"mem_access_type": "matmul_phased",
164+
"job": "gemm_A3",
165+
"wait_for_jobs": ["dma_load_B", "dma_load_A3_buf1", "dma_store_C1_buf3"],
166+
"traffic_pct": 90,
167+
"matrix_m": 16,
168+
"matrix_n": 16,
169+
"matrix_k": 16,
170+
"region_base_address_a": "0x04000",
171+
"region_size_bytes_a": 8192,
172+
"region_base_address_b": "0x00000",
173+
"region_size_bytes_b": 8192,
174+
"region_base_address_c": "0x08000",
175+
"region_size_bytes_c": 8192
176+
}
177+
]
178+
}
179+
]
180+
}

0 commit comments

Comments
 (0)