Repository navigation
Description
What happened?
HI, excuse me. I met a problem. MaxPooling results are wrong, contains -INF. I ran the mlir file below
"builtin.module"() ({ "func.func"() ({ ^bb0(%arg0: !iree_input.buffer_view): %0 = "mhlo.constant"() {value = dense<0xFF800000> : tensor<f32>} : () -> tensor<f32> %1 = "iree_input.cast.buffer_view_to_tensor"(%arg0) : (!iree_input.buffer_view) -> tensor<1x28x28x480xf32> %2 = "mhlo.reduce_window"(%1, %0) ({ ^bb0(%arg1: tensor<f32>, %arg2: tensor<f32>): %4 = "mhlo.maximum"(%arg1, %arg2) : (tensor<f32>, tensor<f32>) -> tensor<f32> "mhlo.return"(%4) : (tensor<f32>) -> () }) {padding = dense<[[0, 0], [0, 1], [0, 1], [0, 0]]> : tensor<4x2xi64>, window_dimensions = dense<[1, 3, 3, 1]> : tensor<4xi64>, window_strides = dense<[1, 2, 2, 1]> : tensor<4xi64>, lowering_config = #iree_codegen.lowering_config<tile_sizes= [[1, 1, 32, 4, 4]]>} : (tensor<1x28x28x480xf32>, tensor<f32>) -> tensor<1x14x14x480xf32> %3 = "iree_input.cast.tensor_to_buffer_view"(%2) : (tensor<1x14x14x480xf32>) -> !iree_input.buffer_view "func.return"(%3) : (!iree_input.buffer_view) -> () }) {function_type = (!iree_input.buffer_view) -> !iree_input.buffer_view, iree.abi = "{\22a\22:[[\22named\22,\22x\22,[\22ndarray\22,\22f32\22,4,1,28,28,480]]],\22r\22:[[\22sdict\22,[\22output_0\22,[\22ndarray\22,\22f32\22,4,1,14,14,480]]]],\22v\22:1}", sym_name = "serving_default"} : () -> () }) : () -> ()
Steps to reproduce your issue
-
iree-compile maxpooling.mlir
--mlir-disable-threading
--mlir-elide-elementsattrs-if-larger=10
-iree-input-type=mhlo
-iree-hal-target-backends=cuda
--iree-hal-cuda-llvm-target-arch=sm_80
-iree-mlir-to-vm-bytecode-module
--mlir-print-ir-after-change
--mlir-print-ir-before-all
--mlir-print-ir-after-all
-o maxpooling.vmfb -
iree-run-module --print_max_element_count=1000000 --module_file=maxpooling.vmfb --device=cuda --entry_function=serving_default --function_input="1x28x28x480xf32=[[[[-1.f]]]]"
-
output contains -INF values
What component(s) does this issue relate to?
MLIR, Compiler
Version information
No response
Additional context
Looks like the problem is that tilesize is not divisible? If change input shape to 28x28x640(tilesize=[1,1,64]), the result looks normal
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
jpienaar commentedon Aug 17, 2022
Could you also add the input tensor program here?
sun2011yao commentedon Aug 17, 2022
Here is the specified input
jpienaar commentedon Aug 17, 2022
I meant the input program at purely tensor level before it gets to buffer.
does not have valid types being used. It would need at least element types.
sun2011yao commentedon Aug 18, 2022
Sorry, there was a problem with the mlir file uploaded before, I updated the file
jpienaar commentedon Aug 18, 2022
../iree-build/tools/iree-compile /tmp/10120.mlir --mlir-disable-threading -iree-input-type=mhlo -iree-hal-target-backends=llvm-cpu -iree-mlir-to-vm-bytecode-module -o maxpooling.vmfb ../iree-build/tools/iree-run-module --print_max_element_count=1000000 --module_file=maxpooling.vmfb --entry_function=serving_default --function_input="1x28x28x480xf32=[[[[-1.f]]]]"returns all -1. So maybe something on GPU. I don't have a GPU, but will tag GPU codegen to triage.
(tested at 9cdcc05)
sun2011yao commentedon Aug 18, 2022
OK, i ran it on an A100
allieculp commentedon Aug 18, 2022
@ThomasRaoux Please help review this new issue and add priority!
ThomasRaoux commentedon Aug 19, 2022
We were missing some barriers for some cases. Sent a PR to fix it: #10137