Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeparableConv1D fail CSynth with Vitis backend #897

Open
3 tasks done
qberthet opened this issue Oct 25, 2023 · 0 comments · May be fixed by #898
Open
3 tasks done

SeparableConv1D fail CSynth with Vitis backend #897

qberthet opened this issue Oct 25, 2023 · 0 comments · May be fixed by #898
Labels

Comments

@qberthet
Copy link
Contributor

qberthet commented Oct 25, 2023

Prerequisites

Please make sure to check off these prerequisites before submitting a bug report.

  • Test that the bug appears on the current version of the master branch. Make sure to include the commit hash of the commit you checked out.
  • Check that the issue hasn't already been reported, by checking the currently open issues.
  • If there are steps to reproduce the problem, make sure to write them down below.

Quick summary

Model using SeparableConv1D fail CSynth when using Vitis backend.

Steps to Reproduce

Using Vitis 2022.2:

  1. Clone the hls4ml repository
  2. Checkout the main branch, with commit hash: d035738
  3. Run the following script:
from keras.layers import Input
from keras.models import Model
from qkeras import *
import hls4ml

def get_model():
    # Define a dummy model with only one QSeparableConv1D layer
    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")

# 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)

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)

@qberthet qberthet added the bug label Oct 25, 2023
qberthet pushed a commit to qberthet/hls4ml that referenced this issue Oct 25, 2023
@qberthet qberthet linked a pull request Oct 25, 2023 that will close this issue
5 tasks
qberthet pushed a commit to qberthet/hls4ml that referenced this issue Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant