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

Correct options on Eigen::MappedSparseMatrix. #3343

Closed
wants to merge 3 commits into from

Conversation

cantonios
Copy link

Description

The only accepted Options for SparseMatrix are RowMajor and ColMajor.
Note that Options != Flags, so passing Type::Flags leads to invalid
options. This is checked in the latest version of Eigen via a static
assertion, which causes a build break.

The only accepted `Options` for `SparseMatrix` are `RowMajor` and `ColMajor`.
Note that `Options` != `Flags`, so passing `Type::Flags` leads to invalid
options.  This is checked in the latest version of Eigen via a static
assertion, which causes a build break.
@Skylion007
Copy link
Collaborator

We should bump the Eigen version here as well:

"dc252fbf00079ccab57948a164b1421703fe4361"
to run the tests properly on the latest version.

tests/CMakeLists.txt Outdated Show resolved Hide resolved
@henryiii
Copy link
Collaborator

Looks like (a) problem is: https://gitlab.com/libeigen/eigen/-/blob/3.4.0/Eigen/src/Core/PlainObjectBase.h#L177 - that's a constant expression, so MSVC warns about it. That's really not our fault. I'm guessing SYSTEM includes don't help MSVC.

@henryiii
Copy link
Collaborator

henryiii commented Oct 11, 2021

Should we just add -wd4127 to the tests when compiling with MSVC? Ideally Eigen should suppress or handle this. Unfortunately, that would potentially hide the error if it popped up again in our code. :(

@Skylion007
Copy link
Collaborator

@henryiii Wouldn't a pragma be a better solution? Thoughts @rwgk ?

@henryiii
Copy link
Collaborator

If it could be localized enough. Ideally on the Eigen include, if MSVC was happy with that (sometimes it has to be at usage, not at include).

@rwgk
Copy link
Collaborator

rwgk commented Oct 11, 2021

If it could be localized enough. Ideally on the Eigen include

Sounds good to me. I think that's probably the best way to handle this particular situation.

@Skylion007
Copy link
Collaborator

@rwgk Since you are most familiar with these pragmas, would you mind giving a stab at it?

@rwgk
Copy link
Collaborator

rwgk commented Oct 11, 2021

@rwgk Since you are most familiar with these pragmas, would you mind giving a stab at it?

I'll give it a shot.

set(PYBIND11_EIGEN_VERSION
"dc252fbf00079ccab57948a164b1421703fe4361"
"929bc0e191d0927b1735b9a1ddc0e8b77e3a25ec"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"929bc0e191d0927b1735b9a1ddc0e8b77e3a25ec"
"05c9d7ce201bfcbe7a2706bef4f893038ae251e5"

I cherry-picked disabling the MSVC warning from the master branch, which should only disable the warning locally within Eigen.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts @rwgk ? I think it would be better if we pointed to a stable eigen version especially for downstream usecases.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm uncertain what this means, could you please give more context?
When did you cherry pick? From the Eigen master?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwgk They fixed the warning on Eigen Master, but it's not in a new stable version yet.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just wait for the 3.4.1 release then (and maybe document somewhere that Eigen 3.4.0 (only) has the C4127 warning issue)?

Copy link
Collaborator

@Skylion007 Skylion007 Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the state of Eigen's repo right now, that might be the best course of action.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to try this anyway (CI just triggered, waiting for results): #3352

See the added comment in eigen.h for the rationale.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwgk I cherry-picked the change disabling the MSVC warning from Eigen's master branch onto Eigen's 3.4 branch. Someone else modified this PR to pull from the tip of the 3.4 branch, which is not the 3.4.0 release (i.e. commit 929bc0e191d0927b1735b9a1ddc0e8b77e3a25ec).

The Eigen update/warning issue is incidental to the original PR, which is to correct the options on MappedSparseMatrix, and is incorrect regardless of which version of Eigen is used - it's just that on the master branch, this currently fails to build because of new static assertions.

This is blocking me from updating Eigen internally at Google, since we sync with the Eigen master branch (of which I am a maintainer). If updating the version of Eigen used here is causing other issues, then can we file that as a separate issue and address later? I would appreciate getting the original change in as soon as possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks.
Ideally we want a bit cleaner CI though to be more certain we're not overlooking something.
I'll pull your original change into my PR for testing.

rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Oct 11, 2021
…o not run past 99 columns (our desired but currently not enforced limit).
rwgk pushed a commit that referenced this pull request Oct 11, 2021
…ression around Eigen includes. (#3352)

* Adding MSVC C4127 suppression around Eigen includes.

* For MSVC 2015 only: also adding the C4127 suppression to test_eigen.cpp

* Copying original change from PR #3343, with extra line breaks to not run past 99 columns (our desired but currently not enforced limit).
@rwgk
Copy link
Collaborator

rwgk commented Oct 11, 2021

Original change merged via PR #3352.

@rwgk rwgk closed this Oct 11, 2021
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

Successfully merging this pull request may close these issues.

4 participants