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

Multiple stream clones with different numbers of outputs crash Keras converter. #905

Closed
4 tasks done
calad0i opened this issue Oct 31, 2023 · 0 comments · Fixed by #906
Closed
4 tasks done

Multiple stream clones with different numbers of outputs crash Keras converter. #905

calad0i opened this issue Oct 31, 2023 · 0 comments · Fixed by #906
Labels

Comments

@calad0i
Copy link
Contributor

calad0i commented Oct 31, 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.
  • If relevant, please include the hls4ml project files, which were created directly before and/or after the bug.

Quick summary

Keras converter crashes when multiple clone operations are required with different precision. PR comes later.

Steps to Reproduce

(Sort of) minimal reproduce example:

from keras.layers import Dense, Add

inp = keras.Input(shape=(10,))
x = Dense(10)(inp)
y = Dense(10)(inp)
z = Dense(10)(inp)
xy = Add()([x,y]) # 5
xy = Add()([xy,y]) # 5
model = keras.Model(inp, [xy, z])

model_hls = convert_from_keras_model(model, io_type='io_stream', output_dir='/tmp/stream_clone_crash', hls_config = {'Model':{'Precision':'fixed<32,10>', 'ReuseFactor':1}})

Cause:
optimization at https://github.com/fastmachinelearning/hls4ml/blob/0d48affe108f9df470950fe08a73bc3b5c3f2338/hls4ml/backends/fpga/passes/clone.py#L30C15-L30C15: When two clone happens with different #outputs, the template generated last time will crash.

@calad0i calad0i added the bug label Oct 31, 2023
@calad0i calad0i changed the title Multiple stream clones with different numbers of outputs crashes Keras converter. Multiple stream clones with different numbers of outputs crash Keras converter. Oct 31, 2023
@calad0i calad0i mentioned this issue Oct 31, 2023
7 tasks
@jmduarte jmduarte linked a pull request Nov 16, 2023 that will close this issue
7 tasks
@calad0i calad0i closed this as completed Nov 16, 2023
jmduarte added a commit that referenced this issue Nov 16, 2023
* fix multi clones w/ diff outs in stream io

* fix test

---------

Co-authored-by: Javier Duarte <[email protected]>
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