Skip to content

Commit

Permalink
Do not explicitly call garbage collector in RenderOp
Browse files Browse the repository at this point in the history
  • Loading branch information
dvicini committed Oct 23, 2024
1 parent 22341c3 commit 6df9b7a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
14 changes: 0 additions & 14 deletions src/python/python/ad/integrators/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def render(self: mi.SamplingIntegrator,

# Explicitly delete any remaining unused variables
del sampler, ray, weight, pos, L, valid
gc.collect()

# Perform the weight division and return an image tensor
film.put_block(block)
Expand Down Expand Up @@ -212,7 +211,6 @@ def render_backward(self: mi.SamplingIntegrator,
film.put_block(block)

del valid
gc.collect()

# This step launches a kernel
dr.schedule(block.tensor())
Expand All @@ -226,7 +224,6 @@ def render_backward(self: mi.SamplingIntegrator,

# We don't need any of the outputs here
del ray, weight, pos, block, sampler
gc.collect()

# Run kernel representing side effects of the above
dr.eval()
Expand Down Expand Up @@ -619,11 +616,6 @@ def render_forward(self: mi.SamplingIntegrator,
del sampler, ray, weight, pos, L, valid, aovs, δL, δaovs, \
valid_2, params, state_out, state_out_2, block

# Probably a little overkill, but why not.. If there are any
# DrJit arrays to be collected by Python's cyclic GC, then
# freeing them may enable loop simplifications in dr.eval().
gc.collect()

result_grad = film.develop()

return result_grad
Expand Down Expand Up @@ -725,11 +717,6 @@ def splatting_and_backward_gradient_image(value: mi.Spectrum,

film.put_block(block)

# Probably a little overkill, but why not.. If there are any
# DrJit arrays to be collected by Python's cyclic GC, then
# freeing them may enable loop simplifications in dr.eval().
gc.collect()

image = film.develop()

dr.set_grad(image, grad_in)
Expand Down Expand Up @@ -790,7 +777,6 @@ def splatting_and_backward_gradient_image(value: mi.Spectrum,
del L_2, valid_2, aovs_2, state_out, state_out_2, \
δL, δaovs, ray, weight, pos, sampler

gc.collect()

# Run kernel representing side effects of the above
dr.eval()
Expand Down
6 changes: 0 additions & 6 deletions src/python/python/ad/projective.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,6 @@ def init_indirect_silhouette(self,
elif parent.guiding == 'octree':
self.init_indirect_silhouette_octree(scene, sensor, seed)

# After cleaning up, only necessary guiding distribution storage should
# exist in the device memory. This usually occupies dozens of MBs for
# octree, and ~0.75GB for grid based guiding with default settings.
gc.collect()
gc.collect()
# TODO this should happen automatically

@dr.syntax
def init_indirect_silhouette_grid_unif(self, scene, sensor, seed):
Expand Down

0 comments on commit 6df9b7a

Please sign in to comment.