Open garrido-pablo opened 3 years ago
Hi @garrido-pablo ,
Could this be related: #276 ?
Hi @Speierers. Thanks for answering back. I'll take a closer look at the issue based on that post. It seems quite related.
It's interesting that the problem only happens when updating vertex_positions_buf - updating vertex_normals_buf and vertex_texcoords_buf won't cause any crash. Is there any reason for this?
Adding m_vertex_positions_buf.managed() in Mesh::parameters_changed() fixed the issue. I noticed, however, that gradients of vertex positions are not backpropgated.
I noticed, however, that gradients of vertex positions are not backpropgated.
Could you give us a little more information maybe?
I fixed the issue temporarily by doing a few modifications in function render_torch() (see autodiff.py file attached):
I'd appreciated it if you could tell if my fix makes sense or if it's the right thing to do. I tested the changes mentioned above and seemed to work just fine.
Please add one of the following label to your issue's title, and delete this section:
Summary
"Access violation reading location" when running render_torch() and passing vertex_positions_buf as **kargs. Program crashes when function Mesh::recompute_bbox() is called from Mesh::parameters_changed(). Specifically, vertex_position(0) is not valid when trying to expand the bounding box.
System configuration
scalar_rgb
gpu_autodiff_rgb
Description
Access violation reading location 0x0000003455D60000. The error only happens when calling render_torch() with vertex_positions_buf in the scene parameters list and when including torch parameters as **kwargs.
Steps to reproduce
Run differentiable_geometry_test_pytorch.py script in minimal_example.zip (see attachment) to reproduce bug.
Please note that the bug only happened when vertex_positions_buf is updated in render_torch(). This creates an access violation (possibly vertex_positions_buf has a wrong direction or null pointer). The callstack can be seen in AccessViolation.PNG The problem appears when the bounding box is expanded in function Mesh::recompute_bounding_box(), which is called from Mesh::parameters_changed().
Note that the script runs smoothly if line 34 is commented out and line 33 is uncommented. In this case, vertex_positions_buf is not part of the parameter list. This means that the reference to vertex_positions_buf might not be properly updated.
minimal_differentiable_geometry_example.zip