Skip to content

AssertionError: cycle-free graph violated: partition depends on itself #1399

@BowenKwan

Description

@BowenKwan

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 dev-branch. Make sure to include the commit hash of the commit you checked out.
  • [Y] Check that the issue hasn't already been reported, by checking the currently open issues.
  • [Y] If there are steps to reproduce the problem, make sure to write them down below.
  • [Y] If relevant, please include the ONNX files, which were created directly before and/or after the bug.

Quick summary

FINN build fails with error,
AssertionError: cycle-free graph violated: partition depends on itself

I have reduced the model to reshaping the 7x7 image to 49x1 vector, and go through a linear layer. The same error occurs.

From other post in the github, it seems like the reshape function is not transformed to HW, showing as brown when viewing the onnx file on netron.

Image

I have tried different reshaping method (.view(), nn.Flatten(), torch.flatten() ), however none worked.

Code used are included below. I have the onnx file available however it cant be uploaded here.

Details

self.quant_inp = qnn.QuantIdentity(bit_width=q_data_widt, return_quant_tensor=True)
self.fc3 = qnn.QuantLinear(49, 1,bias=True, weight_bit_width=q_bit_width)
self.flatten = nn.Flatten()	
    def forward(self, x):
        x = self.quant_inp(x)
        x = x.view(x.size(0), -1)
        #x = torch.flatten(x, 1)
        #x = self.flatten(x)
        x = self.fc3(x)
        return x

Steps to Reproduce


cfg_estimates = build.DataflowBuildConfig(
    output_dir=estimates_output_dir,  # directory location
    mvau_wwidth_max=80,
    target_fps=1000000,
    synth_clk_period_ns=10.0,
    fpga_part="xc7z020clg400-1",
    steps=build_cfg.estimate_only_dataflow_steps,
    generate_outputs=[
        build_cfg.DataflowOutputType.ESTIMATE_REPORTS,
    ]
)

build.build_dataflow_cfg("./dataflow_build_dir/model.onnx", cfg_estimates)

Expected behavior

Finish building

Actual behavior

 .......BUILDING THE DATA FLOW CONFIGURATION

Building dataflow accelerator from ./dataflow_build_dir/model.onnx
Intermediate outputs will be generated in /tmp/finn_dev_pyk12
Final outputs will be generated in ./output_estimates_only
Build log is at ./output_estimates_only/build_dataflow.log
Running step: step_qonnx_to_finn [1/10]
Running step: step_tidy_up [2/10]
Running step: step_streamline [3/10]
Running step: step_convert_to_hw [4/10]
Running step: step_create_dataflow_partition [5/10]
Traceback (most recent call last):
  File "/home/pyk12/finn/src/finn/builder/build_dataflow.py", line 158, in build_dataflow_cfg
    model = transform_step(model, cfg)
  File "/home/pyk12/finn/src/finn/builder/build_dataflow_steps.py", line 372, in step_create_dataflow_partition
    parent_model = model.transform(
  File "/home/pyk12/finn/deps/qonnx/src/qonnx/core/modelwrapper.py", line 140, in transform
    (transformed_model, model_was_changed) = transformation.apply(transformed_model)
  File "/home/pyk12/finn/src/finn/transformation/fpgadataflow/create_dataflow_partition.py", line 80, in apply
    parent_model = model.transform(
  File "/home/pyk12/finn/deps/qonnx/src/qonnx/core/modelwrapper.py", line 140, in transform
    (transformed_model, model_was_changed) = transformation.apply(transformed_model)
  File "/home/pyk12/finn/deps/qonnx/src/qonnx/transformation/create_generic_partitions.py", line 119, in apply
    self.partitioning(node) != partition_id
AssertionError: cycle-free graph violated: partition depends on itself
> /home/pyk12/finn/deps/qonnx/src/qonnx/transformation/create_generic_partitions.py(119)apply()
-> self.partitioning(node) != partition_id

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions