Repository navigation
[Type] Windows: dont export explicit instanciations - #6409
Merged
Merged
Conversation
fredroy
force-pushed
the
mat_inline_accessors
branch
from
October 16, 2026 04:57
2dd496a to
b96dd1d
Compare
Contributor
|
only Windows? |
Contributor
Author
Yes, it is because only Windows uses the import/export mechanism |
bakpaul
approved these changes
Oct 16, 2026
fredroy
force-pushed
the
mat_inline_accessors
branch
from
October 28, 2026 01:51
b96dd1d to
ae21515
Compare
hugtalbot
approved these changes
Oct 29, 2026
…extern templates On Windows, "extern template class SOFA_TYPE_API Mat<...>" makes every Mat member dllimport. Neither MSVC nor clang-cl inline those members (clang-cl refuses because they call non-imported std::array members), so even operator()(i,j) becomes a call through the import table. clang-cl was additionally hit by lld placing the exported accessor across a cache line. Skip the extern template declarations on _WIN32 so client code instantiates the inline members locally. Mat.cpp keeps its exported explicit instantiations, so Sofa.Type.dll exports the same symbols and binaries built against the old header still load.
…tialVector, Transform and ClampedScalar Same reasoning as for Mat: on Windows, the dllimport extern templates keep the header-defined members from being inlined. Members defined out of line in the .inl files are still exported by Sofa.Type and are reached through the import library. Sofa.Type.dll exports are unchanged.
alxbilger
force-pushed
the
mat_inline_accessors
branch
from
October 29, 2026 13:58
ae21515 to
49eec50
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
... and allow msvc and clang to properly inline hot functions.
In a nutshell, the import/export mechanism (only for win32) block the compiler to properly inline/optimize.
The effect is quite dramatic:
For TorusFall, clang-ci and optim is slightly slower because the final positions are slightly different (clang-cl use fma by default and compiles with march=native) and causes more constraints (so longer time in constraint resolution, snowball effect)
I edited a little bit the comments the AI had generated but I think it is important so I let them
[with-all-tests]
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if