Skip to content

GouraudShader failing with AmbientLights #1043

Closed
@samedii

Description

@samedii

🐛 Bugs / Unexpected behaviors

SoftGouraudShader and HardGouraudShader shader fail when SoftPhongShader and HardPhongShader work. I am using a TexturesVertex and I've tried with a few different meshes. I am just doing simple rendering.

This seems to be relevant:
pytorch/pytorch#55027

The detectron error is fixed on master/nightlies with #55292. 3rd party projects depending on torch are advised not to use thrust, and wrap cub in its own namespace to avoid these errors. Longer term, pytorch should stop using thrust and rely on namespaced cub only. #52663 is to track extension errors.

Do you know if there any way for me to avoid this issue by changing versions of packages etc?

Previous messages:

packages/pytorch3d/transforms/transform3d.py:780: UserWarning: R is not a valid rotation matrix
/pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:115: operator(): block: [112,0,0], thread: [29,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
...
/pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:115: operator(): block: [219,0,0], thread: [63,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.

Stacktrace:

  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shader.py", line 283, in forward
    pixel_colors = gouraud_shading(
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shading.py", line 135, in gouraud_shading
    cameras = cameras.clone().gather_props(vert_to_mesh_idx)
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/cameras.py", line 346, in clone
    other = cam_type(device=self.device)
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/cameras.py", line 531, in __init__
    super().__init__(
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/utils.py", line 133, in __init__
    broadcasted_values = convert_to_tensors_and_broadcast(
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/utils.py", line 336, in convert_to_tensors_and_broadcast
    args_1d = [format_tensor(c, dtype, device) for c in args]
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/utils.py", line 336, in <listcomp>
    args_1d = [format_tensor(c, dtype, device) for c in args]
  File "/home/aiwizo/Documents/generate-texture/.venv/lib/python3.8/site-packages/pytorch3d/renderer/utils.py", line 298, in format_tensor
    input = torch.tensor(input, dtype=dtype, device=device_)
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

Instructions To Reproduce the Issue:

Using poetry to install:

python = "3.8.8"
torch = "1.9.0"
torchvision = "0.10.0"
torchaudio = "0.9.0"
fvcore = "^0.1.5"
iopath = "^0.1.9"
ninja = "^1.10.2"
matplotlib = "^3.5.1"
tqdm = "^4.62.3"
Pillow = "^9.0.0"
kornia = "^0.6.2"
ftfy = "^6.0.3"
regex = "^2021.11.10"
requests = "^2.27.1"

CUDA 11.1

poetry run python -m pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

NVIDIA CUB requirement for CUDA 11.1

curl -LO https://github.com/NVIDIA/cub/archive/1.9.10-1.tar.gz
tar -xvzf 1.9.10-1.tar.gz
export CUB_HOME=$PWD/cub-1.9.10-1
pip install git+https://github.com/facebookresearch/[email protected]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions