Replies: 3 comments 4 replies
-
Almost all the missed cache has form like below. And after several iterations, each OptiX kernel is only used for a single time, e.g. id of
|
Beta Was this translation helpful? Give feedback.
-
I manage to make two different reproducible cases that shows the problem. Changing the sensor creates 5 caches HIT but Changing the film causes cache miss. I think changes I REMOVE the directory ~/.drjit before running the script below import mitsuba as mi
import drjit as dr
mi.set_variant('cuda_ad_rgb')
def test_sensor():
scene = mi.load_dict(mi.cornell_box())
img = mi.render(scene) # Launches 2 kernels
dr.eval()
dr.set_log_level(dr.LogLevel.Warn) # Suppress kernel launches
params = mi.traverse(scene)
for i in range(5):
dr.set_log_level(dr.LogLevel.Warn) # Suppress kernel launches
params['sensor.x_fov'] = params['sensor.x_fov'] + 0.5
params['sensor.to_world'] = params['sensor.to_world'] @ mi.Transform4f.translate([0.1, 0, 0])
dr.make_opaque(params['sensor.to_world'])
dr.make_opaque(params['sensor.x_fov'])
params.update()
dr.eval() # In case there are scheduled variables
dr.set_log_level(dr.LogLevel.Info) # Log kernel launches
img = mi.render(scene)
mi.Bitmap(img).write(f'sensor_{i}.exr')
def test_film():
scene = mi.load_dict(mi.cornell_box())
img = mi.render(scene) # Launches 2 kernels
dr.eval()
dr.set_log_level(dr.LogLevel.Warn) # Suppress kernel launches
params = mi.traverse(scene)
for i in range(5):
dr.set_log_level(dr.LogLevel.Warn) # Suppress kernel launches
params['sensor.film.crop_offset'] = mi.ScalarVector2u(i * 5, i * 5)
params['sensor.film.crop_size'] = mi.ScalarVector2u(128, 128)
dr.make_opaque(params['sensor.film.crop_offset'])
dr.make_opaque(params['sensor.film.crop_size'])
params.update()
dr.eval() # In case there are scheduled variables
dr.set_log_level(dr.LogLevel.Info) # Log kernel launches
img = mi.render(scene)
mi.Bitmap(img).write(f'film_{i}.exr')
print('Launch sensor kernels ...')
test_sensor()
print('Launch film kernels ...')
test_film() I also attached the log below.
|
Beta Was this translation helpful? Give feedback.
-
Hi @saedrna To answer your original questions, and as you've observed in your experiments, kernels are/should be reused in the following cases Why not films? There's actual a PR and an issue about this already: #920 and #908. The PR isn't perfect and we never got around to totally fixing it. |
Beta Was this translation helpful? Give feedback.
-
Hi there!
I am working on retrieving the reflectance (albedo) of a vase from real photos using inverse rendering. Since part of the image is transparent, I apply dataset transformations to subset portions of the image, employing random scaling and cropping techniques. I use
crop_offset_x
andcrop_width
for the film as specified below. Because the image is randomly scaled, the film dimensions ("width": film_width
and"height": film_height
) will vary with almost every iteration.I discovered that turning off the mega kernel feature of
drjit
significantly improves the speed of the entire inverse rendering and gradient optimization process, nearly doubling the performance (but huge amount of more VRAM, about 3x). By examining the logs, I noticed that almost everydrjit.eval
call realted to Optix results in a kernel cache miss. I suspect that varying film sizes might eventually lead to different mega kernels, which could be causing the cache miss issue.Is this the issue? Or in which case, will the cache still be REUSED?
[ ]
Change thewidth
andheight
of the film[ ]
Change thecrop_offset
andcrop_width
[ ]
Change thefov
of sensor[ ]
Change theto_world
Beta Was this translation helpful? Give feedback.
All reactions