vulkan: replace std::aligned_alloc with posix_memalign for termux compatibility (#30828)
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
Check Pre-Tokenizer Hashes / pre-tokenizer-hashes (push) Has been cancelled
Python check requirements.txt / check-requirements (push) Has been cancelled
Python Type-Check / python type-check (push) Has been cancelled
Update Operations Documentation / update-ops-docs (push) Has been cancelled

std::aligned_alloc is unavailable on Android bionic below API 28 (Termux targets API 24); use posix_memalign like ggml.c does.
This commit is contained in:
Bill Sideris
2026-10-22 15:40:13 +03:00
committed by GitHub
parent 0693dbfb91
commit d77256999f
+5 -1
View File
@@ -9,7 +9,11 @@ static void * portable_aligned_malloc(size_t align, size_t size) {
#ifdef _WIN32
return _aligned_malloc(size, align);
#else
return std::aligned_alloc(align, size);
void * ptr = nullptr;
if (posix_memalign(&ptr, align, size) != 0) {
return nullptr;
}
return ptr;
#endif
}