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

[tensorflow-cc/tensorflow-common] Add uwp port #14394

Closed
wants to merge 206 commits into from

Conversation

jgehw
Copy link
Contributor

@jgehw jgehw commented Nov 4, 2020

Implementation of patches discussed in #14252.

I suggest to wait with reviewing until #14392 is merged into master, because this PR builds upon #14392, and once #14392 is merged the file diffs of this PR will collapse to just a few simple changes.

Current state: work-in-progress

Gehweiler and others added 30 commits July 23, 2020 21:53
…se customized bazel config is stored in wrong directory
- add patch to fix debug builds
- add patch to fix exports for static linking
- really build debug (instead of cloning release)
- override bazel build options for debug (work around bazel bug)
- bazel doesn't support static libraries: work around by building dynamic library and constructing static linkage commands from build log
- Windows .pdb file can't be >4GB even on x64: work around using reduced debug information
- Windows doesn't support .lib files >4GB even on x64, so split into multiple libs
- vcpkg requires equal amount of libs for debug and release: work around using handcrafted empty dummy libs
- fix naming of libs (.dll on Windows and .dylib on macOS)
- adapt patch files to tensorflow code changes
- update bazel from v0.25.2 to v3.1
- on Windows use python installed on the host instead of embedded python obtained via vcpkg because embedded python lacks pip, which we need to obtain numpy
- on Windows add MSYS2 to the PATH so that bazel tools can access MSYS2 GIT
- add support for custom CA certificates when using HTTPS_PROXY
The existing implementation totally screwed up commands if the command's arguments contained semicolons (this is the case, e.g., in the FindPython modules of the cmake distribution).
incorporate changes from microsoft:master
…-more' as required for find_package(Python3)
Revert "incorporate changes from microsoft:master"
…eading the last real libraries contents over the required number of libraries
@jgehw
Copy link
Contributor Author

jgehw commented Feb 22, 2021

@PhoebeHui I fixed version files, so also x86 CI errors are solved now.

@PhoebeHui PhoebeHui changed the title add [tensorflow] uwp port [tensorflow-cc/tensorflow-common] Add uwp port Feb 23, 2021
@JackBoosY
Copy link
Contributor

I think these changes are not official and we should wait for upstream approval.

@PhoebeHui
Copy link
Contributor

@jgehw, for the patch, could you submit an issue or PR to Upstream?

@jgehw
Copy link
Contributor Author

jgehw commented Feb 24, 2021

@jgehw, for the patch, could you submit an issue or PR to Upstream?

@PhoebeHui An according issue was already filed as tensorflow/tensorflow#44463 by @ianier several months ago. Upstream said that they don't have enough resources to officially support this, and suggested that we support it via a community build. So, we created this port as a community build.

@ianier
Copy link

ianier commented Feb 24, 2021

@PhoebeHui: Come on. If Microsoft shows no commitment to UWP (not even upstream), who will?

@PhoebeHui
Copy link
Contributor

PhoebeHui commented Feb 25, 2021

@jgehw, thanks for the information!

@strega-nil @ras0219-msft, could you help further review?

Copy link
Contributor

@ras0219 ras0219 left a comment

Choose a reason for hiding this comment

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

Thanks for this PR!

and suggested that we support it via a community build. So, we created this port as a community build.

I assume that by "community build", they mean that they will accept PRs upstream but won't provide testing resources.

Given the extreme complexity of tensorflow, we're very hesitant to accept large patches like this without some amount of upstream support. To be extra-clear about what we would want to see: we don't need tensorflow to provide builds for arm64 or uwp, but we do need upstream to commit to reviewing and accepting PRs to make it work. Specifically, we need to see most of the patches and changes in this PR made against upstream and merged.

We'd love to see tensorflow on UWP, but we (vcpkg) cannot commit to the complexity required by this PR without upstream willingness to accept contributions.

Comment on lines +226 to +227
message(STATUS "UWP build requires a patched header to be force-included. As this currently is not possible with bazel, we will copy '__vcpkg_uwppatch.h' to '$ENV{VCToolsInstallDir}/include/'. This might require vcpkg to be run as Administrator if the next command fails.")
configure_file(${CMAKE_CURRENT_LIST_DIR}/uwppatch.h $ENV{VCToolsInstallDir}/include/__vcpkg_uwppatch.h COPYONLY)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unfortunately against vcpkg policy and cannot be merged as-is due to modifying global system state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I understand. So, as all other approaches I tried didn't work in the end, we need to wait until someone else has a solution or somebody answers the according question I posted for this: https://stackoverflow.com/questions/65184913/how-do-i-add-an-additional-system-include-directory-using-bazel

@JackBoosY JackBoosY added depends:upstream-changes Waiting on a change to the upstream project requires:author-response labels Feb 26, 2021
@ianier
Copy link

ianier commented Feb 26, 2021

We'd love to see tensorflow on UWP, but we (vcpkg) cannot commit to the complexity required by this PR without upstream willingness to accept contributions.

The unfortunate fact is that upstream support for Windows features is limited, and it won’t get any better without at least some involvement from Microsoft. This is a chicken-and-egg problem: the platform won’t gain users if the features aren’t there, and developers won’t add features for platforms where there are no users.
For example, where’s upstream support for Windows on ARM? In comparison, support for MacOS on the M1 CPU is already being worked on. The situation for UWP is even worse; just look at how few vcpkg libs support the -uwp triplets.
Ranting aside, I understand this is not the ideal situation and I’m grateful to @jgehw for this solution. @ras0219 do you happen to know if Microsoft has contributors upstream we could talk to?

@jgehw
Copy link
Contributor Author

jgehw commented Mar 2, 2021

As my question on StackOverflow for a clean solution of the bazel issue has continuously been viewed but not answered yet after more than two months, and as my work-around is against vcpkg policy, we can put this PR on hold from my side since there's nothing more I can do about it. At least UWP users can check out this branch and build for the time being.

@ras0219-msft
Copy link
Contributor

@ianier I don't currently know of an appropriate contact to put you in touch with unfortunately.

Let me restate how I feel we can make progress with this PR:

  1. @jgehw or @ianier opens a PR against tensorflow/tensorflow containing the source changes in this PR (https://github.com/microsoft/vcpkg/pull/14394/files#diff-c359b7d2a4231436bf48bf6475452d7c4fe52fef17c57ea7ee7d7fa91554e5e7 et al)
  2. After back-and-forth, upstream merges the PR. While they did say that they won't be adding UWP to their build matrix in Add WinRT (UWP) as a supported platform tensorflow/tensorflow#44463, they did not say they will refuse PRs -- in fact, I take the statement about "community builds" as an invitation for PRs.
  3. We then do one of:
    1. Wait for the next release that contains the changes
    2. Download the relevant commit diffs on-demand via a url like https://github.com/tensorflow/tensorflow/commit/e86be327976e8cca447072562f2fae049148f74f.diff
    3. Backport the merged changes into local patches (least preferable)

@ianier
Copy link

ianier commented Mar 12, 2021

@ras0219-msft : As a developer, my incentive here is to get features implemented in my UWP app. I felt vcpkg was a reasonable way to do that and I can’t thank @jgehw enough for getting me there.
The unfortunate fact is that the UWP developer community is small, and this won’t change without additional efforts to promote the technology. This is why I’ve been (naively) hoping that some kind of UWP evangelist would help us upstream.
So, right now, it’s pretty clear to me that the safest way for us app developers to go in the long run is to steer away from UWP.

@jgehw
Copy link
Contributor Author

jgehw commented Mar 12, 2021

@ras0219-msft Some of the changes of this PR won't get merged upstream as they are quick hacks to work around compilation errors, forsaking some minor tensorflow features most people never use. I'm pretty sure, upstream would require clean removal of these un-compilable features by adding compilation switches etc. This involves quite some work. As I'm not a UWP user, and never will be, I can't donate enough time to cover this. After @ianier found a way to make tensorflow compile on UWP, I just incorporated his findings into patches and a vcpkg port.
For this reason, and because a vcpkg compliant solution not modifying global system state is still not availble (see discussion two weeks ago), I think it's best to put this PR on hold until eventually someone volunteers to do the required upstream work.

@ianier
Copy link

ianier commented Mar 13, 2021

As I'm not a UWP user, and never will be,

And the way things are going, I'm afraid eventually nobody will :-(
The main motivations to use UWP right now are its modern UI and Store support, so I wouldn't be surprised if UWP got deprecated once WinUI for Win32/desktop gains traction.

@PhoebeHui
Copy link
Contributor

PhoebeHui commented May 25, 2021

@jgehw @ianier, can we close this PR? We would help reopen if someone wants to continue this PR.

@ianier
Copy link

ianier commented May 25, 2021

@jgehw @ianier, can we close this PR? We would help reopen if someone wants to continue this PR.

I guess you may close this one on the account of the WinRT debacle. BTW, I just realized that the other 'official' UWP triplet is arm-uwp (32-bit ARM is today a truly dead platform), while arm64-uwp is a community triplet. Go figure.

@PhoebeHui
Copy link
Contributor

We have covered arm64-windows and x64-uwp, so I think this is intended, some issues would be detected by arm64-windows, similar to x64-uwp, we covered more arch/platfrom, it would be helpful to track and investgate the issues.

@PhoebeHui PhoebeHui closed this May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR! depends:upstream-changes Waiting on a change to the upstream project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants