Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tried to visualize mlir mhlo - got No graphs #115

Closed
apivovarov opened this issue Aug 6, 2024 · 5 comments
Closed

Tried to visualize mlir mhlo - got No graphs #115

apivovarov opened this issue Aug 6, 2024 · 5 comments
Assignees
Labels
MLIR adapter For issues where the root is mostly occurring with the MLIR adapter type:feature Feature requests

Comments

@apivovarov
Copy link

How to visualize mlir mhlo functions. e.g.

func.func @main(%arg0: tensor<3x4x2xf32>) -> tensor<3x4x2xf32> {
  %0 = mhlo.constant dense<1.000000e+04> : tensor<f32>
  %1 = "mhlo.broadcast_in_dim"(%0) {broadcast_dimensions = dense<> : tensor<0xi64>} : (tensor<f32>) -> tensor<3x4x2xf32>
  %2 = mhlo.add %arg0, %1 : tensor<3x4x2xf32>
  return %2 : tensor<3x4x2xf32>
}

Currently I see just "No graphs" in the middle of the page.

v.0.1.8

@pkgoogle pkgoogle added MLIR adapter For issues where the root is mostly occurring with the MLIR adapter type:feature Feature requests labels Aug 6, 2024
@pkgoogle
Copy link
Contributor

pkgoogle commented Aug 6, 2024

Hi @apivovarov, we don't currently support mhlo, but it shouldn't be too hard to add -- though it won't have any special formatting for now.

@apivovarov
Copy link
Author

Hi @pkgoogle. Thank you for your reply. Can I ask you couple additional questions:

  1. Does model-explorer support stablehlo mlir?
  2. What mlir is currently supported? Any examples I can look? builtin_mlir_adapter.py says "A built-in adapter that converts MLIR file to Model Explorer format."

@yijie-yang
Copy link
Collaborator

Hi @apivovarov,

I can answer the questions. Currently model-explorer supports tf, tfl and stablehlo dialect MLIR files. Here is an example of stablehlo mlir: https://github.com/openxla/stablehlo/blob/main/stablehlo/tests/interpret/collective_broadcast.mlir

For mhlo dialect, I can make a quick fix to use stablehlo adapter to visualize it since they are all part of hlo family and have similar syntax.

@ptoulme-aws
Copy link

You can convert from hlo/mhlo to stablehlo with the hlo translate tool in OpenXLA

@yijie-yang
Copy link
Collaborator

The mhlo mlir is now supported in model-explorer-v0.1.10. Please give it a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MLIR adapter For issues where the root is mostly occurring with the MLIR adapter type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

4 participants