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

Android support #325

Closed
sasskialudin opened this issue Apr 5, 2024 · 5 comments
Closed

Android support #325

sasskialudin opened this issue Apr 5, 2024 · 5 comments

Comments

@sasskialudin
Copy link

I know that you have closed a previously opened issue about that topic on December 14th due to lack of answer from the original poster but meanwhile more potent smartphones are making their headway, so the issue is very relevant again ;-)

Here is h a copy of the message I left on your closed thread.


Fantastic project, kudos!

I'm also interested in running a choice of models from an Android smartphone.

I'm a developer and my use case involves an app driving the phone by voice (prompts will be acquired by a speech to text fronted) triggering agents from a bound LLM (supporting function calls).

I just bought a state of the art phone just to make this possible, it's a OnePlus 12 featuring a Snapdragon 8 gen 3 SOC with 24Gb RAM (available only from China!) and 1tb storage. It should be enough to execute quantized 13B models .

My app will be created with Flutter and should interoperate with the picked llamafile model via Dart FFI.

Is that possible?

@jart
Copy link
Collaborator

jart commented Apr 6, 2024

Please run the following program:

#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

static int GetBitsInAddressSpace(void) {
    int i;
    void *ptr;
    uint64_t want;
    for (i = 0; i < 40; ++i) {
        want = UINT64_C(0x8123000000000000) >> i;
        if (want > UINTPTR_MAX)
            continue;
        int flags = MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS;
        ptr = mmap((void *)(uintptr_t)want, 1, PROT_READ, flags, -1, 0);
        if (ptr != MAP_FAILED) {
            munmap(ptr, 1);
            return 64 - i;
        }
    }
    fprintf(stderr, "failed to determine number of bits in address space\n");
    exit(1);
}

int main() {
    printf("%d\n", GetBitsInAddressSpace());
}

If that prints a number that's less than 47 then you're not within our current support vector. You have to either rebuild your kernel or ask your vendor to provide a larger address space. For example, on my workstation it prints 56.

@jart jart closed this as completed Apr 6, 2024
@sasskialudin
Copy link
Author

You mean compiling and running this program on my (Android 14) OnePlus phone?

@sasskialudin
Copy link
Author

sasskialudin commented Apr 6, 2024 via email

@sasskialudin
Copy link
Author

Unfortunately your program reports 39 on my OnePlus 12 phone.
On my development machine (Windows 11, core i5 1235U, 64Gb RAM), it reports 47.

@sasskialudin
Copy link
Author

sasskialudin commented Apr 6, 2024 via email

@Mozilla-Ocho Mozilla-Ocho locked as too heated and limited conversation to collaborators Apr 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants