-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added the ability to use LLAMA_HIP_UMA #439
Comments
First in all case it is not good to use it on dGPU (it work but really slow) so only to activate on iGPU. We may have to get more benchmark to deside what to do. |
If you want to help with benchmark, what I did: # get PR (until it is merged.)
git clone https://github.com/ggerganov/llama.cpp.git llama.cpp_bench
cd llama.cpp_bench
git fetch origin pull/7414/head:benchmark
git checkout benchmark # get Models: (to allow benchmark fare compare.)
cd ..
mkdir models
cd models
wget https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.2-llamafile/resolve/main/mistral-7b-instruct-v0.2.F16.llamafile
unzip mistral-7b-instruct-v0.2.F16.llamafile mistral-7b-instruct-v0.2.F16.gguf
rm mistral-7b-instruct-v0.2.F16.llamafile
wget https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.2-llamafile/resolve/main/mistral-7b-instruct-v0.2.Q8_0.llamafile
unzip mistral-7b-instruct-v0.2.Q8_0.llamafile mistral-7b-instruct-v0.2.Q8_0.gguf
rm mistral-7b-instruct-v0.2.Q8_0.llamafile
wget https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.2-llamafile/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.llamafile
unzip mistral-7b-instruct-v0.2.Q4_K_M.llamafile mistral-7b-instruct-v0.2.Q4_K_M.gguf
rm mistral-7b-instruct-v0.2.Q4_K_M.llamafile
wget https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.2-llamafile/resolve/main/mistral-7b-instruct-v0.2.BF16.llamafile
unzip mistral-7b-instruct-v0.2.BF16.llamafile mistral-7b-instruct-v0.2.BF16.gguf
rm mistral-7b-instruct-v0.2.BF16.llamafile # build for CPU [n°0]
cd llama.cpp_bench
make clean
make -j16
# build for GPU
# - for ryzen 7040 gfx1103 is note "supported" use gfx1101 on linux
export HSA_OVERRIDE_GFX_VERSION=11.0.1
export GFX_HARDWARE=gfx1101
# - for other ???
# - weight on VRAM [n°1]
make clean
make -j16 LLAMA_HIPBLAS=1 AMDGPU_TARGETS=${GFX_HARDWARE}
# - weight on "UMA" [n°2]
make clean
make -j16 LLAMA_HIPBLAS=1 LLAMA_HIP_UMA=1 AMDGPU_TARGETS=gfx1101 # benchmark:
# - for CPU:
./llama-bench --mmap 1 -p 256,512,1024 \
-m ../models/mistral-7b-instruct-v0.2.Q4_K_M.gguf \
-m ../models/mistral-7b-instruct-v0.2.Q8_0.gguf \
-m ../models/mistral-7b-instruct-v0.2.F16.gguf \
-m ../models/mistral-7b-instruct-v0.2.BF16.gguf
# - for GPU:
./llama-bench --mmap 0 -p 256,512,1024 \
-m ../models/mistral-7b-instruct-v0.2.Q4_K_M.gguf \
-m ../models/mistral-7b-instruct-v0.2.Q8_0.gguf \
-m ../models/mistral-7b-instruct-v0.2.F16.gguf |
Hardware: Ryzen 7940HS / 64Go
|
What I test is add option: I don't know what to detect... all AMD APU ? But main consern with this option is use GTT over VRAM ... but there is a new update in linux kernel 6.10: https://www.phoronix.com/news/Linux-6.10-AMDKFD-Small-APUs remove this need... (don't know what happen for Windows.) so may be a simple option for rebuild is good. There is even more interesting thing after we did some POC ( ggerganov/llama.cpp#7399 (comment) ) it look we can leave weight mmap in place with good perf. But it is more complicate to do it properly... |
Make a POC on that: https://github.com/Djip007/llamafile/tree/feature/hip_uma Do you want I make a MergeRequest? |
OK some other benchmark...
I'm thinking of finding a way to allow it to be activated by default... |
Not 100% sure but the last ggml update may have break the patch I made here. reopened to remind me ;) => yes part of this PR have been remove with llama.cpp synchronize e9ee3f9 Patch is here: https://github.com/Djip007/llamafile/tree/feature/hip_uma_3 but I have some OS bug on my config so can't completely test it... |
With AMD APU (like my Ryzen 7940HX) it is possible to use "UMA" to extand VRAM. And in my case I can't alloc more than 4Go of VRAM (bios config).
And with this (ggerganov/llama.cpp#7399) it may be as fast as with VRAM (I can't do a full test because I can't allocate more than 4Go of VRAM with my config)
I can (:crossed_fingers: ) make a PR here but need to know what the best is to made it available.
The text was updated successfully, but these errors were encountered: