Repository: pytorch
Issue: `make_fx` failing for `_scaled_dot_product_flash_attention` decomposition
Labels: triaged,module: fx,module: decompositions

### 🐛 Describe the bug

While tracing the `F.scaled_dot_product_attention` using make_fx and passing it's decomposition in the decomp list, the following error pops out:
```
Traceback (most recent call last):
  File "/home/vivek/work/shark-vivekkhandelwal1/falcon_40b_gptq_repro.py", line 24, in <module>
    fx_g = make_fx(
           ^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 858, in wrapped
    t = dispatch_trace(wrap_key(func, args, fx_tracer, pre_dispatch), tracer=fx_tracer, concrete_args=tuple(phs))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/_compile.py", line 24, in inner
    return torch._dynamo.disable(fn, recursive)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/_dynamo/eval_frame.py", line 401, in _fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/_dynamo/external_utils.py", line 17, in inner
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 478, in dispatch_trace
    graph = tracer.trace(root, concrete_args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/_symbolic_trace.py", line 817, in trace
    (self.create_arg(fn(*args)),),
                     ^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 514, in wrapped
    out = f(*tensors)
          ^^^^^^^^^^^
  File "<string>", line 1, in <lambda>
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/_symbolic_trace.py", line 795, in module_call_wrapper
    return self.call_module(mod, forward, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 435, in call_module
    return forward(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/_symbolic_trace.py", line 788, in forward
    return _orig_module_call(mod, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1519, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1528, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/falcon_40b_gptq_repro.py", line 12, in forward
    attn_output = F.scaled_dot_product_attention(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/utils/_stats.py", line 20, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 591, in __torch_dispatch__
    return self.inner_torch_dispatch(func, types, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 626, in inner_torch_dispatch
    return proxy_call(self, func, self.pre_dispatch, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 272, in proxy_call
    r = maybe_handle_decomp(proxy_mode, func, args, kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/fx/experimental/proxy_tensor.py", line 896, in maybe_handle_decomp
    return CURRENT_DECOMPOSITION_TABLE[op](*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/_decomp/decompositions.py", line 4109, in scaled_dot_product_flash_attention
    torch._check(dropout_p == 0.0, lambda: "dropout probability must be zero")
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/__init__.py", line 1028, in _check
    _check_with(RuntimeError, cond, message)
  File "/home/vivek/work/shark-vivekkhandelwal1/shark.venv/lib/python3.11/site-packages/torch/__init__.py", line 1011, in _check_with
    raise error_type(message_evaluated)
RuntimeError: dropout probability must be zero
```

To reproduce the issue, run the following code:
```
import torch
from torch.nn import functional as F
from torch.fx.experimental.proxy_tensor import make_fx
from torch._decomp import get_decompositions


class ScaledDotProductAttention(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, query_layer, key_layer, value_layer):
        attn_output = F.scaled_dot_product_attention(
            query_layer, key_layer, value_layer, None, 0.0, is_causal=True
        )
        return attn_output


query_layer = torch.randn(1, 128, 100, 64)
key_layer = torch.randn(1, 128, 100, 64)
value_layer = torch.randn(1, 128, 100, 64)

attention = ScaledDotProductAttention()

fx_g = make_fx(
    attention,
    decomposition_table=get_decompositions(
        [
            torch.ops.aten._scaled_dot_product_flash_attention.default,
        ]
    ),
)(query_layer, key_layer, value_layer)
print(fx_g.graph)
```

### Versions

Collecting environment information...
PyTorch version: 2.2.0.dev20231105+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Gentoo Linux (x86_64)
GCC version: (Gentoo 12.3.1_p20230526 p2) 12.3.1 20230526
Clang version: 16.0.6
CMake version: version 3.27.2
Libc version: glibc-2.37

Python version: 3.11.4 (main, Aug 15 2023, 14:57:46) [GCC 12.3.1 20230526] (64-bit runtime)
Python platform: Linux-6.4.10-gentoo-dist-x86_64-AMD_Ryzen_Threadripper_PRO_5975WX_32-Cores-with-glibc2.37
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
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:                      48 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             64
On-line CPU(s) list:                0-63
Vendor ID:                          AuthenticAMD
Model name:                         AMD Ryzen Threadripper PRO 5975WX 32-Cores
CPU family:                         25
Model:                              8
Thread(s) per core:                 2
Core(s) per socket:                 32
Socket(s):                          1
Stepping:                           2
Frequency boost:                    enabled
CPU(s) scaling MHz:                 32%
CPU max MHz:                        7006.6401
CPU min MHz:                        1800.0000
BogoMIPS:                           7189.48
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 aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin brs arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
Virtualization:                     AMD-V
L1d cache:                          1 MiB (32 instances)
L1i cache:                          1 MiB (32 instances)
L2 cache:                           16 MiB (32 instances)
L3 cache:                           128 MiB (4 instances)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-63
Vulnerability Gather data sampling: Not affected
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:             Not affected
Vulnerability Spec rstack overflow: Mitigation; safe RET, no microcode
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.0b1
[pip3] pytorch-lightning==2.1.0
[pip3] torch==2.2.0.dev20231105+cpu
[pip3] torch-mlir==20231017.994
[pip3] torchmetrics==1.1.0
[pip3] torchvision==0.17.0.dev20231101+cpu
[conda] Could not collect

cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv