Files
termux-packages/packages/python-torch/0004-memalign.patch
2023-03-24 17:32:06 +00:00

24 lines
1.0 KiB
Diff

diff -uNr pytorch-v1.12.1/torch/csrc/init_flatbuffer_module.cpp pytorch-v1.12.1.mod/torch/csrc/init_flatbuffer_module.cpp
--- pytorch-v1.12.1/torch/csrc/init_flatbuffer_module.cpp 2022-08-06 04:37:12.000000000 +0900
+++ pytorch-v1.12.1.mod/torch/csrc/init_flatbuffer_module.cpp 2022-09-05 00:27:22.542774737 +0900
@@ -27,7 +27,7 @@
std::shared_ptr<char> bytes_copy(
static_cast<char*>(_aligned_malloc(size, FLATBUFFERS_MAX_ALIGNMENT)),
_aligned_free);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__ANDROID__)
void* p;
::posix_memalign(&p, FLATBUFFERS_MAX_ALIGNMENT, size);
TORCH_INTERNAL_ASSERT(p, "Could not allocate memory for flatbuffer");
--- a/third_party/pocketfft/pocketfft_hdronly.h.orig
+++ b/third_party/pocketfft/pocketfft_hdronly.h
@@ -149,7 +149,7 @@
#endif
#endif
-#if __cplusplus >= 201703L
+#if (__cplusplus >= 201703L) && !defined(__ANDROID__)
inline void *aligned_alloc(size_t align, size_t size)
{
// aligned_alloc() requires that the requested size is a multiple of "align"