Iree-translate and linalg.init_tensor

189 views
Skip to first unread message

Hugo Pompougnac

unread,
Dec 20, 2021, 9:39:44 AM12/20/21
to iree-discuss
Hello,

Is there a way to allow iree-translate to work on an input file containing linalg.init_tensor ops ?

With such a file, the command ```iree-translate myfile.mlir -iree-input-type=mhlo -iree-mlir-to-vm-bytecode-module -iree-hal-target-backends=dylib-llvm-aot -o myfile.vmfb``` fails with the following message : "error: failed to legalize operation 'linalg.init_tensor' that was explicitly marked illegal"

I use iree built from the commit 02cfcd1e5561c0db0470d09644a1f527c259c208 (november 14, 2021).

Best regards,

Hugo

Geoffrey Martin-Noble

unread,
Dec 20, 2021, 4:09:38 PM12/20/21
to Hugo Pompougnac, iree-discuss
Does your input also contain MHLO ops? If not, then you probably don't want to be passing `--iree-input-type=mhlo`. I think linalg stuff would only be marked explicitly illegal at a pass further down the pipeline. Can you share your IR? Also you should be able to identify the specific pass that is failing. I thought it should be in the output already, but maybe not. If you pass `--print-ir-after-failure` it definitely will include the name of the failing pass as well as what the IR looks like at that point. https://mlir.llvm.org/getting_started/Debugging/ has more general debugging tips. `--debug-only=dialect-conversion` would in particular be useful here (requires building with debug) to see why the linalg.init_tensor isn't getting converted, though you may only want to run a single pass with that to avoid tons of output. https://mlir.llvm.org/docs/PassManagement/#crash-and-failure-reproduction could be used to create a reproducer

--
You received this message because you are subscribed to the Google Groups "iree-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iree-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iree-discuss/fa76cff8-1e8a-46e1-817f-5a8f64f95a29n%40googlegroups.com.

Hugo Pompougnac

unread,
Jan 11, 2022, 6:26:24 AM1/11/22
to iree-discuss
Thank you for the debug tips. For now, I have juste replaced linalg.init_tensor by some constants (in order to make the whole thing work). I will follow the steps you suggerate.
Reply all
Reply to author
Forward
0 new messages