Skip to content

Commit c821525

Browse files
committed
fix(abgraph): allowed no matching port preassignment in floorplan config for testing
1 parent 148b262 commit c821525

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

bazel/tapa_rules.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def _tapa_xo_impl(ctx):
6464
if ctx.file.floorplan_path:
6565
tapa_cmd.extend(["--floorplan-path", ctx.file.floorplan_path.path])
6666

67+
# Add floorplan config, if specified.
68+
if ctx.file.floorplan_config:
69+
tapa_cmd.extend(["--floorplan-config", ctx.file.floorplan_config.path])
70+
6771
# Add device config path, if specified.
6872
if ctx.file.device_config:
6973
tapa_cmd.extend(["--device-config", ctx.file.device_config.path])
@@ -114,6 +118,8 @@ def _tapa_xo_impl(ctx):
114118
inputs = [src] + ctx.files.hdrs + ctx.files.custom_rtl_files
115119
if ctx.file.floorplan_path:
116120
inputs.append(ctx.file.floorplan_path)
121+
if ctx.file.floorplan_config:
122+
inputs.append(ctx.file.floorplan_config)
117123
if ctx.file.device_config:
118124
inputs.append(ctx.file.device_config)
119125
ctx.actions.run(
@@ -169,6 +175,7 @@ tapa_xo = rule(
169175
"gen_ab_graph": attr.bool(),
170176
"flatten_hierarchy": attr.bool(),
171177
"floorplan_path": attr.label(allow_single_file = True),
178+
"floorplan_config": attr.label(allow_single_file = True),
172179
"device_config": attr.label(allow_single_file = True),
173180
"vitis_hls_env": attr.label(
174181
cfg = "exec",

tapa/abgraph/gen_abgraph.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import json
10+
import logging
1011
import re
1112
from pathlib import Path
1213

@@ -20,6 +21,8 @@
2021

2122
MMAP_WIDTH = (405, 43)
2223

24+
_logger = logging.getLogger().getChild(__name__)
25+
2326

2427
def get_top_level_ab_graph(program: Program, floorplan_config: Path) -> ABGraph:
2528
"""Generates the top level ab graph."""
@@ -169,7 +172,7 @@ def add_port_iface_connections( # noqa: C901
169172

170173
if not region:
171174
msg = f"Port {port.name} does not match any preassignment pattern."
172-
raise ValueError(msg)
175+
_logger.warning(msg)
173176

174177
dummy_vertex = ABVertex(
175178
name=port.name,

tapa/steps/floorplan.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def get_slot_to_inst(
147147
return slot_to_insts
148148

149149

150-
def convert_region_format(region: str) -> str:
150+
def convert_region_format(region: str | None) -> str | None:
151151
"""Convert region format from 'x:y' to 'x_TO_y'."""
152+
if region is None:
153+
return None
152154
return region.replace(":", "_TO_") if ":" in region else region

tests/functional/abgraph/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tapa_xo(
1515
include = ["."],
1616
enable_synth_util = True,
1717
flatten_hierarchy = True,
18+
floorplan_config = ":test_fp_config.json",
1819
gen_ab_graph = True,
1920
top_name = "VecAdd",
2021
)
@@ -45,6 +46,7 @@ tapa_xo(
4546
include = ["."],
4647
enable_synth_util = True,
4748
flatten_hierarchy = True,
49+
floorplan_config = ":test_fp_config.json",
4850
gen_ab_graph = True,
4951
top_name = "Bandwidth",
5052
)
@@ -74,6 +76,7 @@ tapa_xo(
7476
include = ["."],
7577
enable_synth_util = True,
7678
flatten_hierarchy = True,
79+
floorplan_config = ":test_fp_config.json",
7780
gen_ab_graph = True,
7881
top_name = "Cannon",
7982
)
@@ -103,6 +106,7 @@ tapa_xo(
103106
include = ["."],
104107
enable_synth_util = True,
105108
flatten_hierarchy = True,
109+
floorplan_config = ":test_fp_config.json",
106110
gen_ab_graph = True,
107111
top_name = "Network",
108112
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"cell_pre_assignments": {},
3+
"cpp_arg_pre_assignments": {},
4+
"dse_range_max": 0.8,
5+
"dse_range_min": 0.65,
6+
"grouping_constraints": [],
7+
"ignore_narrow_edge_threshold": 1,
8+
"max_seconds": 600,
9+
"partition_schedule": [],
10+
"partition_strategy": "flat",
11+
"reserved_slot_to_cells": {},
12+
"slot_to_rtype_to_max_limit": {},
13+
"slot_to_rtype_to_min_limit": {},
14+
"sys_port_pre_assignments": {
15+
"ap_clk": "SLOT_X2Y0:SLOT_X2Y0",
16+
"ap_rst_n": "SLOT_X2Y0:SLOT_X2Y0",
17+
"interrupt": "SLOT_X2Y0:SLOT_X2Y0",
18+
"s_axi_control_.*": "SLOT_X2Y1:SLOT_X2Y1"
19+
}
20+
}

0 commit comments

Comments
 (0)