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

No dialect specification in generated MLIR #22

Open
HesamGit opened this issue Jan 9, 2023 · 2 comments
Open

No dialect specification in generated MLIR #22

HesamGit opened this issue Jan 9, 2023 · 2 comments

Comments

@HesamGit
Copy link

HesamGit commented Jan 9, 2023

The generated MLIR does not have dialect specification. For example, tests/test_builder.py generates instructions without dialect (as shown below):

func -> should be -> func.func
constant -> should be -> arith.constan
t

This causes issues when I use this output with llvm tools (mlir-opt or mlir-translate). They complain about not recognizing "func" or "constant".

module {
  func @saxpy(%_pymlir_fnarg: f64, %_pymlir_fnarg_0: memref<?xf64>, %_pymlir_fnarg_1: memref<?xf64>) {
    %_pymlir_ssa = constant 0 : index
    %_pymlir_ssa_0 = dim %_pymlir_fnarg_0 , %_pymlir_ssa : index
    affine.for %_pymlir_i = 0 to %_pymlir_ssa_0 {
      %_pymlir_ssa_1 = affine.load %_pymlir_fnarg_0 [ (%_pymlir_i) ] : memref<?xf64>
      %_pymlir_ssa_2 = mulf %_pymlir_ssa_1 , %_pymlir_fnarg : f64
      %_pymlir_ssa_3 = affine.load %_pymlir_fnarg_1 [ (%_pymlir_i) ] : memref<?xf64>
      %_pymlir_ssa_4 = addf %_pymlir_ssa_3 , %_pymlir_ssa_2 : f64
      affine.store %_pymlir_ssa_4 , %_pymlir_fnarg_1 [ (%_pymlir_i) ] : memref<?xf64>
    }
    return
  }
}
@blaine-fs
Copy link
Contributor

blaine-fs commented Jan 12, 2023

See #19 and #20 for func. constant seems like a similar issue

@tbennun
Copy link
Contributor

tbennun commented Jan 20, 2023

Yes, the recent changes to MLIR requires us to add the concept of core/standard dialects. This is in progress for func, and will be done for the rest as well. I have a bit of high overhead at the moment so I will not be able to make the necessary changes very soon. Any PRs are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants