Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60345
Add support for NewLib, an embedded libc variant by re-using existing Android library stubs plus few NewLib specific guards
Problem:
Newlib is a C standard library intended for embedded use, similarly to how Android uses bionic. This causes some incompatibility with the math functions that are present in glibc but not Newlib (and some versions bionic) and makes porting PyTorch to environments such as SGX hard.
Solution:
Subscribed Newlib to the same fixes present for older versions of Android and add fixes specific for Newlib
Test Plan: Run the PyTorch tests.
Reviewed By: malfet
Differential Revision: D29022623
fbshipit-source-id: 028dd7ff9b3ee394371c275642c90c9ef108e639
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56830
Opt into formatting on GitHub and format everything. This is a trial run before turning on formatting for more and eventually all of the codebase.
Test Plan: CI
Reviewed By: zertosh
Differential Revision: D27979080
fbshipit-source-id: a80f0c48691c08ae8ca0af06377b87e6a2351151
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55177
This fixes `warning: '_GLIBCXX11_USE_C99_COMPLEX' is not defined, evaluates to 0`, that would be raised if https://github.com/pytorch/pytorch/pull/54820 used with libstd++ compiled without USE_C99_COMPLEX support.
In `c++config.h` `_GLIBCXX_USE_C99_COMPLEX` is aliased to either `_GLIBCXX98_USE_C99_COMPLEX` or `_GLIBCXX11_USE_C99_COMPLEX` depending on `__cplusplus` macro, as shown here:
0cf4813202/libstdc%2B%2B-v3/include/bits/c%2B%2Bconfig (L641-L647)
Abovementioned config file is generated by autoconf, that leaves macro undefined if feature is not used, so using conditional like `defined(_GLIBCXX_USE_C99_COMPLEX) && _GLIBCXX_USE_C99_COMPLEX == 0` would trigger undefined macro preprocessor warning.
Test Plan: CI
Reviewed By: Orvid
Differential Revision: D27517788
fbshipit-source-id: a6db98d21c9bd98205815641363b765a02399678
Summary:
When building with Android NDK platforms prior to android-21,
and when building for Android with libstdc++, there are some
gaps in the C and C++ standard libraries. We use both for our
internal 32-bit builds, so we need PyTorch to support this platform.
All of the gaps are filled with this math_compat.h header, which
needs to be included in any file that uses one of the functions
that are not properly defined on Android. The file is a bit
hack-tastic, but it is only used on a platform that is not receiving
updates, so there shouldn't be a risk of breakage in the future.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28567
Test Plan: Internal android build.
Differential Revision: D18099513
Pulled By: dreiss
fbshipit-source-id: 020aab19c6fa083206310b018925d92275d4a548