Page MenuHome

Cycles: Branched path tracking for split kernel
ClosedPublic

Authored by Mai Lavelle (maiself) on Apr 8 2017, 4:00 PM.

Details

Summary

This implements branched path tracking for the split kernel.

Its kind of hard to keep all the different integration loops in sync, so this needs lots of testing to make sure everything is working correctly. We should probably start trying to deduplicate the integration loops more now.

Nonbranched BMW is ~2% slower, while classroom is ~2% faster, other scenes need testing still.

Diff Detail

Event Timeline

I got this error with Barcelona "1- time: midday" scene:


Using latest 17.4.1 driver with RX480 on Windows 7 x64

Some areas seems a re-implementation of megakernel logic (i.e. kernel_split_branched_path_subsurface_indirect_light_init). This is worrying, any chance to get more code shared across two implementations?

intern/cycles/kernel/kernel_types.h
1324

A bit weird to have enum flags ifdef-ed. Looks kind of nasty and not sure how easy it is to maintain.

Any specific reason to do this?

intern/cycles/kernel/split/kernel_branched.h
92

Guess this can be moved to some utility function and re-used with mega-kernel BPT.

Hristo Gueorguiev (nirved) requested changes to this revision.Apr 14 2017, 1:29 AM
  • Kernels fail to compile when using PT with volume, and when using BPT without subsurface.
  • The body of kernel_lamp_emission should be skipped during regular BPT iteration.
  • In kernel_holdout_... houldout and kernel_write_passes should be skipped during indirect BPT iteration.
  • In same kernel shader_bsdf_blur should be skipped during regular BPT iteration.
This revision now requires changes to proceed.Apr 14 2017, 1:29 AM

shader_bsdf_blur is ok, my mistake.

intern/cycles/kernel/split/kernel_do_volume.h
19

#if defined(__BRANCHED_PATH__) && defined(__VOLUME__)

100–103

#ifdef __BRANCHED_PATH__

intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
143

There's no holdout during indirect iteration.

167–168

Shouldn't happen during indirect iteration.

218

__BRANCHED_PATH__

intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
56

#ifdef __BRANCHED_PATH__

intern/cycles/kernel/split/kernel_subsurface_scatter.h
19

Should be
#if defined(__BRANCHED_PATH__) && defined(__SUBSURFACE__)

Mai Lavelle (maiself) edited edge metadata.
  • Fixed ifdefs
  • Fixed usage of wrong PathRadiance in do_volume and subsurface_scatter after the change in ray_index for loop iteration.
  • Fixed logic for path termination
  • Rebased on master
Mai Lavelle (maiself) marked 3 inline comments as done.

Reuploading with context, couldnt see where inline comments where attached to.

Mai Lavelle (maiself) marked 3 inline comments as done.Apr 25 2017, 12:12 PM
Mai Lavelle (maiself) added inline comments.
intern/cycles/kernel/kernel_types.h
1324

While working on this it helped catch flags being used in places they shouldnt be, but can be removed for final commit if you'd like.

intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
143

Pretty sure the check with PATH_RAY_CAMERA handles this.

Mai Lavelle (maiself) updated this revision to Diff 8742.EditedApr 28 2017, 10:11 PM
  • Fixed path termination again
  • Removed ifdef around ray flags
  • Rebased on master

Pretty sure everything is ok now.

@Hristo Gueorguiev (nirved) did discover another compiler bug, but thats not a problem with this code and we still need to find a workaround.

This revision is now accepted and ready to land.May 2 2017, 12:12 PM
This revision was automatically updated to reflect the committed changes.