Skip to content

No dialect specification in generated MLIR #22

@HesamGit

Description

@HesamGit

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
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions