Skip to content

Instantly share code, notes, and snippets.

@bjacob
Created November 4, 2021 18:10
Show Gist options
  • Save bjacob/05c0a44f65cdb3a17dffc9a846478ae0 to your computer and use it in GitHub Desktop.
Save bjacob/05c0a44f65cdb3a17dffc9a846478ae0 to your computer and use it in GitHub Desktop.

Command line:

iree/tools/iree-translate -iree-mlir-to-vm-bytecode-module -mlir-print-op-on-diagnostic=false --iree-hal-target-backends=dylib-llvm-aot /tmp/a.mlir -o /tmp/a.vmfb -iree-llvm-embedded-linker-path=third_party/llvm-project/llvm/bin/lld

Output:

/tmp/a.mlir:10:8: error: 'linalg.tensor_expand_shape' op expected dimension 0 of collapsed type to be dynamic since one or more of the corresponding dimensions in the expanded type is dynamic
  %1 = linalg.tensor_expand_shape %0 [[0, 1], [2, 3]] : tensor<?x?xi8> into tensor<?x8x?x4xi8>
       ^
/tmp/a.mlir:1:1: note: called from
func @f1(%arg0: tensor<1x1xi8>) -> tensor<?x8x?x4xi8> {
^
/tmp/a.mlir:23:8: error: 'util.do_not_optimize' op must have same operand and result types, but they differ at index 0
  %1 = util.do_not_optimize(%0) : tensor<?x?xi8>
       ^
/tmp/a.mlir:14:1: note: called from
func @f2(%arg0: tensor<1x1xi8>) -> tensor<?x?xi8> {
^
/tmp/a.mlir:0:0: error: conversion from source -> vm failed

func @f1(%arg0: tensor<1x1xi8>) -> tensor<?x8x?x4xi8> {
%c5 = arith.constant 5 : index
%c3 = arith.constant 3 : index
%c0 = arith.constant 0 : index
%c0_i8 = arith.constant 0 : i8
%0 = linalg.pad_tensor %arg0 low[0, 0] high[%c5, %c3] {
^bb0(%arg3: index, %arg4: index): // no predecessors
linalg.yield %c0_i8 : i8
} : tensor<1x1xi8> to tensor<?x?xi8>
%1 = linalg.tensor_expand_shape %0 [[0, 1], [2, 3]] : tensor<?x?xi8> into tensor<?x8x?x4xi8>
return %1 : tensor<?x8x?x4xi8>
}
func @f2(%arg0: tensor<1x1xi8>) -> tensor<?x?xi8> {
%c5 = arith.constant 5 : index
%c3 = arith.constant 3 : index
%c0 = arith.constant 0 : index
%c0_i8 = arith.constant 0 : i8
%0 = linalg.pad_tensor %arg0 low[0, 0] high[%c5, %c3] {
^bb0(%arg3: index, %arg4: index): // no predecessors
linalg.yield %c0_i8 : i8
} : tensor<1x1xi8> to tensor<?x?xi8>
%1 = util.do_not_optimize(%0) : tensor<?x?xi8>
return %1 : tensor<?x?xi8>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment