What happened?
Changes to thread affinity cause Android builds to use:
static bool lm_ggml_thread_apply_affinity(const bool * mask) {
cpu_set_t cpuset;
int err;
CPU_ZERO(&cpuset);
for (uint32_t i = 0; i < LM_GGML_MAX_N_THREADS; i++) {
if (mask[i]) {
LM_GGML_PRINT_DEBUG("Thread %lx: adding %d to cpuset\n", pthread_self(), i);
CPU_SET(i, &cpuset);
}
}
...
However, cpu_set_t, CPU_SET and CPU_ZERO does not necessarily exist in all Android NDK versions, causing specific pipelines to fail.
A simple fix would be to add the following definitions:
#ifdef __ANDROID__
#define CPU_SETSIZE 1024
#define __NCPUBITS (8 * sizeof (unsigned long))
typedef struct
{
unsigned long __bits[CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;
#define CPU_SET(cpu, cpusetp) \
((cpusetp)->__bits[(cpu)/__NCPUBITS] |= (1UL << ((cpu) % __NCPUBITS)))
#define CPU_ZERO(cpusetp) \
memset((cpusetp), 0, sizeof(cpu_set_t))
#endif
However, this solution seems ineligant. I'm not an in-depth android developer so I'm not sure if there is a more poignant solution.
Name and Version
Custom pipeline for android arm64-v8a
What operating system are you seeing the problem on?
Windows
Relevant log output
No response
What happened?
Changes to thread affinity cause Android builds to use:
However,
cpu_set_t,CPU_SETandCPU_ZEROdoes not necessarily exist in all Android NDK versions, causing specific pipelines to fail.A simple fix would be to add the following definitions:
However, this solution seems ineligant. I'm not an in-depth android developer so I'm not sure if there is a more poignant solution.
Name and Version
Custom pipeline for android arm64-v8a
What operating system are you seeing the problem on?
Windows
Relevant log output
No response