make_fx(functionalize(f), tracing_mode='symbolic') breaks on torch.matmul
Labels: triaged, module: aotdispatch

### 🐛 Describe the bug

The following block of code takes a single `torch.matmul` call, functionalizes it, then calls `make_fx` with symbolic tracing:

```python
import torch
from torch.func import functionalize
from torch.fx.experimental.proxy_tensor import make_fx

y = torch.randn(1, 1)
def f(x):
    return torch.matmul(x, y)

make_fx(
    functionalize(f),
    tracing_mode='symbolic',
    _allow_non_fake_inputs=True,
)(torch.randn(1, 1, 1))
```

This fails with the following stack trace:
```
Traceback (most recent call last):
  File "/.../bug.py", line 10, in <module>
    make_fx(
  File "/.../.venv/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 756, in wrapped
    t = dispatch_trace(wrap_key(func, args, fx_tracer, pre_autograd), tracer=fx_tracer, concrete_args=tuple(phs))
  File "/.../.venv/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 462, in dispatch_trace
    graph = tracer.trace(root, concrete_args)
  File "/.../.venv/lib/python3.9/site-packages/torch/fx/_symbolic_trace.py", line 778, in trace
    (self.create_arg(fn(*args)),),
  File "/.../.venv/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 479, in wrapped
    out = f(*tensors)
  File "/.../.venv/lib/python3.9/site-packages/torch/_functorch/vmap.py", line 39, in fn
    return f(*args, **kwargs)
  File "/.../.venv/lib/python3.9/site-packages/torch/_functorch/eager_transforms.py", line 1600, in wrapped
    func_outputs = func(*func_args, **func_kwargs)
  File "/.../bug.py", line 7, in f
    return torch.matmul(x, y)
RuntimeError: Cannot call sizes() on tensor with symbolic sizes/strides
```

Without the call to `functionalize`, everything works fine. Passing a 2-D tensor for `x` also works fine (if `x` is 3-D, it needs to be `aten.view`-ed then `aten.matmul`-ed).

[Output from Python dispatcher](https://github.com/pytorch/pytorch/blob/af440c427bffddd7edc2db800a0c34ae8f1107d0/torch/_ops.py#L531) prior to failure:

```
aten.randn.default DispatchKey.BackendSelect DispatchKey.BackendSelect
aten.empty.memory_format DispatchKey.BackendSelect DispatchKey.BackendSelect
aten.normal_.default DispatchKey.CPU DispatchKey.CPU
aten.empty_strided.default DispatchKey.BackendSelect DispatchKey.BackendSelect
aten.set_.source_Storage_storage_offset DispatchKey.AutogradMeta DispatchKey.Autograd
aten.set_.source_Storage_storage_offset DispatchKey.ADInplaceOrView DispatchKey.ADInplaceOrView
aten.set_.source_Storage_storage_offset DispatchKey.Meta DispatchKey.Meta
aten.detach.default DispatchKey.PythonTLSSnapshot DispatchKey.PythonTLSSnapshot
aten.detach.default DispatchKey.AutogradCPU DispatchKey.Autograd
aten.detach.default DispatchKey.ADInplaceOrView DispatchKey.ADInplaceOrView
aten.detach.default DispatchKey.Meta DispatchKey.Meta
aten.alias.default DispatchKey.Meta DispatchKey.Meta
aten.view.default DispatchKey.Meta DispatchKey.Meta
prims.view_of.default DispatchKey.Meta DispatchKey.Meta
aten.as_strided.default DispatchKey.Meta DispatchKey.Meta
aten.matmul.default DispatchKey.FuncTorchDynamicLayerFrontMode DispatchKey.FuncTorchDynamicLayerFrontMode
aten.matmul.default DispatchKey.Functionalize DispatchKey.Functionalize
```

### Versions

```
Collecting environment information...
PyTorch version: 2.1.0.dev20230323+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.25.0
Libc version: glibc-2.31

Python version: 3.9.13 (main, Aug 25 2022, 23:26:10)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.4.0-144-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 10.1.243
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3090
Nvidia driver version: 530.30.02
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.8.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.8.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.8.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.8.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.8.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.8.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.8.1
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:                   46 bits physical, 57 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:                       GenuineIntel
CPU family:                      6
Model:                           106
Model name:                      Intel(R) Xeon(R) Silver 4314 CPU @ 2.40GHz
Stepping:                        6
Frequency boost:                 enabled
CPU MHz:                         1104.264
CPU max MHz:                     3400.0000
CPU min MHz:                     800.0000
BogoMIPS:                        4800.00
Virtualization:                  VT-x
L1d cache:                       768 KiB
L1i cache:                       512 KiB
L2 cache:                        20 MiB
L3 cache:                        24 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:   Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:          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, PBRSB-eIBRS SW sequence
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 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 invpcid_single 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 rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] pytorch-triton==2.1.0+e650d3708b
[pip3] torch==2.1.0.dev20230323+cu117
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.21.5           py39h6c91a56_3  
[conda] numpy-base                1.21.5           py39ha15fc14_3  
[conda] numpydoc                  1.4.0            py39h06a4308_0  
```