google-ai-edge / model-explorer

A modern model graph visualizer and debugger
Apache License 2.0
1.05k stars 82 forks source link

[StableHLO] Failed to layout graph #171

Closed Nullkooland closed 1 month ago

Nullkooland commented 1 month ago

I tried to visualize a StableHLO model with model-explorer, but got this error:

Failed to layout graph: RangeError: Maximum call stack size exceeded

Could you take a look of my model IR, I think it is not malformed since it can be processed by stablehlo-opt tool with no problem: text_encoder_1_77_256.mlir.txt

pkgoogle commented 1 month ago

I was able to reproduce, but I never reached the maximum call stack (Infinite loop). @yijie-yang, can you please take a look? Thanks.

yijie-yang commented 1 month ago

The backend adapter was able to convert the mlir to JSON graph successfully. Looks like there are some minor issues in UI layout rendering. Jing is inspecting.

yijie-yang commented 1 month ago

We found the issue: the default max number of nodes per layer is set to 1000, which can cause rendering issues when graph is huge. Setting to a smaller value will resolve it! BAorH6QhFPD9Fg6

Nullkooland commented 1 month ago

We found the issue: the default max number of nodes per layer is set to 1000, which can cause rendering issues when graph is huge. Setting to a smaller value will resolve it! BAorH6QhFPD9Fg6

It works now, thanks!