Repository: pytorch/torchdynamo

Issue:
pytorch core test failure: TypeError: inner() got an unexpected keyword argument 'names'
Repro:
```
PYTORCH_TEST_WITH_INDUCTOR=1   pytest test/test_indexing.py -k test_index_scalar_with_bool_mask_cuda
```

Error:
```
Traceback (most recent call last):
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/graph.py", line 253, in call_function
    return lowerings[target](*args, **kwargs)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/lowering.py", line 184, in wrapped
    return decomp_fn(*args, **kwargs)
TypeError: inner() got an unexpected keyword argument 'names'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/fsx/users/binbao/pytorch/test/test_indexing.py", line 1044, in test_index_scalar_with_bool_mask
    def test_index_scalar_with_bool_mask(self, device):
  File "/fsx/users/binbao/torchdynamo-tip/torchdynamo/eval_frame.py", line 167, in _fn
    return fn(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 904, in forward
    return compiled_f(
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 890, in new_func
    compiled_fn = create_aot_dispatcher_function(
  File "/fsx/users/binbao/torchdynamo-tip/torchdynamo/utils.py", line 76, in time_wrapper
    r = func(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 468, in create_aot_dispatcher_function
    return aot_dispatch_base(flat_fn, fake_flat_tensor_args, aot_config)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 278, in aot_dispatch_base
    compiled_fw = aot_config.fw_compiler(fw_module, flat_args)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 237, in f
    out_f = compiler(fx_g, inps)
  File "/fsx/users/binbao/torchdynamo-tip/torchdynamo/utils.py", line 76, in time_wrapper
    r = func(*args, **kwargs)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/compile_fx.py", line 246, in fw_compiler
    return compile_fx_inner(
  File "/fsx/users/binbao/torchdynamo-tip/torchdynamo/debug_utils.py", line 332, in debug_wrapper
    compiled_fn = compiler(gm, example_inputs, **kwargs)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/debug.py", line 182, in inner
    return fn(*args, **kwargs)
  File "/fsx/users/binbao/conda/envs/release/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/compile_fx.py", line 83, in compile_fx_inner
    wrap(graph.run)(*example_inputs)
  File "/fsx/users/binbao/torchdynamo-tip/torchdynamo/utils.py", line 76, in time_wrapper
    r = func(*args, **kwargs)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/graph.py", line 143, in run
    return super().run(*args)
  File "/fsx/users/binbao/pytorch/torch/fx/interpreter.py", line 129, in run
    self.env[node] = self.run_node(node)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/graph.py", line 303, in run_node
    result = super().run_node(n)
  File "/fsx/users/binbao/pytorch/torch/fx/interpreter.py", line 162, in run_node
    return getattr(self, n.op)(n.target, args, kwargs)
  File "/fsx/users/binbao/torchdynamo-tip/torchinductor/graph.py", line 255, in call_function
    raise LoweringException(e, target, args, kwargs) from e
torchinductor.exc.LoweringException: TypeError: inner() got an unexpected keyword argument 'names'
  target: aten.zeros.names
  args[0]: [1]
  kwargs: {'names': None, 'dtype': torch.int64, 'layout': torch.strided, 'device': device(type='cuda', index=0)}
```


Discussion:

Resolving patch:
diff --git a/torchinductor/lowering.py b/torchinductor/lowering.py
--- a/torchinductor/lowering.py
+++ b/torchinductor/lowering.py
@@ -1321,8 +1321,15 @@ def full_like(x, fill_value, **kwargs):
 def tensor_constructor(fill_value):
     # torch.zeros, torch.ones, etc
     def inner(
-        *size, dtype=None, device=None, layout=0, pin_memory=False, memory_format=None
+        *size,
+        names=None,
+        dtype=None,
+        device=None,
+        layout=0,
+        pin_memory=False,
+        memory_format=None,
     ):
+        assert names is None
         assert not pin_memory
         assert layout in (0, torch.strided)
         assert memory_format in (None, torch.contiguous_format)


Test patch:
diff --git a/test/test_torchinductor.py b/test/test_torchinductor.py
--- a/test/test_torchinductor.py
+++ b/test/test_torchinductor.py
@@ -1916,6 +1916,7 @@ def fn(a):
                     dtype=torch.float32,
                     device=a.device,
                 ),
+                torch.zeros(2, 3, names=None),
                 a + torch.ones(8, device=a.device),
                 torch.full((2, 3), 3.1416, device=a.device),
             )