It will output two different results when applying two different optimization pass sequences:
pass sequence1: --sparsification-and-bufferization --tensor-bufferize --func-bufferize --convert-func-to-llvm --convert-index-to-llvm --convert-vector-to-llvm --finalize-memref-to-llvm --convert-arith-to-llvm --reconcile-unrealized-castspass sequence2: --tensor-bufferize --func-bufferize --convert-func-to-llvm --convert-index-to-llvm --convert-vector-to-llvm --finalize-memref-to-llvm --convert-arith-to-llvm --reconcile-unrealized-casts
The pass sequence1 outputs the executable that outputs 1, while the latter outputs 0.
The difference between pass sequence1 and pass sequence2 is that there is an additional --sparsification-and-bufferization at the begining of the pass sequence1.
I futher analyze the output of these two sequences:
pass1: --sparsification-and-bufferization --tensor-bufferize
pass2: --tensor-bufferize
The result of pass1 is:
It seems that --sparsification-and-bufferization --tensor-bufferize treats the operand and the result of tensor.insert as same tensor(memref),
when the operand of tensor.insert is created by tensor.empty.
If I replace the tensor.empty with tensor.from_element, or just wrap the tensor.empty with a function. The modified MLIR program will output the same result.
The modified program:
I wonder if there is some thing wrong with --sparsification-and-bufferization and tensor.empty.
This result inconsistency may not be a problem because tensor.empty should only contains the shpae information.
Consider the following MLIR program: a.mlir:
It will output two different results when applying two different optimization pass sequences:
pass sequence1
:--sparsification-and-bufferization --tensor-bufferize --func-bufferize --convert-func-to-llvm --convert-index-to-llvm --convert-vector-to-llvm --finalize-memref-to-llvm --convert-arith-to-llvm --reconcile-unrealized-casts
pass sequence2
:--tensor-bufferize --func-bufferize --convert-func-to-llvm --convert-index-to-llvm --convert-vector-to-llvm --finalize-memref-to-llvm --convert-arith-to-llvm --reconcile-unrealized-casts
The
pass sequence1
outputs the executable that outputs 1, while the latter outputs 0. The difference betweenpass sequence1
andpass sequence2
is that there is an additional--sparsification-and-bufferization
at the begining of thepass sequence1
.I futher analyze the output of these two sequences: pass1:
--sparsification-and-bufferization --tensor-bufferize
pass2:--tensor-bufferize
The result ofpass1
is:The result of
pass2
is:It seems that
--sparsification-and-bufferization --tensor-bufferize
treats the operand and the result oftensor.insert
as same tensor(memref), when the operand oftensor.insert
is created bytensor.empty
.If I replace the
tensor.empty
withtensor.from_element
, or just wrap thetensor.empty
with a function. The modified MLIR program will output the same result. The modified program:I wonder if there is some thing wrong with
--sparsification-and-bufferization
andtensor.empty
. This result inconsistency may not be a problem becausetensor.empty
should only contains the shpae information.git version: 2163ae761808ca0e5478357384f6ddbacce279eb