cornell-zhang/heterocl

Support data placement with disconnected DFG

Closed this issue · 2 comments

I just checked Alex's code. The root cause is that the graph partitioning algorithm assumes there is a path from input nodes to output nodes in the DFG. But this is not always true.

The minimum test case to produce the error. In this program, the output does not depend on inputs.

def kernel(A, B):
    return hcl.compute((10,32), lambda *args: 1, "O")

# Not using .to() here since we have the auto-placement feature now
s = hcl.create_schedule([A, B], kernel)
f = hcl.build(s, target)

Added a fix that should eliminate most of the subgraph related bugs -- Whenever the algorithm fails to extract the subgraph, it rolls back and offload the whole function body to the FPGA device.

This is fixed already. When the output does not depend on the inputs (this kind of behavior does not make much sense, but it is still valid), the algorithm will throw out a critical warning, but keep generating the HLS code.

Test cases: https://github.com/cornell-zhang/heterocl/blob/heteroflow/tests/issues/test_issue_274.py