Skip to content

Removing __INTEL_COMPILER section from pragma block at the top of pybind11.h #3135

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

Merged
merged 9 commits into from
Jul 27, 2021

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 20, 2021

Follow-on to PR #3127, based on results obtained under PR #3125.

The suggested changelog entry will be in the final PR of this cleanup series.

@rwgk rwgk force-pushed the intel_pragma_pop branch 2 times, most recently from 6bfa0f1 to 82aceb7 Compare July 22, 2021 03:21
@rwgk rwgk marked this pull request as ready for review July 26, 2021 17:55
@rwgk rwgk requested a review from henryiii as a code owner July 26, 2021 17:55
Comment on lines 318 to 319
-diag-disable
2196,11074,11076)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be added by the main CMakeLists to the correct target, not in tests. Someone using CMake (at least) should get the warnings added. ("This" being the inline/noinline one, not the max-size, as those can be handled by users)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you please guide me how?

I have this: https://gist.github.com/rwgk/9c4305ccc492ad78654f842f58f36b09

It shows exactly which header files trigger #2196. Is that relevant here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here, actually: https://github.com/pybind/pybind11/blob/master/tools/pybind11Common.cmake

I wish the names of the targets were a bit more general - windows helper, etc. are too specific to add this too. Maybe we need an intel_helper?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here, actually: https://github.com/pybind/pybind11/blob/master/tools/pybind11Common.cmake

I wish the names of the targets were a bit more general - windows helper, etc. are too specific to add this too. Maybe we need an intel_helper?

Gulp ... will it be simpler like e.g.

set(clang_4plus
    "$<AND:$<CXX_COMPILER_ID:Clang>,$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,3.9>>>")
set(no_register "$<OR:${clang_4plus},$<CXX_COMPILER_ID:AppleClang>>")

?
If you could help out with this part that would be really awesome.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wait ... thinking about it ...

This should be added by the main CMakeLists to the correct target, not in tests.

If that's what we want, we could just add this in common.h and be done with it:

#if defined(__INTEL_COMPILER)
// This pragma cannot be pop'ed:
// https://community.intel.com/t5/Intel-C-Compiler/Inline-and-no-inline-warning/td-p/1216764
#  pragma warning disable 2196  // warning #2196: routine is both "inline" and "noinline"
#endif

I'll make that revision asap.

@rwgk rwgk force-pushed the intel_pragma_pop branch 2 times, most recently from 7f379b1 to f022a3c Compare July 26, 2021 20:41
@rwgk rwgk changed the title Fixing pragma warning pop for __INTEL_COMPILER. Removing __INTEL_COMPILER section from pragma block at the top of pybind11.h Jul 27, 2021
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 27, 2021

Deflaking (test_iostream.py).

@rwgk rwgk closed this Jul 27, 2021
@rwgk rwgk reopened this Jul 27, 2021
@rwgk rwgk requested a review from Skylion007 July 27, 2021 17:12
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 27, 2021

Hi @henryiii and @Skylion007, please take another look. It's really straightforward now.

@@ -2376,6 +2375,9 @@ inline function get_overload(const T *this_ptr, const char *name) {

PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)

//
// THE `pop` HERE NEED TO BE KEPT IN SYNC WITH THE CORRESPONDING `push` AT THE TOP OF THIS FILE.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// THE `pop` HERE NEED TO BE KEPT IN SYNC WITH THE CORRESPONDING `push` AT THE TOP OF THIS FILE.
// THE `pop` HERE NEEDS TO BE KEPT IN SYNC WITH THE CORRESPONDING `push` AT THE TOP OF THIS FILE.

IMO "push" implies "pop", otherwise you wouldn't bother to "push" in the first place, but not horribly against this note if you want it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the notes completely. Hopefully a few PRs down the road this block will be gone entirely!

Note that I started out wanting to fix the missing pop for Intel, but in the meantime the direction of this PR changed a lot and the notes don't make that much sense anymore.

@rwgk
Copy link
Collaborator Author

rwgk commented Jul 27, 2021

Thanks for the reviews :-)

@rwgk rwgk merged commit 2164c2e into pybind:master Jul 27, 2021
@rwgk rwgk deleted the intel_pragma_pop branch July 27, 2021 22:33
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 27, 2021
henryiii pushed a commit to henryiii/pybind11 that referenced this pull request Jul 29, 2021
…ind11.h (pybind#3135)

* Fixing `pragma warning pop` for `__INTEL_COMPILER`.

* Adding push/pop to 3 tests. Removing pybind#878 from top of pybind11.h (it was/is only needed for 1 test).

* Trying again after CI failure, moving the push to the top of 2 tests.

* Trying more after CI failure, adding push/pop to pybind11_tests.h, constructor_stats.h.

* Moving ICC pybind#2196 suppression to CMakeLists.txt

* Fixing condition for `pragma GCC diagnostic push` in pybind11.h

* Moving `pragma warning disable 2196` to common.h

* Revising #ifdef to be more conservative.

* Undoing insertion of notes that will hopefully soon be completely obsolete anyway.
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jul 30, 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.

3 participants