spcl / pymlir

Python interface for MLIR - the Multi-Level Intermediate Representation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MLIR changed generic form

Berke-Ates opened this issue · comments

This simple mlir:

module  {
    llvm.func @mlir_entry(%a: i32, %b: i32) -> i32 {
        %0 = llvm.add %b, %a  : i32
        llvm.return %0 : i32
    }
}

yields the following generic form after executing mlir-opt --mlir-print-op-generic:

"module"() ( {
  "llvm.func"() ( {
  ^bb0(%arg0: i32, %arg1: i32):  // no predecessors
    %0 = "llvm.add"(%arg1, %arg0) : (i32, i32) -> i32
    "llvm.return"(%0) : (i32) -> ()
  }) {linkage = 10 : i64, sym_name = "mlir_entry", type = !llvm.func<i32 (i32, i32)>} : () -> ()
}) : () -> ()

However executing the following simple python script:

import mlir

ast1 = mlir.parse_path('out.mlir')

throws this:

lark.exceptions.UnexpectedCharacters: No terminal matches '"' in the current parser context, at line 1 col 1

"module"() ( {
^
Expected one of: 
        * MODULE
        * FUNC
        * BANG
        * HASH

I am assuming the MLIR team changed the generic form.

Please use #12