Skip to content

Commit 070fdc2

Browse files
author
Enrico Lupi
committed
ADD io type feature check
1 parent de803b7 commit 070fdc2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

hls4ml/backends/vitis/passes/feature_check.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,21 @@ def transform(self, model, node):
8787
f'WARNING: The selected order for forward and backward layers in "{node.name}" ({node.class_name}) is not '
8888
'supported in Vitis backend. Switching to forward layer first, backward layer last.'
8989
)
90+
91+
92+
class ValidateBidirectionalIoType(OptimizerPass):
93+
_unrolled_layer_cls = ['Bidirectional']
94+
95+
def match(self, node):
96+
is_bidirectional_rnn_layer = (
97+
len([layer_cls for layer_cls in self._unrolled_layer_cls if layer_cls in node.class_name]) > 0
98+
)
99+
is_layer_io_type_stream = node.model.config.config['IOType'] != 'io_parallel'
100+
101+
return is_bidirectional_rnn_layer and is_layer_io_type_stream
102+
103+
def transform(self, model, node):
104+
raise Exception(
105+
f'WARNING: "{node.model.config.config["IOType"]}" IO Type is not supported in Vitis backend '
106+
f'for "{node.name}" ({node.class_name}). Please use "io_parallel".'
107+
)

hls4ml/backends/vitis/vitis_backend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _register_flows(self):
1919
'vitis:validate_resource_unrolled_strategy',
2020
'vitis:validate_bidirectional_merge_mode',
2121
'vitis:validate_bidirectional_layer_order',
22+
'vitis:validate_bidirectional_io_type',
2223
]
2324
validation_flow = register_flow('validation', validation_passes, requires=['vivado:init_layers'], backend=self.name)
2425

0 commit comments

Comments
 (0)