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

Infinite recursion in matrix vector product with DiffArray #97

Open
eliemichel opened this issue Jun 28, 2020 · 4 comments
Open

Infinite recursion in matrix vector product with DiffArray #97

eliemichel opened this issue Jun 28, 2020 · 4 comments

Comments

@eliemichel
Copy link
Contributor

The following snippet leads a stack overflow because of an infinite recursion:

using Vector2fD = Array<DiffArray<float>, 2>;
using Matrix2x2f = Matrix<float, 2>;

Vector2fD y(.2f, .3f);

auto [s, c] = sincos(0.7853981633974483f);
Matrix2x2f m(c, s, -s, c);

Vector2fD z = m * y; // here

Here is a the beginning of the call stack:

callstack

Built with MSVC16, without CUDA, commit e240a4b

@Speierers
Copy link
Member

Hi @eliemichel ,
For your information, DiffArray have only been tested with CUDAArray. I doubt they work with simple float.

Could you try this code with CUDAArray instead?

@eliemichel
Copy link
Contributor Author

eliemichel commented Jul 6, 2020

Hi Sebastien,
Don't have CUDA set up here. I understand DiffArrays with simple floats received less attention, nevertheless they are explicitly implemented here https://github.com/mitsuba-renderer/enoki/blob/master/src/autodiff/autodiff.cpp#L1223 which means somebody though about supporting them. It worked for me most of the time, except for the two issues I reported, and since it is templated code issues on the CPU implementation may reveal flaws that affect the CUDA implementation as well.

@Speierers
Copy link
Member

We are currently working on a major patch for enoki that will affect most of the codebase. Unfortunately I won't have the time to look into this at the moment as what you are trying to do isn't "officially" supported by the current version of the library.

You will need to dig a bit further yourself and I will be happy to help if you can provide some more insight on this bug.

@eliemichel
Copy link
Contributor Author

eliemichel commented Jul 7, 2020

I understand, no worry, I worked it around by replacing the matrix vector product by a series of dot products for now.

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

2 participants