Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when passing in 0 size empty in PyTorch Kernel #3696

Closed
half-potato opened this issue Mar 6, 2024 · 1 comment · Fixed by #4021 or shader-slang/slang-torch#3
Closed

Error when passing in 0 size empty in PyTorch Kernel #3696

half-potato opened this issue Mar 6, 2024 · 1 comment · Fixed by #4021 or shader-slang/slang-torch#3
Assignees
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should priority:high required for next milestone

Comments

@half-potato
Copy link

When passing in torch.empty((0), device="cuda"), I get the following error:

Traceback (most recent call last):
  File "/home/amai/gaussian-splatting/train.py", line 510, in <module>
    training(
  File "/home/amai/gaussian-splatting/train.py", line 160, in training
    loss.backward()
  File "/home/amai/micromamba/envs/gaussian_splatting/lib/python3.11/site-packages/torch/_tensor.py", line 492, in backward
    torch.autograd.backward(
  File "/home/amai/micromamba/envs/gaussian_splatting/lib/python3.11/site-packages/torch/autograd/__init__.py", line 251, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  File "/home/amai/micromamba/envs/gaussian_splatting/lib/python3.11/site-packages/torch/autograd/function.py", line 288, in apply
    return user_fn(self, *args)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/amai/gaussian-splatting/splinetracer/const_splinetracer.py", line 188, in backward
    ).launchRaw(
      ^^^^^^^^^^
  File "/home/amai/micromamba/envs/gaussian_splatting/lib/python3.11/site-packages/slangpy/util/wrapper.py", line 31, in launchRaw
    return self.dispatch_fn(blockSize, gridSize)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/amai/micromamba/envs/gaussian_splatting/lib/python3.11/site-packages/slangpy/util/wrapper.py", line 97, in <lambda>
    lambda blockSize, gridSize: self.fn_handle(*((blockSize, gridSize) + arglist)),
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: wcts: data pointer is invalid.
@swoods-nv swoods-nv added the goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang label Mar 7, 2024
@saipraveenb25 saipraveenb25 self-assigned this Mar 12, 2024
@saipraveenb25
Copy link
Collaborator

Looks like torch doesn't initialize its data pointer if array is empty. The fix is to check the array size before touching the data pointer on the Slang wrapper side. Will issue a fix.

@saipraveenb25 saipraveenb25 added kind:bug something doesn't work like it should priority:high required for next milestone labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should priority:high required for next milestone
Projects
None yet
3 participants