Repository: pytorch
Issue: [cond] Cond lifts duplicate symint inputs
Labels: triaged,oncall: pt2,module: higher order operators,module: pt2-dispatcher

### 🐛 Describe the bug

```python
    def test_cond_symint_input(self):
        class M(torch.nn.Module):
            def forward(self, x, y, z):
                a = y.shape[0]
                b = z.shape[0]
                def true_fn(x):
                    return x + a

                def false_fn(x):
                    return x + b

                return torch.cond(x.shape[0] > 5, true_fn, false_fn, (x,))
        
        inp = (torch.ones(3, 3), torch.ones(3, 3), torch.ones(3, 3))
        ep = torch.export.export(M(), inp, dynamic_shapes={"x": {0: Dim("d")}, "y": {0: Dim("d")}, "z": {0: Dim("d")}})
```

Errors with:
```
======================================================================
ERROR: test_cond_symint_input (__main__.TestMoo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/users/angelayi/pytorch/torch/testing/_internal/common_utils.py", line 2983, in wrapper
    method(*args, **kwargs)
  File "/data/users/angelayi/pytorch/moo.py", line 1373, in test_cond_symint_input
    path = torch._inductor.aoti_compile_and_package(ep, inp)
  File "/data/users/angelayi/pytorch/torch/export/__init__.py", line 366, in export
    return _export(
  File "/data/users/angelayi/pytorch/torch/export/_trace.py", line 1021, in wrapper
    raise e
  File "/data/users/angelayi/pytorch/torch/export/_trace.py", line 994, in wrapper
    ep = fn(*args, **kwargs)
  File "/data/users/angelayi/pytorch/torch/export/exported_program.py", line 116, in wrapper
    return fn(*args, **kwargs)
  File "/data/users/angelayi/pytorch/torch/export/_trace.py", line 1940, in _export
    export_artifact = export_func(  # type: ignore[operator]
  File "/data/users/angelayi/pytorch/torch/export/_trace.py", line 1234, in _strict_export
    return _strict_export_lower_to_aten_ir(
  File "/data/users/angelayi/pytorch/torch/export/_trace.py", line 1343, in _strict_export_lower_to_aten_ir
    aten_export_artifact = lower_to_aten_callback(
  File "/data/users/angelayi/pytorch/torch/export/_trace.py", line 756, in _export_to_aten_ir
    placeholder_naming_pass(
  File "/data/users/angelayi/pytorch/torch/_export/utils.py", line 812, in placeholder_naming_pass
    _name_hoo_subgraph_placeholders(gm)
  File "/data/users/angelayi/pytorch/torch/_export/utils.py", line 704, in _name_hoo_subgraph_placeholders
    subgraph.recompile()
  File "/data/users/angelayi/pytorch/torch/fx/graph_module.py", line 814, in recompile
    cls.forward = _forward_from_src(self._code, python_code.globals, co_fields)
  File "/data/users/angelayi/pytorch/torch/fx/graph_module.py", line 91, in _forward_from_src
    return _method_from_src(
  File "/data/users/angelayi/pytorch/torch/fx/graph_module.py", line 101, in _method_from_src
    _exec_with_source(src, globals_copy, co_fields)
  File "/data/users/angelayi/pytorch/torch/fx/graph_module.py", line 87, in _exec_with_source
    exec(compile(src, key, "exec"), globals)
  File "<eval_with_key>.26 from /data/users/angelayi/pytorch/torch/fx/experimental/proxy_tensor.py:1177 in wrapped", line 4
SyntaxError: duplicate argument 'sym_size_int_3' in function definition
```

Graph from AOTAutograd:
```
class <lambda>(torch.nn.Module):
    def forward(self, arg0_1: "f32[s0, 3]", arg1_1: "f32[s0, 3]", arg2_1: "f32[s0, 3]"):
         # 
        sym_size_int_3: "Sym(s0)" = torch.ops.aten.sym_size.int(arg0_1, 0)
        
         # File: /data/users/angelayi/pytorch/moo.py:1368 in forward, code: return torch.cond(x.shape[0] > 5, true_fn, false_fn, (x,))
        gt: "Sym(s0 > 5)" = sym_size_int_3 > 5
        
         # File: /data/users/angelayi/pytorch/torch/_higher_order_ops/cond.py:133 in cond, code: return cond_op(pred, true_fn, false_fn, operands)
        true_graph_0 = self.true_graph_0
        false_graph_0 = self.false_graph_0
        cond = torch.ops.higher_order.cond(gt, true_graph_0, false_graph_0, [arg0_1, sym_size_int_3, sym_size_int_3]);  gt = true_graph_0 = false_graph_0 = arg0_1 = sym_size_int_3 = None
        getitem: "f32[s0, 3]" = cond[0];  cond = None
        return (getitem,)
        
    class true_graph_0(torch.nn.Module):
        def forward(self, arg0_1: "f32[s0, 3]", arg1_1: "Sym(s0)", arg2_1: "Sym(s0)"):
             # File: /data/users/angelayi/pytorch/moo.py:1363 in true_fn, code: return x + a
            add_3: "f32[s0, 3]" = torch.ops.aten.add.Tensor(arg0_1, arg1_1);  arg0_1 = arg1_1 = None
            return (add_3,)
            
    class false_graph_0(torch.nn.Module):
        def forward(self, arg0_1: "f32[s0, 3]", arg1_1: "Sym(s0)", arg2_1: "Sym(s0)"):
             # File: /data/users/angelayi/pytorch/moo.py:1366 in false_fn, code: return x + b
            add_3: "f32[s0, 3]" = torch.ops.aten.add.Tensor(arg0_1, arg2_1);  arg0_1 = arg2_1 = None
            return (add_3,)
```

Note: `sym_size_int_3` is lifted as input to cond twice.

### Versions

main

cc @ezyang @chauhang @penguinwu @zou3519 @ydwu4 @bdhirsh @yf225