Uh oh!
There was an error while loading. Please reload this page.
Fix portable library build on Windows - #13260
Merged
GregoryComer merged 17 commits intoAug 26, 2025
Merged
Conversation
ContributorAuthor
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13260
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Aug 9, 2025
GregoryComer
marked this pull request as ready for review
August 10, 2025 02:11
GregoryComer
requested review from
kirklandsign, larryliu0820, manuelcandales and swolchok
as code ownersAugust 10, 2025 02:11
GregoryComer
commented
Aug 10, 2025
ContributorAuthor
@manuelcandales Any thoughts or preference on the approach used here? |
swolchok
approved these changes
Aug 12, 2025
swolchok
left a comment
Contributor
There was a problem hiding this comment.
I was skeptical, but Google (and Godbolt https://godbolt.org/z/Tq8Tr9aWz) confirms this is a well-documented problem that happens when using MSVC. Thanks!
This was referenced Aug 20, 2025
| INT_T floor_divide(INT_T a, INT_T b) { | ||
| const auto quot = a / b; | ||
| if (std::signbit(a) == std::signbit(b)) { | ||
| // MSVC does not like signbit on integral types. |
JacobSzwejbka
approved these changes
Aug 25, 2025
Base automatically changed from
gh/GregoryComer/117/head to
gh/GregoryComer/141/headAugust 26, 2025 00:12
GregoryComer
commented
Aug 26, 2025
ContributorAuthor
I'm not sure, why ghstack merged this when re-ordering PRs. I'll re-open as a new PR. |
GregoryComer added a commit
that referenced
this pull request
Aug 27, 2025
**Note: This is a cherry-pick / identical copy of the existing approved PR (#13260). I inadvertently broke the ghstack when attempting to re-order the stack, leading to the old PR being merged by ghstack into the ghstack-created branch (not main).** Enable build of the portable operator library (and executor_runner, now that we have portable) on the Windows preset. There are a couple of patterns that weren't building on Windows. Both std::nan and std::signbit complain about ambiguous overload resolution when given an integer argument. To solve the std::isnan issue, I introduced isnan_override in math_util.h, following the naming pattern from max_override / min_override / etc. in the same file. It adds a specialized branch for integers to avoid calling std::isnan. For std::signbit, I just locally specialized. I also re-enabled optimized and quantized kernel libraries in the Windows preset, as they now build with this change.
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 freeto 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.
Enable build of the portable operator library (and executor_runner, now that we have portable) on the Windows preset. There are a couple of patterns that weren't building on Windows. Both std::nan and std::signbit complain about ambiguous overload resolution when given an integer argument.
To solve the std::isnan issue, I introduced isnan_override in math_util.h, following the naming pattern from max_override / min_override / etc. in the same file. It adds a specialized branch for integers to avoid calling std::isnan. For std::signbit, I just locally specialized.
I also re-enabled optimized and quantized kernel libraries in the Windows preset, as they now build with this change.