Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exhaustive light sampler + area light + GPU render = fatal error #403

Open
pbrt4bounty opened this issue Nov 22, 2023 · 1 comment
Open

Comments

@pbrt4bounty
Copy link
Contributor

I obtain a FATAL CUDA error when I use 'Exhaustive' LightSampler with a rectangle area light and render the scene on the GPU. This don't happen with other light types..
Latest binaries from the master branch of the repository.

pbrt version 4 (built Nov 22 2023 at 19:33:35)
Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the Apache 2.0 License.
See the file LICENSE.txt for the conditions of the license.
[ tid 19708 @     1.324s E:\REPOS\pbrt4blender\src\pbrt\wavefront\integrator.cpp:353 ] Starting to submit work for sample 16
[ tid 19708 @     1.334s E:\REPOS\pbrt4blender\src\pbrt\gpu\util.cpp:151 ] FATAL CUDA error: an illegal memory access was encountered
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00014C2000008F50 - `Q�
(unknown                                 )      0x00007FFBC0E32560 - BaseThreadInitThunk
(unknown                                 )      0x00007FFBC1E6AA50 - RtlUserThreadStart
Wavefront rendering failed at sample 16. Debug with "--debugstart 16"

Can ayone confirm this issue, please?
This are the scene that cause this error:
exhaustive_error.zip

@pbrt4bounty
Copy link
Contributor Author

pbrt4bounty commented Nov 23, 2023

Maybe the problem is here, in the Sample method: https://github.com/mmp/pbrt-v4/blob/master/src/pbrt/lightsamplers.cpp#L268

Float pInfinite = Float(infiniteLights.size()) /
                      Float(infiniteLights.size() + (!lightBounds.empty() ? 1 : 0));

infiniteLigths.size() value can be 0.0 and later this value is used in some division operations..

if (u < pInfinite) {
        u /= pInfinite;
        int index = std::min<int>(u * infiniteLights.size(), infiniteLights.size() - 1);
        Float pdf = pInfinite * 1.f / infiniteLights.size();
        return SampledLight{infiniteLights[index], pdf};
    } else {...

I try to add this...
if (pInfinite == 0.0f) return {};
..and seems that solve the issue, but unsure if this are the 'right' solution.
@mmp what do you think?

@pbrt4bounty pbrt4bounty changed the title Exhaustive light sampler + rectangle area light + GPU render = fatal error Exhaustive light sampler + area light(rectangle or quad) + GPU render = fatal error Nov 24, 2023
@pbrt4bounty pbrt4bounty reopened this Nov 24, 2023
@pbrt4bounty pbrt4bounty changed the title Exhaustive light sampler + area light(rectangle or quad) + GPU render = fatal error Exhaustive light sampler + area light + GPU render = fatal error Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant