onnx / onnx-mlir

Representation and Reference Lowering of ONNX Models in MLIR Compiler Infrastructure
Apache License 2.0
712 stars 306 forks source link

Error: expected type #2849

Open Manav361 opened 2 weeks ago

Manav361 commented 2 weeks ago

Problem Description:

When running the following command to optimize OPT.ll by adding O3 optimization:

opt -O3 -S -o OPT_O3.ll OPT.ll 

an error occurs indicating an error in expected type:

OPT.ll:12:63: warning: ptr type is only supported in -opaque-pointers mode
@om_external_constant_data_constant_733_opt = internal global ptr null, align 16
                                                              ^
opt: OPT.ll:12:63: error: expected type
@om_external_constant_data_constant_733_opt = internal global ptr null, align 16
                                                              ^                                                        ^

I have attached the OPT.ll file to reproduce the error by running the above mentioned command. OPT.ll .

I generated OPT.ll using onnx-mlir tools and the commands are as follows:-

     onnx-mlir --EmitONNXIR $ONNX_MLIR_FILES_PATH/$filename.onnx &&
     onnx-mlir -O3 --EmitLLVMIR $ONNX_MLIR_FILES_PATH/$filename.onnx --shapeInformation -o $ONNX_MLIR_FILES_PATH/$filename  

The above mentioned command generated the OPT.onnx.mlir

mlir-translate $ONNX_MLIR_FILES_PATH/$filename.onnx.mlir --mlir-to-llvmir -o $filename.ll

and OPT.ll is generated by the above command

AlexandreEichenberger commented 2 weeks ago

Can you give us the original onnx file? Since we are mostly about lowering ONNX to LLVM, that is where we would like to see if something went wrong. Please a small reproducer if it's a large model.

Also, does it work if you issue the command that lower it directly to .so (namely -EmitLib). That is how we usually issue the command.

Tx