mlir icon indicating copy to clipboard operation
mlir copied to clipboard

-lower-to-llvm/mlir-cpu-runner: missing line number info in errors

Open bondhugula opened this issue 5 years ago • 6 comments

$ mlir-opt -lower-to-llvm test/Transforms/dma-generate.mlir :0: error: only 1D vectors are supported

I was expecting line number information here to be available.

bondhugula avatar Jul 19 '19 04:07 bondhugula

This is from the type converter, which isn't provided with a source location.

River707 avatar Jul 19 '19 06:07 River707

Isn't the type (that is being provided to the type converter) from a unique operation? In that case, can the source location be passed to it?

bondhugula avatar Jul 19 '19 06:07 bondhugula

A majority of the types come from block arguments, which don't have an exact location. Though I suppose we could use the location of the parent operation of the region the block is contained in.

River707 avatar Jul 19 '19 06:07 River707

For block argument types, the source location is ideally expected to be the source location of the block label (and that of the parent operation if it's the entry block), but I think this information isn't maintained in MLIR (I don't see a block->getLoc(), and ran into this recently)? The parent operation's location is a reasonable approximation though.

In any case, the error observed here leaves the user clueless as to where the lowering failed.

bondhugula avatar Jul 19 '19 07:07 bondhugula

I've struggled with this in SIL before, and have tried all the horrible hacks (none of which work well) - is there a disadvantage to adding a location to blockarguments? When (e.g.) mem2reg builds a block argument, it can easily propagate the location from the load.

lattner avatar Jul 19 '19 16:07 lattner

Below is yet another case of missing line number info due to arguments missing such info.

$ mlir-cpu-runner -e test /tmp/test.mlir Error: non-memref argument not supported

allocMemRefDescriptor should be taking in a location argument: https://github.com/tensorflow/mlir/blob/77efdea3c70df3b68aeecbbc82ee9e969dca499c/lib/ExecutionEngine/MemRefUtils.cpp#L39

bondhugula avatar Jul 26 '19 14:07 bondhugula