Open qberthet opened 8 months ago
Please make sure to check off these prerequisites before submitting a bug report.
Model using SeparableConv1D fail CSynth when using Vitis backend.
Using Vitis 2022.2:
from keras.layers import Input from keras.models import Model from qkeras import * import hls4ml
def get_model():
input_layer = Input(shape=(32, 3)) layer = QSeparableConv1D( filters=16, kernel_size=3, depthwise_quantizer=quantized_bits(16, 6, alpha=1), pointwise_quantizer=quantized_bits(16, 6, alpha=1), bias_quantizer=quantized_bits(16, 6, alpha=1) )(input_layer) model = Model(inputs=input_layer, outputs=layer) return model
model = get_model()
model.summary()
config = hls4ml.utils.config_from_keras_model(model, granularity="name")
config['Model']['Precision'] = 'ap_fixed<16,6>' config['Model']['ReuseFactor'] = 1 config['Model']['Strategy'] = 'Latency'
cfg = hls4ml.converters.create_config(backend='Vitis') cfg['IOType'] = 'io_stream' cfg['HLSConfig'] = config cfg['KerasModel'] = model cfg['OutputDir'] = 'hls4ml_prj' cfg['Part'] = 'xcku115-flvb2104-2-i'
hls_model = hls4ml.converters.keras_to_hls(cfg)
hls_model.compile()
hls_model.build(reset=True, csim=False, synth=True)
### Expected behavior Successful CSynt. ### Actual behavior CSytnh fail with the following error: `ERROR: [HLS 214-272] In function 'void nnet::depthwise_product<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_depthwise>(ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>*, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>*, config2_depthwise::weight_t*, config2_depthwise::bias_t*)', Pragma conflict happens on 'INLINE' and 'PIPELINE'FUNCTION_INSTANTIATE' pragmas: same function (firmware/nnet_utils/nnet_sepconv_stream.h:13:0)`
Prerequisites
Please make sure to check off these prerequisites before submitting a bug report.
Quick summary
Model using SeparableConv1D fail CSynth when using Vitis backend.
Steps to Reproduce
Using Vitis 2022.2:
def get_model():
Define a dummy model with only one QSeparableConv1D layer
model = get_model()
model.summary()
config = hls4ml.utils.config_from_keras_model(model, granularity="name")
Configure the project to be SeparableConv1D compatible
config['Model']['Precision'] = 'ap_fixed<16,6>' config['Model']['ReuseFactor'] = 1 config['Model']['Strategy'] = 'Latency'
Use the Vivado backend (2020.1)
cfg = hls4ml.converters.create_config(backend='Vitis') cfg['IOType'] = 'io_stream' cfg['HLSConfig'] = config cfg['KerasModel'] = model cfg['OutputDir'] = 'hls4ml_prj' cfg['Part'] = 'xcku115-flvb2104-2-i'
hls_model = hls4ml.converters.keras_to_hls(cfg)
hls_model.compile()
hls_model.build(reset=True, csim=False, synth=True)