Replies: 2 comments 8 replies
-
While I'm not sure what the exact cause is, it may be caused by the fact that attempting to log the loop variable leads to an evaluation of some Dr.JIT variable. What variant is the problem occurring with; |
Beta Was this translation helpful? Give feedback.
-
Very cool and impressive! As for the bug, the first thing that comes to mind is that you're not initializing some JIT variable. For example, anything like this:
Should absolutely always be written as:
(or some other valid constructor). The magic and harmless log is just luckily shifting whatever your uninitialized memory is pointing at to something "correct". Debug mode tends to aggressively zero-initialize C++ members, which might help too. |
Beta Was this translation helpful? Give feedback.
-
I implemented SPPM integrator in mitsuba3 based on pbrt-v4 cpu integrators. The implementation is available here.
I tested the code on cornell box scene and my custom own scene. Everything seems to be fine and as aspected if the image height and width is a power of 2. I show the resulting image below for cornell box scene.
However, I observe weird blocky artifacts if I change the height/width to not be a power of two, eg.
500x512
. Following image is obtained.I am able to get rid of this bug by uncommenting a very innocuous line. Everything seems to work after this.
Also, this behavior is not observed if I compile the code in
debug
mode. I have tried various debugging tricks. In all the cases, the code seems to work if I have aLog
statement and a reference to any one/all of the loop counters. If I replace the print statement withcout
or remove reference to loop counters, the bad behavior reappears.Update 1
I tested compile optimization flags for my example with magical Log line commented out
-O2
and-O3
give same bad result-O1
correct image is producedAny help to debug this weird bug is much appreciated. Please let me know if you have any suggestions.
Update 2
The bug was in hash function calculation. I copied it from here without much due diligence.
After updating the hash function to following
I am able to obtain following image with cbox with 16 spp. This one seems to have blocky artifact as well. But they seem to go away.
I am wondering if there is a preferred hash function for
sppm
algorithms.Beta Was this translation helpful? Give feedback.
All reactions