When two or more schedules (sharing the same set of inputs) are derived (via hcl.create_schedule()) from the same algorithmic specification, schedules created earlier in the sequence get prepended to the schedules later in the sequence. This results in wrong code generation for each of the backends from the second in sequence schedule onward.
Root causing
The first investigation shows that it happens due to the usage of the same placeholder objects as the input of the schedules. A quick fix is to create two sets of placeholder objects with corresponding placeholders having the same name field. But this needs extra work for the user. A more robust fix is needed.
This will compile two schedules s_orig and s_transfo. Since s_transfo is second in sequence and shares the same set of placeholder objects A, B, C, D with s_orig, s_orig gets prepended to s_transfo. Generated VHLS code (printed on the terminal) shows this as well.
Issue statement
When two or more schedules (sharing the same set of inputs) are derived (via
hcl.create_schedule()
) from the same algorithmic specification, schedules created earlier in the sequence get prepended to the schedules later in the sequence. This results in wrong code generation for each of the backends from the second in sequence schedule onward.Root causing
The first investigation shows that it happens due to the usage of the same placeholder objects as the input of the schedules. A quick fix is to create two sets of placeholder objects with corresponding placeholders having the same
name
field. But this needs extra work for the user. A more robust fix is needed.How to reproduce?
$ python test_issue_1_1.py
This will compile two schedules
s_orig
ands_transfo
. Sinces_transfo
is second in sequence and shares the same set of placeholder objectsA, B, C, D
withs_orig
,s_orig
gets prepended tos_transfo
. Generated VHLS code (printed on the terminal) shows this as well.python test_issue_1_2.py
This does not have the above effect since
s_orig
ands_transfo
do not share the same placeholder objects.