`min` reduction on float16 tensor failed on certain shapes
Labels: triaged, module: inductor

### 🐛 Describe the bug

### 🐛 Describe the bug

The following program leads to an error.

```python
import torch

def fn(x):
    o = x.min(1).values
    return o

x = torch.rand((2, 8, 2), dtype=torch.float16) # AssertionError
# x = torch.rand((2, 7, 2), dtype=torch.float16) # works fine
fn(x)
print('==== CPU Eager mode OK! ====')

compiled = torch.compile(fn)
compiled(x)
print('==== CPU compiled mode OK! ====')

compiled(x.cuda())
print('==== GPU compiled mode OK! ====')
```

<details>
<summary>Error logs</summary>

```python
==== CPU Eager mode OK! ====
[2023-01-29 22:59:43,416] torch._inductor.scheduler: [CRITICAL] Error in codegen for ComputedBuffer(name='buf0', layout=FixedLayout('cpu', torch.float16, size=[2, 2], stride=[2, 1]), data=Reduction(
  'cpu',
  torch.float16,
  tmp0 = load(arg0_1, i1 + 2 * r0 + 16 * i0)
  return tmp0
  ,
  ranges=[2, 2],
  reduction_ranges=[8],
  reduction_type=min,
  origins={arg0_1, min_1}
))
Traceback (most recent call last):
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 692, in call_user_compiler
    compiled_fn = compiler_fn(gm, self.fake_example_inputs())
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/debug_utils.py", line 1047, in debug_wrapper
    compiled_gm = compiler_fn(gm, example_inputs, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/__init__.py", line 1331, in __call__
    return self.compile_fn(model_, inputs_)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/optimizations/backends.py", line 24, in inner
    return fn(gm, example_inputs, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/optimizations/backends.py", line 61, in inductor
    return compile_fx(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 413, in compile_fx
    return aot_autograd(
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/optimizations/training.py", line 74, in compiler_fn
    cg = aot_module_simplified(gm, example_inputs, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2483, in aot_module_simplified
    compiled_fn = create_aot_dispatcher_function(
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 160, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2180, in create_aot_dispatcher_function
    compiled_fn = compiler_fn(flat_fn, fake_flat_args, aot_config)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1411, in aot_wrapper_dedupe
    return compiler_fn(flat_fn, leaf_flat_args, aot_config)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1061, in aot_dispatch_base
    compiled_fw = aot_config.fw_compiler(fw_module, flat_args)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 160, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 388, in fw_compiler
    return inner_compile(
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/debug_utils.py", line 586, in debug_wrapper
    compiled_fn = compiler_fn(gm, example_inputs, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/debug.py", line 239, in inner
    return fn(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 151, in compile_fx_inner
    compiled_fn = graph.compile_to_fn()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/graph.py", line 560, in compile_to_fn
    return self.compile_to_module().call
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 160, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/graph.py", line 545, in compile_to_module
    code = self.codegen()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/graph.py", line 496, in codegen
    self.scheduler.codegen()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 160, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 1122, in codegen
    self.get_backend(device).codegen_nodes(node.get_nodes())
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 1510, in codegen_nodes
    cpp_kernel_proxy.codegen_nodes(nodes)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 1410, in codegen_nodes
    scalar_kernel = codegen_kernel(CppKernel)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 1382, in codegen_kernel
    run(kernel)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 1399, in run
    node.run(vars, reduction_vars)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 345, in run
    self.codegen(index_vars)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/scheduler.py", line 367, in codegen
    self._body(*index_vars)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/ir.py", line 3911, in __call__
    result = self.root_block()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/ir.py", line 4008, in __call__
    return InterpreterShim(graph, submodules).run(V.get_ops_handler())
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/fx/interpreter.py", line 136, in run
    self.env[node] = self.run_node(node)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/fx/interpreter.py", line 177, in run_node
    return getattr(self, n.op)(n.target, args, kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/fx/interpreter.py", line 271, in call_method
    return getattr(self_obj, target)(*args_tail, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/sizevars.py", line 591, in reduction
    return self._inner.reduction(
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/common.py", line 601, in reduction
    return self.reduction(
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 699, in reduction
    float16_reduction_prefix(reduction_type)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_inductor/codegen/cpp.py", line 143, in float16_reduction_prefix
    assert rtype in (
AssertionError: float16 user-defined reduction only supports 'sum' and 'any' but got min

While executing %reduction : [#users=1] = call_method[target=reduction](args = (%ops, buf0, torch.float16, torch.float16, min, %get_index_1, %load), kwargs = {})
Original traceback:
None

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/colin/code/path/bug.py", line 12, in <module>
    compiled(x)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 211, in _fn
    return fn(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 332, in catch_errors
    return callback(frame, cache_size, hooks)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 403, in _convert_frame
    result = inner_convert(frame, cache_size, hooks)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 103, in _fn
    return fn(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 261, in _convert_frame_assert
    return _compile(
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 160, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 323, in _compile
    out_code = transform_code_object(code, transform)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 341, in transform_code_object
    transformations(instructions, code_options)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 310, in transform
    tracer.run()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1727, in run
    super().run()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1793, in RETURN_VALUE
    self.output.compile_subgraph(self)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 539, in compile_subgraph
    self.compile_and_call_fx_graph(tx, list(reversed(stack_values)), root)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 610, in compile_and_call_fx_graph
    compiled_fn = self.call_user_compiler(gm)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 160, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/colin/miniconda3/envs/py10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 697, in call_user_compiler
    raise BackendCompilerFailed(self.compiler_fn, e) from e
torch._dynamo.exc.BackendCompilerFailed: debug_wrapper raised AssertionError: float16 user-defined reduction only supports 'sum' and 'any' but got min

While executing %reduction : [#users=1] = call_method[target=reduction](args = (%ops, buf0, torch.float16, torch.float16, min, %get_index_1, %load), kwargs = {})
Original traceback:
None

Set torch._dynamo.config.verbose=True for more information


You can suppress this exception and fall back to eager by setting:
    torch._dynamo.config.suppress_errors = True
```

</details>

### Versions

```python
Collecting environment information...
PyTorch version: 2.0.0.dev20230129+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.5 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: 10.0.0-4ubuntu1 
CMake version: version 3.25.0
Libc version: glibc-2.31

Python version: 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-58-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2080 Ti
Nvidia driver version: 510.85.02
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.7.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.24.1
[pip3] pytorch-triton==2.0.0+0d7e753227
[pip3] torch==2.0.0.dev20230129+cu117
[pip3] torchaudio==2.0.0.dev20230129+cu117
[pip3] torchvision==0.15.0.dev20230129+cu117
[conda] numpy                     1.24.1                   pypi_0    pypi
[conda] pytorch-triton            2.0.0+0d7e753227          pypi_0    pypi
[conda] torch                     2.0.0.dev20230129+cu117          pypi_0    pypi
[conda] torchaudio                2.0.0.dev20230129+cu117          pypi_0    pypi
[conda] torchvision               0.15.0.dev20230129+cu117          pypi_0    pypi
```

cc @mlazos @soumith @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @chunyuan-w @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire