Fail to build C++ test_aot_inductor
Labels: triaged, oncall: pt2, module: inductor

### 🐛 Describe the bug

When building `test_aot_inductor` with `BUILD_AOT_INDUCTOR_TEST=1  python setup.py build`, the build fails with the following error (discovered by @muchulee8)

```
[4826/7070] Generating libaot_inductor_output.so
FAILED: test_aot_inductor/libaot_inductor_output.so /home/huydo/github/pytorch/build/test_aot_inductor/libaot_inductor_output.so
cd /home/huydo/github/pytorch/build/test_aot_inductor && python /home/huydo/github/pytorch/test/cpp/aot_inductor/test.py
/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py:135: UserWarning: TensorFloat32 tensor cores for float32 matrix multiplication available but not enabled. Consider setting `torch.set_float32_matmul_precision('high')` for better performance.
  warnings.warn(
Traceback (most recent call last):
  File "/home/huydo/github/pytorch/test/cpp/aot_inductor/test.py", line 25, in <module>
    lib_path, module = torch._export.aot_compile(Net().cuda(), (x, y))
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_export/__init__.py", line 483, in aot_compile
    so_path = torch._inductor.aot_compile(ep.graph_module, list(all_args), options)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/__init__.py", line 48, in aot_compile
    result = compile_fx_aot(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 865, in compile_fx_aot
    return compile_fx(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 959, in compile_fx
    return compile_fx(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 977, in compile_fx
    return compile_fx(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1146, in compile_fx
    return aot_autograd(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 55, in compiler_fn
    cg = aot_module_simplified(gm, example_inputs, **kwargs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 3891, in aot_module_simplified
    compiled_fn = create_aot_dispatcher_function(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 189, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 3429, in create_aot_dispatcher_function
    compiled_fn = compiler_fn(flat_fn, fake_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2212, in aot_wrapper_dedupe
    return compiler_fn(flat_fn, leaf_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2392, in aot_wrapper_synthetic_base
    return compiler_fn(flat_fn, flat_args, aot_config, fw_metadata=fw_metadata)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1573, in aot_dispatch_base
    compiled_fw = compiler(fw_module, flat_args)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 189, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1088, in fw_compiler_base
    return inner_compile(
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 244, in wrapper
    compiled(real_inputs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/codecache.py", line 373, in __call__
    return self.get_current_callable()(inputs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/codecache.py", line 400, in _run_from_cache
    return compiled_graph.compiled_artifact(inputs)
  File "/tmp/torchinductor_huydo/xt/cxti37vajc246zxrtlz254qxq2su6l34jgktkil7nadig6e4z263.py", line 72, in call
    triton_poi_fused_add_cos_sin_0.run(arg2_1, arg3_1, buf0, 2048, grid=grid(2048), stream=stream0)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/triton_heuristics.py", line 383, in run
    self.autotune_to_one_config(*args, grid=grid)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/triton_heuristics.py", line 308, in autotune_to_one_config
    timings = self.benchmark_all_configs(*args, **kwargs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 189, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/triton_heuristics.py", line 284, in benchmark_all_configs
    timings = {
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/triton_heuristics.py", line 285, in <dictcomp>
    launcher: self.bench(launcher, *args, **kwargs)
  File "/home/huydo/py3.10/lib/python3.10/site-packages/torch/_inductor/triton_heuristics.py", line 241, in bench
    if launcher.n_spills > config.triton.spill_threshold:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
```

### Versions

The build is done on devgpu:

```
Collecting environment information...
PyTorch version: 2.1.0a0+git88c400e
Is debug build: False
CUDA used to build PyTorch: 12.0
ROCM used to build PyTorch: N/A

OS: CentOS Stream 9 (x86_64)
GCC version: (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
Clang version: Could not collect
CMake version: version 3.26.3
Libc version: glibc-2.34

Python version: 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.12.0-0_fbk13_zion_7455_gb24de3bdb045-x86_64-with-glibc2.34
Is CUDA available: True
CUDA runtime version: 12.0.140
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA PG509-210
GPU 1: NVIDIA PG509-210
GPU 2: NVIDIA PG509-210
GPU 3: NVIDIA PG509-210
GPU 4: NVIDIA PG509-210
GPU 5: NVIDIA PG509-210
GPU 6: NVIDIA PG509-210
GPU 7: NVIDIA PG509-210

Nvidia driver version: 525.105.17
cuDNN version: Could not collect
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
Address sizes:                   46 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          192
On-line CPU(s) list:             0-191
Vendor ID:                       GenuineIntel
Model name:                      Intel(R) Xeon(R) Platinum 8339HC CPU @ 1.80GHz
CPU family:                      6
Model:                           85
Thread(s) per core:              2
Core(s) per socket:              24
Socket(s):                       4
Stepping:                        11
Frequency boost:                 enabled
CPU max MHz:                     1801.0000
CPU min MHz:                     800.0000
BogoMIPS:                        3600.00
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization:                  VT-x
L1d cache:                       3 MiB (96 instances)
L1i cache:                       3 MiB (96 instances)
L2 cache:                        96 MiB (96 instances)
L3 cache:                        132 MiB (4 instances)
NUMA node(s):                    4
NUMA node0 CPU(s):               0-23,96-119
NUMA node1 CPU(s):               24-47,120-143
NUMA node2 CPU(s):               48-71,144-167
NUMA node3 CPU(s):               72-95,168-191
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
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; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] mypy==0.960
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.22.4
[pip3] pytorch-lightning==1.9.5
[pip3] pytorch-metric-learning==1.7.3
[pip3] torch==2.1.0a0+gitda67b41
[pip3] torchaudio==0.13.1+cpu
[pip3] torchmetrics==0.8.2
[pip3] torchvision==0.14.1
[pip3] triton==2.0.0.post1
[conda] numpy                     1.22.4                   pypi_0    pypi
[conda] pytorch-lightning         1.9.5                    pypi_0    pypi
[conda] pytorch-metric-learning   1.7.3                    pypi_0    pypi
[conda] torch                     2.1.0a0+gitda67b41          pypi_0    pypi
[conda] torchaudio                0.13.1+cpu               pypi_0    pypi
[conda] torchmetrics              0.8.2                    pypi_0    pypi
[conda] torchvision               0.14.1                   pypi_0    pypi
[conda] triton                    2.0.0.post1              pypi_0    pypi
```

cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @ngimel @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov