You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 23, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 23, 2021. It is now read-only.
On the other hand, doing the translation with mlir-opt -convert-to-llvmir doesn't have this issue. But it yields:
$ mlir-opt -convert-to-llvmir /tmp/single.mlir
/tmp/single.mlir:2:3: error: 'affine.for' op expected body to have a single index argument for the induction variable
affine.for %i = 0 to 256 {
I think the error message here is misleading (or perhaps a bug). The following however works since these 'for' op's are lowered away.
mlir-translate is intended to translate MLIR to other IRs. Some of the translations require MLIR to only have certain dialects, in particular translation to LLVM IR requires MLIR input to only use the LLVM IR dialect. Hence the complaint about non-LLVM function argument types. None of them belongs to the LLVM dialect.
mlir-opt performs MLIR-to-MLIR transformations, including dialect conversions. The document you referenced is about converting to the dialect, not to the LLVM IR proper. The conversion is implemented for a subset of standard dialect. You need to lower away all other dialects before calling it. There is currently no way of triggering a chain of conversions that would somehow know that there is a pass that lowers away loops.
I see - thanks. In that case, shouldn't mlir-opt's '-convert-to-llvmir' be renamed - since it's converting to LLVM dialect as opposed to LLVM IR? Perhaps to '-convert-to-llvm'?
Thanks. The only thing remaining on this issue is this error message that probably has to be improved.
$ mlir-opt -lower-to-llvm /tmp/single.mlir
/tmp/single.mlir:2:3: error: 'affine.for' op expected body to have a single index argument for the induction variable
affine.for %i = 0 to 256 {
This should have ideally been a "can't lower 'affine.for' op".
Issues referenced here have been addressed, pending one is a request to rename which could best be done by way of a PR & discussion there, so closing this issue.
Activity
bondhugula commentedon Apr 22, 2019
On the other hand, doing the translation with mlir-opt -convert-to-llvmir doesn't have this issue. But it yields:
$ mlir-opt -convert-to-llvmir /tmp/single.mlir
/tmp/single.mlir:2:3: error: 'affine.for' op expected body to have a single index argument for the induction variable
affine.for %i = 0 to 256 {
I think the error message here is misleading (or perhaps a bug). The following however works since these 'for' op's are lowered away.
$ mlir-opt -lower-affine -convert-to-llvmir /tmp/single.mlir | mlir-translate -mlir-to-llvmir
Is mlir-translate missing documentation or is it out of date? It doesn't appear at https://github.com/tensorflow/mlir/blob/master/g3doc/ConversionToLLVMDialect.md and it's not clear what the difference b/w mlir-opt's -convert-to-llvmir and mlir-translate's -mlir-to-llvmir is.
ftynse commentedon Apr 24, 2019
mlir-translate is intended to translate MLIR to other IRs. Some of the translations require MLIR to only have certain dialects, in particular translation to LLVM IR requires MLIR input to only use the LLVM IR dialect. Hence the complaint about non-LLVM function argument types. None of them belongs to the LLVM dialect.
mlir-opt performs MLIR-to-MLIR transformations, including dialect conversions. The document you referenced is about converting to the dialect, not to the LLVM IR proper. The conversion is implemented for a subset of standard dialect. You need to lower away all other dialects before calling it. There is currently no way of triggering a chain of conversions that would somehow know that there is a pass that lowers away loops.
lattner commentedon Apr 24, 2019
Right. This is behaving correctly. mlir-translate is just supposed to do the last step of translation (format conversion) it does not do lowering.
bondhugula commentedon Apr 25, 2019
I see - thanks. In that case, shouldn't mlir-opt's '-convert-to-llvmir' be renamed - since it's converting to LLVM dialect as opposed to LLVM IR? Perhaps to '-convert-to-llvm'?
joker-eph commentedon Apr 25, 2019
What about
-lower-to-llvmor-llvm-lowering?Even if issuing an error is expected here, the error messages should really be improved here, we should keep this bug open to track fixing this.
lattner commentedon Apr 25, 2019
+1 for renaming to "lower-to-llvm" and improving the error messages!
madhur13490 commentedon Apr 27, 2019
Yes, even I wanted to point out that renaming sometime back. "lower-to-llvm" makes much more sense to me too.
joker-eph commentedon May 9, 2019
The renaming was done in 822e3fc
bondhugula commentedon May 11, 2019
Thanks. The only thing remaining on this issue is this error message that probably has to be improved.
$ mlir-opt -lower-to-llvm /tmp/single.mlir
/tmp/single.mlir:2:3: error: 'affine.for' op expected body to have a single index argument for the induction variable
affine.for %i = 0 to 256 {
This should have ideally been a "can't lower 'affine.for' op".
jpienaar commentedon Jul 9, 2019
Issues referenced here have been addressed, pending one is a request to rename which could best be done by way of a PR & discussion there, so closing this issue.
joker-eph commentedon Jul 10, 2019
Actually the rename has been done, the remaining issue is about the lowering error message being confusing.
Revert "[Concepts] Placeholder constraints and abbreviated templates"