Compile error when using consecutive pad
Labels: triaged, oncall: pt2, module: inductor

### 🐛 Describe the bug

Hi! This is a bug found by a fuzzer which might be uncommon in the real world. However, it looks like an unseen internal error.  So I still report it in case it might lead to other problems.

```
import torch
x = torch.rand([1,2,1], device='cuda')
def forward():
    a = torch.nn.functional.pad(x, (0, 1))
    b = torch.nn.functional.pad(a, (0, 0, 0, 1), 'reflect')
    b[0, 0, 0] = 0.1
    return b

with torch.no_grad():
    print(forward())
    fn_compiled = torch.compile(forward)
    print(fn_compiled())
```

### Error logs

<details>

```
Traceback (most recent call last):
  File "/home/su/accdiff/test.py", line 13, in <module>
    print(fn_compiled())
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/eval_frame.py", line 235, in _fn
    return fn(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/eval_frame.py", line 372, in catch_errors
    return callback(frame, cache_size, hooks)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/convert_frame.py", line 412, in _convert_frame
    result = inner_convert(frame, cache_size, hooks)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/convert_frame.py", line 110, in _fn
    return fn(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/convert_frame.py", line 269, in _convert_frame_assert
    return _compile(
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/utils.py", line 166, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/convert_frame.py", line 331, in _compile
    out_code = transform_code_object(code, transform)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/bytecode_transformation.py", line 530, in transform_code_object
    transformations(instructions, code_options)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/convert_frame.py", line 318, in transform
    tracer.run()
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/symbolic_convert.py", line 1854, in run
    super().run()
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/symbolic_convert.py", line 604, in run
    and self.step()
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in step
    getattr(self, inst.opname)(inst)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/symbolic_convert.py", line 1933, in RETURN_VALUE
    self.output.compile_subgraph(
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/output_graph.py", line 581, in compile_subgraph
    self.compile_and_call_fx_graph(tx, list(reversed(stack_values)), root)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/output_graph.py", line 651, in compile_and_call_fx_graph
    compiled_fn = self.call_user_compiler(gm)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/utils.py", line 166, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/output_graph.py", line 730, in call_user_compiler
    raise BackendCompilerFailed(self.compiler_fn, e).with_traceback(
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/output_graph.py", line 726, in call_user_compiler
    compiled_fn = compiler_fn(gm, self.fake_example_inputs())
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/debug_utils.py", line 1088, in debug_wrapper
    compiled_gm = compiler_fn(gm, example_inputs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/__init__.py", line 1527, in __call__
    return compile_fx(model_, inputs_, config_patches=self.config)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/compile_fx.py", line 568, in compile_fx
    return aot_autograd(
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/backends/common.py", line 62, in compiler_fn
    cg = aot_module_simplified(gm, example_inputs, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_functorch/aot_autograd.py", line 3044, in aot_module_simplified
    compiled_fn = create_aot_dispatcher_function(
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/utils.py", line 166, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_functorch/aot_autograd.py", line 2687, in create_aot_dispatcher_function
    compiled_fn = compiler_fn(flat_fn, fake_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_functorch/aot_autograd.py", line 1794, in aot_wrapper_dedupe
    return compiler_fn(flat_fn, leaf_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_functorch/aot_autograd.py", line 1960, in aot_wrapper_synthetic_base
    return compiler_fn(flat_fn, flat_args, aot_config, fw_metadata=fw_metadata)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_functorch/aot_autograd.py", line 1260, in aot_dispatch_base
    compiled_fw = compiler(fw_module, flat_args)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/utils.py", line 166, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/compile_fx.py", line 532, in fw_compiler_base
    return inner_compile(
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/debug_utils.py", line 622, in debug_wrapper
    compiled_fn = compiler_fn(gm, example_inputs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/debug.py", line 239, in inner
    return fn(*args, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/compile_fx.py", line 184, in compile_fx_inner
    compiled_fn = graph.compile_to_fn()
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/graph.py", line 651, in compile_to_fn
    return self.compile_to_module().call
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_dynamo/utils.py", line 166, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/graph.py", line 627, in compile_to_module
    mod = PyCodeCache.load(code, linemap=linemap)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/codecache.py", line 645, in load
    return cls.load_by_key_path(key, path, linemap)
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/codecache.py", line 660, in load_by_key_path
    exec(code, mod.__dict__, mod.__dict__)
  File "/tmp/torchinductor_su/4z/c4zfyhvmhdxtexf7nlasmfuwk6v57f47ujeyfvxymet23zqho5w7.py", line 88, in <module>
    async_compile.wait(globals())
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/codecache.py", line 876, in wait
    scope[key] = result.result()
  File "/home/su/accdiff/accdiff_env/lib/python3.9/site-packages/torch/_inductor/codecache.py", line 734, in result
    self.future.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 445, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
torch._dynamo.exc.BackendCompilerFailed: backend='debug_wrapper' raised:
CompilationError: at 29:39:    tmp9 = tl.abs(tmp8)
    tmp10 = tmp7 - tmp9
    tmp11 = tl.abs(tmp10)
    tmp12 = tmp7 - tmp11
    tmp13 = tmp4 - tmp0
    tmp14 = tl.abs(tmp13)
    tmp15 = tmp7 - tmp14
    tmp16 = tl.abs(tmp15)
    tmp17 = tmp7 - tmp16
    tmp18 = tmp17
    tmp19 = tmp18 < tmp7
    tmp20 = tl.load(in_ptr0 + (tmp12), tmp19, other=0)
                                       ^
ValueError('Mask argument cannot be block type if pointer argument is not a block')
```

</details>

### Minified repro

_No response_

### Versions

<details>

```
Collecting environment information...
PyTorch version: 2.1.0a0+gitfe05266
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.4 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.2
Libc version: glibc-2.31

Python version: 3.9.5 (default, Nov 23 2021, 15:27:38)  [GCC 9.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-67-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 11.6.112
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2070
Nvidia driver version: 510.108.03
cuDNN version: Probably one of the following:
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn.so.8.6.0
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.6.0
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.6.0
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.6.0
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.6.0
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.6.0
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.6.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn.so.8.7.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.7.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.7.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.7.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.7.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.7.0
/usr/local/cuda-11.7/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.7.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   43 bits physical, 48 bits virtual
CPU(s):                          32
On-line CPU(s) list:             0-31
Thread(s) per core:              2
Core(s) per socket:              16
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       AuthenticAMD
CPU family:                      23
Model:                           1
Model name:                      AMD Ryzen Threadripper 1950X 16-Core Processor
Stepping:                        1
Frequency boost:                 enabled
CPU MHz:                         2200.000
CPU max MHz:                     3400.0000
CPU min MHz:                     2200.0000
BogoMIPS:                        6786.49
Virtualization:                  AMD-V
L1d cache:                       512 KiB
L1i cache:                       1 MiB
L2 cache:                        8 MiB
L3 cache:                        32 MiB
NUMA node0 CPU(s):               0-31
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Mitigation; untrained return thunk; SMT vulnerable
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev

Versions of relevant libraries:
[pip3] numpy==1.24.2
[pip3] torch==2.1.0a0+gitc1a6dde
[pip3] triton==2.1.0
```

</details>

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire