Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-7476

Compile throws a cuda error when compiling a random function with one element

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • PyTorch
    • PyTorch Sprint 20

          1. 🐛 Describe the bug

      ```python
      import torch
      torch.set_default_device('cuda')
      @torch.compile
      def random_func(x: torch.Tensor, seed: int) -> torch.Tensor:
      torch.manual_seed(seed)

      rnd = torch.randint(0, 2**32, size=x.shape, dtype=torch.uint32)
      return x + rnd

      random_func(torch.randn(()), 0)
      ```

          1. Error logs

      ```
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_dynamo/eval_frame.py", line 929, in _fn
      return fn(*args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_functorch/aot_autograd.py", line 1241, in forward
      return compiled_fn(full_args)
      ^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 384, in runtime_wrapper
      all_outs = call_func_at_runtime_with_args(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_functorch/_aot_autograd/utils.py", line 126, in call_func_at_runtime_with_args
      out = normalize_as_list(f(args))
      ^^^^^^^
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 556, in wrapper
      return compiled_fn(runtime_args)
      ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/inductor/output_code.py", line 584, in __call_
      return self.current_callable(inputs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_inductor/utils.py", line 2716, in run
      out = model(new_inputs)
      ^^^^^^^^^^^^^^^^^
      File "/tmp/torchinductor_horace/lw/clwlxnkwrtchdr2hdokhjj2io3tm2vrqtmmy7usmxkqmrchztr6h.py", line 97, in call
      triton_poi_fused_add_randint_0.run(arg0_1, buf0, buf1, 0, 1, stream=stream0)
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_inductor/runtime/triton_heuristics.py", line 1182, in run
      return launcher(
      ^^^^^^^^^
      File "<string>", line 5, in launcher
      File "/tmp/horace/uv/install/6fbae45f965d50cba20076240d49c0af606f091cbea5976d1cc16bb095b35930/lib/python3.12/site-packages/torch/_inductor/runtime/static_cuda_launcher.py", line 227, in run
      _StaticCudaLauncher._launch_kernel(
      RuntimeError: CUDA driver error: invalid argument
      ```

          1. Versions

      pytorch 2.8.0

      cc @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo

              rh-ee-trichmon Turner Richmond
              rh-ee-trichmon Turner Richmond
              PyTorch Compile
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: