Open wangyongj1a opened 1 week ago
I tried to reproduce this issue on history commit versions, and l found these inconsistent results can be reproduced on the commit of pass --for-loop-range-folding(i.e., --scf-for-loop-range-folding pass in the previous command) that was first added(3f429e82d3ea1710ee0a841675acba9bb7b658d2). To satisfy the history syntax and pass usage, I made some changes to the program, and the adjusted test.mlir is:
module {
func @func1() -> f32{
%idx0 = constant 0 :index
%c21848_i16 = constant 21848 : i16
%c1 = constant 1 : index
%c5 = constant 5 : index
%alloc_107 = memref.alloc(%c5, %c1) : memref<?x?x1xi16>
%c-58_i16 = constant -58 : i16
linalg.fill(%c-58_i16, %alloc_107) : i16, memref<?x?x1xi16>
affine.for %arg0 = 1 to 61 {
memref.store %c21848_i16, %alloc_107[%idx0, %idx0, %idx0] : memref<?x?x1xi16>
}
%1 = memref.load %alloc_107[%idx0, %idx0, %idx0] : memref<?x?x1xi16>
vector.print %1 : i16
%2 = sitofp %1 : i16 to f32
return %2 : f32
}
}
When I ran
/data/tmp/3f429e82d3ea/llvm-project/build/bin/mlir-opt --affine-loop-tile="tile-size=32" --affine-loop-normalize --lower-affine --canonicalize \
--convert-scf-to-std --convert-vector-to-llvm --convert-linalg-to-loops --convert-scf-to-std --convert-std-to-llvm test.mlir | /data/tmp/3f429e82d3ea/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/3f429e82d3ea/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/3f429e82d3ea/llvm-project/build/lib/libmlir_c_runner_utils.so
on the program, I got the result of:
21848
2.184800e+04
However, when I ran
/data/tmp/3f429e82d3ea/llvm-project/build/bin/mlir-opt --affine-loop-tile="tile-size=32" --affine-loop-normalize --lower-affine --canonicalize \
--for-loop-range-folding \
--convert-scf-to-std --convert-vector-to-llvm --convert-linalg-to-loops --convert-scf-to-std --convert-std-to-llvm test.mlir | /data/tmp/3f429e82d3ea/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/3f429e82d3ea/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/3f429e82d3ea/llvm-project/build/lib/libmlir_c_runner_utils.so
on the program, I got the result of:
-58
-5.800000e+01
Note that @anthonycanino1 has stopped committing more than 2 years, @joker-eph sorry to disturb but I was wondering if you would mind taking a look at this problem?
I have the following MLIR program: test.mlir:
When I ran
/data/tmp/v1118/llvm-project/build/bin/mlir-opt --affine-loop-tile="tile-size=32" --affine-loop-normalize --lower-affine --convert-vector-to-llvm --convert-arith-to-llvm --convert-linalg-to-loops --convert-arith-to-llvm --convert-scf-to-cf --convert-arith-to-llvm --convert-index-to-llvm --finalize-memref-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1118/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1118/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1118/llvm-project/build/lib/libmlir_c_runner_utils.so
on the program, I got the result of:However, when I ran
/data/tmp/v1118/llvm-project/build/bin/mlir-opt --affine-loop-tile="tile-size=32" --affine-loop-normalize --lower-affine --test-vector-sink-patterns --scf-for-loop-range-folding --convert-vector-to-llvm --convert-arith-to-llvm --convert-linalg-to-loops --convert-arith-to-llvm --convert-scf-to-cf --convert-arith-to-llvm --convert-index-to-llvm --finalize-memref-to-llvm --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1118/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1118/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1118/llvm-project/build/lib/libmlir_c_runner_utils.so
on the program, I got the result of:The above two results seem to be inconsistent. I'm not sure if there is any bug in my program or if the wrong usage of the above passes caused these results.
My git version is c25c6c32494c8d1038438b6208d42ba40f25270e.