hls4ml icon indicating copy to clipboard operation
hls4ml copied to clipboard

Update inplace variables to not lose connection when source node is optimized.

Open jmitrevs opened this issue 2 years ago • 3 comments

In the original implementation, inplace variables are created when initializing an object, which can run into problems if the source node is changed due to optimizers. This PR moves the linking to a later stage, after the optimizations have run.

This is a replacement for #472, making use of the new features in the master branch.

jmitrevs avatar Apr 12 '22 17:04 jmitrevs

I think I need to copy the type from the input_var in the InplaceTensorVariable.__init__. Let me test it a bit more extensively, though.

jmitrevs avatar Apr 24 '22 00:04 jmitrevs

Some quartus-specific updates are in the QONNX PR #591. Should they be cherry-picked and added here, or is it fine to have them as part of that?

jmitrevs avatar Jul 08 '22 14:07 jmitrevs

Actually, I see that #591 quite extensively modifies the code in this PR, so evaluating this PR independently I think is not useful. Extracting those changes is not very easy to do, either. Note how the optimizers have been reworked, with some going into fpga/passes. The structure of the InplaceTensorVariable hasn't changed in that PR, though. It may be worth looking at that. This variable type is only created in passes (backends/vivado/passes/inplace_stream_flatten.py and backends/fpga/passes/inplace_parallel_reshape.py in #569) and transform_types handles the transformations appropriately.

jmitrevs avatar Jul 12 '22 22:07 jmitrevs