Open abdalrahimnaser opened 1 month ago
It should work with Vivado 20.1. With the newer versions of Vivado, I believe vivado_hls
has been depreciated in place of vitis_hls
. Most of the development was done in 2019.1 however, so I can't guarantee compatibility. Just to check, are you setting up Vivado correctly? Do you have the following in your .bashrc
for instance? (this path is for my install, it is likely different for you)
source /mnt/applications/Xilinx/20.1/Vivado/2020.1/settings64.sh
Hi,
Thanks for your response, I did manage to solve the compatibility issue however this error still persists:
"FIXME: use HLS backend in Parser"
.
i tried to specify the argument backend='hls' in the preceeding code block but I got a new error.
code:
import pathlib
from fpgaconvnet.parser.Parser import Parser
from fpgaconvnet.platform.Platform import Platform
from fpgaconvnet.optimiser.solvers import GreedyPartition
# load network
network_name = "single_layer"
onnx_path = f"{network_name}.onnx"
parser = Parser(custom_onnx=False, batch_size=1,backend='hls')
net = parser.onnx_to_fpgaconvnet(onnx_path)
device_path = "../0_get_started/fpgaconvnet-optimiser/examples/platforms/zedboard.toml"
platform = Platform()
platform.update(device_path)
platform.port_width = 64
# Design Space Exploration
opt = GreedyPartition(net, platform)
opt.bram_to_lut = False
opt.off_chip_streaming = False
opt.balance_bram_uram = False
opt.rsc_allocation = 0.75
opt.transforms = []
opt.transforms_probs = []
opt.run_solver()
opt.update_partitions()
# export configuration and prediction report
pathlib.Path(network_name).mkdir(parents=True, exist_ok=True)
opt.create_report(f"{network_name}/report.json")
opt.net.save_all_partitions(f"{network_name}/config.json")
throughput = -opt.get_cost()
print(type(parser))
print(f"predicted throughput (img/s): {throughput}")
print(f"predicted resource usage: {net.partitions[0].get_resource_usage()}")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[9], line 10
8 onnx_path = f"{network_name}.onnx"
9 parser = Parser(custom_onnx=False, batch_size=1,backend='hls')
---> 10 net = parser.onnx_to_fpgaconvnet(onnx_path)
12 device_path = "../0_get_started/fpgaconvnet-optimiser/examples/platforms/zedboard.toml"
13 platform = Platform()
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\parser\Parser.py:278, in Parser.onnx_to_fpgaconvnet(self, onnx_filepath, save_opt_model)
275 node_name = onnx_helper.format_onnx_name(node)
277 # get the hardware for the node
--> 278 hardware = self.get_hardware_from_onnx_node(
279 onnx_model.graph, node, quant_format[node_name], dimensionality)
281 # add node to graph
282 graph.add_node(hardware.name, **hardware.get_node_info())
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\parser\Parser.py:177, in Parser.get_hardware_from_onnx_node(self, graph, node, quant_format, dimensionality)
175 # try converter
176 try:
--> 177 return converter[node_type](graph, node, quant_format, dimensionality,
178 backend=self.backend, regression_model=self.regression_model,
179 convert_gemm_to_conv=self.convert_gemm_to_conv)
180 except KeyError:
181 raise TypeError(f"{node_type} not supported, exiting now")
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\parser\onnx\parse.py:62, in ParseOnnxNode.__init__(self, graph, n, quant_format, dimensionality, backend, regression_model, convert_gemm_to_conv)
59 self.attr.setdefault("weight_compression_ratio", [1.0])
61 # get hardware
---> 62 self.hw = self.get_hardware()
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\parser\onnx\parse.py:146, in ParseOnnxConvNode.get_hardware(self)
144 if self.dimensionality == 2:
145 if type_flag == "dense":
--> 146 return ConvolutionLayer(
147 self.output_shape[1],
148 self.input_shape[2],
149 self.input_shape[3],
150 self.input_shape[1],
151 kernel_rows=self.attr["kernel_shape"][0],
152 kernel_cols=self.attr["kernel_shape"][1],
153 stride_rows=self.attr["strides"][0],
154 stride_cols=self.attr["strides"][1],
155 pad_top = self.attr["pads"][0],
156 pad_left = self.attr["pads"][1],
157 pad_bottom = self.attr["pads"][2],
158 pad_right = self.attr["pads"][3],
159 groups = self.attr["group"],
160 input_t = FixedPoint(self.quant_format["input_t"]["width"],
161 self.quant_format["input_t"]["binary_point"]),
162 output_t = FixedPoint(self.quant_format["output_t"]["width"],
163 self.quant_format["output_t"]["binary_point"]),
164 weight_t = FixedPoint(self.quant_format["weight_t"]["width"],
165 self.quant_format["weight_t"]["binary_point"]),
166 acc_t = FixedPoint(self.quant_format["acc_t"]["width"],
167 self.quant_format["acc_t"]["binary_point"]),
168 has_bias = len(self.inputs) == 3,
169 block_floating_point = self.quant_format["block_floating_point"],
170 backend=self.backend,
171 regression_model=self.regression_model,
172 input_compression_ratio = self.attr["input_compression_ratio"],
173 output_compression_ratio = self.attr["output_compression_ratio"],
174 weight_compression_ratio = self.attr["weight_compression_ratio"]
175 )
176 elif type_flag == "sparse":
177 return ConvolutionSparseLayer(
178 self.output_shape[1],
179 self.input_shape[2],
(...)
207 weight_compression_ratio = self.attr["weight_compression_ratio"]
208 )
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\models\layers\ConvolutionLayer.py:121, in ConvolutionLayer.__init__(self, filters, rows, cols, channels, coarse_in, coarse_out, coarse_group, kernel_rows, kernel_cols, stride_rows, stride_cols, groups, pad_top, pad_right, pad_bottom, pad_left, fine, input_t, output_t, weight_t, acc_t, has_bias, block_floating_point, backend, regression_model, stream_weights, use_uram, input_compression_ratio, output_compression_ratio, weight_compression_ratio)
118 self.regression_model = regression_model
120 if self.backend == "hls":
--> 121 self.modules["sliding_window"] = SlidingWindow(self.rows_in(), self.cols_in(),
122 self.channels_in()//(self.coarse_in*self.coarse_group), self.kernel_size,
123 self.stride, self.pad_top, self.pad_right, self.pad_bottom, self.pad_left,
124 backend=self.backend, regression_model=self.regression_model)
126 self.modules["fork"] = Fork(self.rows_out(), self.cols_out(),
127 self.channels_in()//(self.coarse_in*self.coarse_group),
128 self.kernel_size, self.coarse_out, backend=self.backend, regression_model=self.regression_model)
130 self.modules["conv"] = Conv(self.rows_out(), self.cols_out(),
131 self.channels_in()//(self.coarse_in*self.coarse_group),
132 self.filters//(self.coarse_out*self.coarse_group),
133 self.fine, self.kernel_size,
134 self.groups//self.coarse_group,
135 backend=self.backend, regression_model=self.regression_model)
File <string>:16, in __init__(self, rows, cols, channels, kernel_size, stride, pad_top, pad_right, pad_bottom, pad_left, backend, regression_model, streams)
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\models\modules\SlidingWindow.py:87, in SlidingWindow.__post_init__(self)
84 self.data_packing = (self.backend == "chisel")
86 # perform basic module initialisation
---> 87 Module.__post_init__(self)
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\models\modules\Module.py:66, in Module.__post_init__(self)
63 self.module_identifier = self.__class__.__name__
65 # load resource coefficients
---> 66 self.load_resource_coefficients(self.module_identifier)
File c:\users\abood\downloads\fpgaconvnet-tutorial\tutorial\0_get_started\fpgaconvnet-model\fpgaconvnet\models\modules\Module.py:77, in Module.load_resource_coefficients(self, module_identifier)
75 self.rsc_coef = {}
76 self.rsc_model = {}
---> 77 for rsc_type in self.utilisation_model():
78 match self.regression_model:
79 case "linear_regression":
80 # get the coefficients from the cache path and load
TypeError: 'NoneType' object is not iterable
Please advice, and thanks for your help.
Its having issues loading the resource models. I'll look into this, I thought the resource models in the model repo were fine, but it doesn't seem the case.
Hey Alex,
Any updates regarding this issue? I am interested in getting things to work ASAP as I am planning on employing fpgaConvnet in a current research project.
Regards,
Abdalrahim