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

Bug: MinGW build fails to load models with "error loading model: PrefetchVirtualMemory unavailable" #9311

Closed
jeberger opened this issue Sep 4, 2024 · 8 comments
Labels
bug-unconfirmed high severity Used to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow) stale

Comments

@jeberger
Copy link

jeberger commented Sep 4, 2024

What happened?

llama-cli and llama-bench rev. 9379d3c built with MinGW fails to load models:

llama_model_load: error loading model: PrefetchVirtualMemory unavailable
llama_load_model_from_file: failed to load model

Name and Version

./bin/llama-cli --version
version: 3664 (9379d3c)
built with for x86_64-w64-mingw32

What operating system are you seeing the problem on?

Windows

Relevant log output

llama_model_load: error loading model: PrefetchVirtualMemory unavailable
llama_load_model_from_file: failed to load model
@jeberger jeberger added bug-unconfirmed high severity Used to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow) labels Sep 4, 2024
@jeberger
Copy link
Author

jeberger commented Sep 4, 2024

I believe the issue was introduced when the source was reorganized into folders. I'm able to work around it by adding the following to the top level CMakeLists.txt:

if (MINGW)
    add_compile_definitions(_WIN32_WINNT=0x602)
endif()

so I believe the equivalent code is missing from some CMakeLists.txt files in subfolders (I tried adding it to examples/llama-bench/CMakeLists.txt but that wasn't enough to fix the issue).

@homenkovo
Copy link

I had a similar problem. I just replaced #define _WIN32_WINNT 0x0601 with #define _WIN32_WINNT 0x0A00 in the <_mingw.h> file and it worked.

@github-actions github-actions bot added the stale label Oct 21, 2024
Copy link
Contributor

github-actions bot commented Nov 4, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Nov 4, 2024
@theSoberSobber
Copy link

Why was this closed, I suffered the same error as this in current latest commit and fixed it using @homenkovo's solution

@watkyns
Copy link

watkyns commented Feb 4, 2025

having same issue with b4628 and homenkovo's solution can fix it

@0dminnimda
Copy link

No need to modify no files, a simple command line argument is enough:

-DCMAKE_CXX_FLAGS=-D_WIN32_WINNT=0x602

@robbyvids
Copy link

not worked on win 11 for me, using python script. Memory more than enough, it happen when loading to gpu or cpu.

llama_model_load: error loading model: PrefetchVirtualMemory unavailable

@vishal-ahirwar
Copy link

No need to modify no files, a simple command line argument is enough:

-DCMAKE_CXX_FLAGS=-D_WIN32_WINNT=0x602

thanks it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed high severity Used to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow) stale
Projects
None yet
Development

No branches or pull requests

7 participants