warp icon indicating copy to clipboard operation
warp copied to clipboard

[BUG] Updating `requires_grad` on an array in a struct can lead to an access violation

Open mmacklin opened this issue 7 months ago • 0 comments

Bug Description

Doing the following:

    model.shape_geo.scale.requires_grad = False
    model.shape_geo.thickness.requires_grad = False

Causes the gradient arrays for scale and thickness to be garbage collected, however the model.shape_geo struct instead still has a reference to the underlying pointer (in its ctypes struct definition).

When used in the backward pass kernels will attempt to write to the now deallocated memory.

This can be reproduced by running test_sphere_pushing_on_rails_d6 in debug mode on CPU.

System Information

No response

mmacklin avatar May 12 '25 03:05 mmacklin