]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
16 months agoAdd Ava in the list of llama.cpp UIs (#4362)
Kamil Tomšík [Wed, 7 Feb 2024 18:44:52 +0000 (19:44 +0100)]
Add Ava in the list of llama.cpp UIs (#4362)

16 months agoCUDA: fixed mmvq kernel for bs 2,3,4 and -sm row (#5386)
Johannes Gäßler [Wed, 7 Feb 2024 11:40:26 +0000 (12:40 +0100)]
CUDA: fixed mmvq kernel for bs 2,3,4 and -sm row (#5386)

16 months ago[SYCL] update install make by w64devkit (#5297)
Neo Zhang Jianyu [Wed, 7 Feb 2024 10:16:55 +0000 (18:16 +0800)]
[SYCL] update install make by w64devkit (#5297)

16 months agollava-cli : always tokenize special tokens (#5382)
Xiao-Yong Jin [Wed, 7 Feb 2024 08:17:25 +0000 (02:17 -0600)]
llava-cli : always tokenize special tokens (#5382)

* llava-cli: tokenize special tokens in prompt

* llava-cli: use the escape CLI argument, remove incomplete separate escaping process

16 months agoBasic Vulkan Multi-GPU implementation (#5321)
0cc4m [Wed, 7 Feb 2024 06:54:50 +0000 (07:54 +0100)]
Basic Vulkan Multi-GPU implementation (#5321)

* Initial Vulkan multi-gpu implementation

Move most global variables into backend context

* Add names to backend device functions

* Add further missing cleanup code

* Reduce code duplication in tensor split layer assignment

* generalize LLAMA_SPLIT_LAYER for all backends, do not expose device count and memory in llama.h

* Only do device info print in the beginning and initialize one backend for cpu assist

Add missing cleanup code

* Rework backend memory management to make sure devices and buffers get properly allocated and freed

* Rename cpu assist free function

---------

Co-authored-by: slaren <redacted>
16 months agoreadme : modernize (#5379)
Eve [Wed, 7 Feb 2024 06:21:30 +0000 (06:21 +0000)]
readme : modernize (#5379)

* first cleanup, update everything to Llama 2 and remove outdated content

* Delete SHA256SUMS

* make build instructions generic

* recommend Q4_K_M quantization method

* Update README.md

16 months agoreadme : update ui list (#5354)
Ben Williams [Wed, 7 Feb 2024 06:16:48 +0000 (22:16 -0800)]
readme : update ui list (#5354)

16 months agollama : add MiniCPM support (#5346)
runfuture [Wed, 7 Feb 2024 06:15:56 +0000 (14:15 +0800)]
llama : add MiniCPM support (#5346)

* support minicpm arch.

* fix tab/space typo.

* convert minicpm model via convert-hf-gguf.py

* try to make tokenizer work

* fix bug for quantize minicpm

* fix for flake8 lint

* remove convert-minicpm.py

* fix for editorconfig

* correct minicpm model type (size)

* constants expanded for minicpm

* Minor change of the constant names for minicpm

16 months agoserver : update `/props` with "total_slots" value (#5373)
Justin Parker [Wed, 7 Feb 2024 06:15:19 +0000 (01:15 -0500)]
server : update `/props` with "total_slots" value (#5373)

* include total "num_slots" in default_generation_settings_for_props

* cleanup total_slots return value in /props endpoint

* update /props endpoint docs with total_slots

* remove num_slots from default_generation_settings_for_props

* update /props endpoint section

16 months agoconvert : fix TypeError on GPT-2 vocab.json (#5288)
Sang-Kil Park [Wed, 7 Feb 2024 04:28:00 +0000 (13:28 +0900)]
convert : fix TypeError on GPT-2 vocab.json (#5288)

16 months agoserver : remove model.json endpoint (#5371)
Alexey Parfenov [Tue, 6 Feb 2024 18:08:38 +0000 (18:08 +0000)]
server : remove model.json endpoint (#5371)

16 months agoCUDA: mul_mat_vec_q max. batch size 8 -> 4 (#5370)
Johannes Gäßler [Tue, 6 Feb 2024 17:43:06 +0000 (18:43 +0100)]
CUDA: mul_mat_vec_q max. batch size 8 -> 4 (#5370)

16 months agoUpdate README.md (#5366)
Kawrakow [Tue, 6 Feb 2024 17:00:16 +0000 (19:00 +0200)]
Update README.md (#5366)

Add some links to quantization related PRs

16 months agoSlight quantization improvement for Q4_K and Q5_K (#5361)
Kawrakow [Tue, 6 Feb 2024 15:28:02 +0000 (17:28 +0200)]
Slight quantization improvement for Q4_K and Q5_K (#5361)

* Q4_K: slightly better quantization

* Q5_K: slightly better quantization

---------

Co-authored-by: Iwan Kawrakow <redacted>
16 months agoreadme : add phi, orion 14b, internlm2, and yi-VL to readme (#5362)
BarfingLemurs [Tue, 6 Feb 2024 14:06:48 +0000 (09:06 -0500)]
readme : add phi, orion 14b, internlm2, and yi-VL to readme (#5362)

16 months agoCUDA: mul_mat_vec_q for batch sizes > 1 (#5351)
Johannes Gäßler [Tue, 6 Feb 2024 13:44:06 +0000 (14:44 +0100)]
CUDA: mul_mat_vec_q for batch sizes > 1 (#5351)

16 months agoserver : include total "num_slots" in props endpoint (#5349)
Justin Parker [Tue, 6 Feb 2024 09:20:59 +0000 (04:20 -0500)]
server : include total "num_slots" in props endpoint (#5349)

16 months agoserver : add `dynatemp_range` and `dynatemp_exponent` (#5352)
Michael Coppola [Tue, 6 Feb 2024 09:20:00 +0000 (04:20 -0500)]
server : add `dynatemp_range` and `dynatemp_exponent` (#5352)

* server: added `dynatemp_range` and `dynatemp_exponent`

* Update README.md

---------

Co-authored-by: Michael Coppola <redacted>
16 months agoserver : various fixes for the prompt field in /completion (#5300)
Niall Coates [Tue, 6 Feb 2024 08:16:23 +0000 (08:16 +0000)]
server : various fixes for the prompt field in /completion (#5300)

server : fix deadlock when prompt array contains strings and numbers

server : removed an unnecessary generation when generating multi-prompts

server : removed an unnecessary assert

16 months agopy : handle byte tokens in `get_token_type` (#5341)
Georgi Gerganov [Tue, 6 Feb 2024 05:47:22 +0000 (07:47 +0200)]
py : handle byte tokens in `get_token_type` (#5341)

* py : handle byte tokens in `get_token_type`

* py : fix empty bytes arg

16 months agomake: Use ccache for faster compilation (#5318)
Johannes Gäßler [Mon, 5 Feb 2024 18:33:00 +0000 (19:33 +0100)]
make: Use ccache for faster compilation (#5318)

* make: Use ccache for faster compilation

16 months agoREADME: updated introduction (#5343)
Johannes Gäßler [Mon, 5 Feb 2024 14:55:10 +0000 (15:55 +0100)]
README: updated introduction (#5343)

* README: updated introduction

* readme : update

---------

Co-authored-by: Georgi Gerganov <redacted>
16 months agoggml : make use of ggml-quants.h possible in C++ code (#5338)
Kawrakow [Mon, 5 Feb 2024 12:09:47 +0000 (14:09 +0200)]
ggml : make use of ggml-quants.h possible in C++ code (#5338)

* Make use of ggml-quants.h possible in C++ code

* One cannot possibly be defining static_assert in a C++ compilation

---------

Co-authored-by: Iwan Kawrakow <redacted>
16 months agoggml : avoid duplicating function calls using MIN/MAX macros (#5325)
Dr. Tom Murphy VII Ph.D [Mon, 5 Feb 2024 11:13:57 +0000 (06:13 -0500)]
ggml : avoid duplicating function calls using MIN/MAX macros (#5325)

* Avoid duplicating function calls when using MIN/MAX macros.

Since these copy "a" and "b" they ask the compiler to evaluate one of them twice. The compiler doesn't have a problem with removing the duplication in something like MAX(0, x + 2), but in some cases we're calling functions, and those calls just happen twice.
By explicitly evaluating at the expression we get smaller and faster code without duplicate calls. See ggml_rope_yarn_corr_dims in Compiler Explorer:

https://godbolt.org/z/Ee4KMrvKh

Code behaves exactly the same.

* Update ggml.c

---------

Co-authored-by: Georgi Gerganov <redacted>
16 months agoiq3_xxs: quards for the no-imatrix situation (#5334)
Kawrakow [Mon, 5 Feb 2024 10:32:27 +0000 (12:32 +0200)]
iq3_xxs: quards for the no-imatrix situation (#5334)

Co-authored-by: Iwan Kawrakow <redacted>
16 months agopy : fix internlm2-hf convert to gguf (#5305)
Guoteng [Mon, 5 Feb 2024 09:04:06 +0000 (17:04 +0800)]
py : fix internlm2-hf convert to gguf (#5305)

* py : fix internlm2-hf convert to gguf

* ggml-ci

16 months agoiq2_xxs: tune quantization (#5320)
Kawrakow [Mon, 5 Feb 2024 08:46:06 +0000 (10:46 +0200)]
iq2_xxs: tune quantization (#5320)

We get slightly better PPL, and we cut quantization time in
nearly half.

The trick is to 1st quantize without forcing points onto the E8-lattice.
We can then use a narrower search range around the block scale that we
got that way.

Co-authored-by: Iwan Kawrakow <redacted>
16 months agoserver : allow to get default generation settings for completion (#5307)
Alexey Parfenov [Mon, 5 Feb 2024 08:10:22 +0000 (08:10 +0000)]
server : allow to get default generation settings for completion (#5307)

16 months agocommon : add dynamic temperature parameters to main example cli (#5295)
l3utterfly [Mon, 5 Feb 2024 08:00:47 +0000 (17:00 +0900)]
common : add dynamic temperature parameters to main example cli (#5295)

* added dynamic temp params in main

* added help text

16 months agoscripts : fix typos, cleanup (#5303)
Georgi Gerganov [Mon, 5 Feb 2024 07:48:03 +0000 (09:48 +0200)]
scripts : fix typos, cleanup (#5303)

16 months agoscripts : add non-interactive server-llm.sh (#5303)
Нияз Гарифзянов [Mon, 5 Feb 2024 07:43:57 +0000 (10:43 +0300)]
scripts : add non-interactive server-llm.sh (#5303)

* Update server-llm.sh

Add flag --non-interactive that allows run script without asking a permission

* Update scripts/server-llm.sh

---------

Co-authored-by: Georgi Gerganov <redacted>
16 months agoreadme : add CodeShell models to the supported models list (#5330)
chiranko [Mon, 5 Feb 2024 07:41:38 +0000 (15:41 +0800)]
readme : add CodeShell models to the supported models list (#5330)

16 months ago[SYCL] Fix cpy with dims of 3 (#5289)
AidanBeltonS [Mon, 5 Feb 2024 07:08:24 +0000 (07:08 +0000)]
[SYCL] Fix cpy with dims of 3 (#5289)

* Fix cpy with dims of 3

* rm asserts

---------

Co-authored-by: Abhilash Majumder <redacted>
16 months agoflake.lock: Update
github-actions[bot] [Sun, 4 Feb 2024 00:17:24 +0000 (00:17 +0000)]
flake.lock: Update

Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/07f6395285469419cf9d078f59b5b49993198c00' (2024-01-11)
  → 'github:hercules-ci/flake-parts/b253292d9c0a5ead9bc98c4e9a26c6312e27d69f' (2024-02-01)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:NixOS/nixpkgs/b0d36bd0a420ecee3bc916c91886caca87c894e9?dir=lib' (2023-12-30)
  → 'github:NixOS/nixpkgs/97b17f32362e475016f942bbdfda4a4a72a8a652?dir=lib' (2024-01-29)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ae5c332cbb5827f6b1f02572496b141021de335f' (2024-01-25)
  → 'github:NixOS/nixpkgs/b8b232ae7b8b144397fdb12d20f592e5e7c1a64d' (2024-01-31)

16 months agoAdding some imatrix tools (#5302)
Kawrakow [Sun, 4 Feb 2024 08:39:58 +0000 (10:39 +0200)]
Adding some imatrix tools (#5302)

* imatrix: adding --combine and --continue-from

* imatrix: be able to start from a specific chunk

---------

Co-authored-by: Iwan Kawrakow <redacted>
16 months agocmake : use set() for LLAMA_WIN_VER (#5298)
Welby Seely [Sun, 4 Feb 2024 04:18:51 +0000 (23:18 -0500)]
cmake : use set() for LLAMA_WIN_VER (#5298)

option() is specifically for booleans.

Fixes #5158

17 months agomake: add nvcc info print (#5310)
Johannes Gäßler [Sat, 3 Feb 2024 19:15:13 +0000 (20:15 +0100)]
make: add nvcc info print (#5310)

17 months agomake: fix nvcc optimization flags for host code (#5309)
Johannes Gäßler [Sat, 3 Feb 2024 19:14:59 +0000 (20:14 +0100)]
make: fix nvcc optimization flags for host code (#5309)

17 months agoadd Vulkan support to Nix flake
Martin Schwaighofer [Sun, 28 Jan 2024 11:59:43 +0000 (12:59 +0100)]
add Vulkan support to Nix flake

17 months agoVulkan Intel Fixes, Optimizations and Debugging Flags (#5301)
0cc4m [Sat, 3 Feb 2024 17:15:00 +0000 (18:15 +0100)]
Vulkan Intel Fixes, Optimizations and Debugging Flags (#5301)

* Fix Vulkan on Intel ARC

Optimize matmul for Intel ARC

Add Vulkan dequant test

* Add Vulkan debug and validate flags to Make and CMakeLists.txt

* Enable asynchronous transfers in Vulkan backend

* Fix flake8

* Disable Vulkan async backend functions for now

* Also add Vulkan run tests command to Makefile and CMakeLists.txt

17 months agorefactor : switch to emplace_back to avoid extra object (#5291)
Michael Klimenko [Sat, 3 Feb 2024 11:23:37 +0000 (12:23 +0100)]
refactor : switch to emplace_back to avoid extra object (#5291)

17 months agoYaRN : store rope scaling type as int32_t in memory (#5285)
Jared Van Bortel [Sat, 3 Feb 2024 11:22:06 +0000 (06:22 -0500)]
YaRN : store rope scaling type as int32_t in memory (#5285)

* YaRN : store rope scaling type as int32_t in memory

* llama : store mapped names as const char *

17 months agoreadme : add tenere in the ui tools list (#5284)
BADR [Sat, 3 Feb 2024 11:20:26 +0000 (12:20 +0100)]
readme : add tenere in the ui tools list (#5284)

17 months agoFix im2col with 32fp (#5286)
AidanBeltonS [Sat, 3 Feb 2024 08:11:37 +0000 (08:11 +0000)]
Fix im2col with 32fp (#5286)

17 months agoperplexity : fix KL divergence calculations on Windows (#5273)
kalomaze [Fri, 2 Feb 2024 14:15:30 +0000 (08:15 -0600)]
perplexity : fix KL divergence calculations on Windows (#5273)

17 months agoscripts : parse wtype in server-llm.sh (#5167)
Georgi Gerganov [Fri, 2 Feb 2024 12:23:40 +0000 (14:23 +0200)]
scripts : parse wtype in server-llm.sh (#5167)

* scripts : parse wtype in server-llm.sh

* scripts : fix check for wfile

17 months agopy : add check for '.attn.masked_bias' layers to GPT2model (#5281)
Mirror Azure [Fri, 2 Feb 2024 11:39:09 +0000 (14:39 +0300)]
py : add check for '.attn.masked_bias' layers to GPT2model (#5281)

17 months agoTidy ggml-sycl (#5261)
AidanBeltonS [Fri, 2 Feb 2024 08:39:48 +0000 (08:39 +0000)]
Tidy ggml-sycl (#5261)

* Tidy some code in ggml-sycl

* Remove blank space

* Remove std::printf comments

---------

Co-authored-by: Abhilash Majumder <redacted>
17 months agodocker : add build for SYCL, Vulkan + update readme (#5228)
Xuan Son Nguyen [Fri, 2 Feb 2024 07:56:31 +0000 (08:56 +0100)]
docker : add build for SYCL, Vulkan + update readme (#5228)

* add vulkan dockerfile

* intel dockerfile: compile sycl by default

* fix vulkan dockerfile

* add docs for vulkan

* docs: sycl build in docker

* docs: remove trailing spaces

* docs: sycl: add docker section

* docs: clarify install vulkan SDK outside docker

* sycl: use intel/oneapi-basekit docker image

* docs: correct TOC

* docs: correct docker image for Intel oneMKL

17 months ago[SYCL] get MAX_MEM_ALLOC from device property (#5270)
Meng, Hengyu [Fri, 2 Feb 2024 07:54:14 +0000 (15:54 +0800)]
[SYCL] get MAX_MEM_ALLOC from device property (#5270)

* get max alloc size from device prop

* fix macro typo

17 months ago[SYCL] update guide of SYCL backend (#5254)
Neo Zhang Jianyu [Fri, 2 Feb 2024 07:53:27 +0000 (15:53 +0800)]
[SYCL] update guide of SYCL backend (#5254)

* update guide for make installation, memory, gguf model link,  rm todo for windows build

* add vs install requirement

* update for gpu device check

* update help of llama-bench

* fix grammer issues

17 months agollama : fix memory leak in llama_batch_free (#5252)
Ian Bull [Fri, 2 Feb 2024 07:20:13 +0000 (23:20 -0800)]
llama : fix memory leak in llama_batch_free (#5252)

The llama_batch_init allocates memory for a fixed number of tokens.
However, the llama_batch_free only frees memory for the number of
tokens that were added to the batch.

This change-set uses a null terminated array for the batch seq_id, and
frees all the elements until the nullptr is reached. This change-set
also changes the name of the first parameter from `n_tokens` to
`n_tokens_alloc` to more clearly indicate that this value is the number
of tokens allocated to the batch, not the number of tokens in the batch.

17 months agoadd --no-mmap in llama-bench (#5257)
Neo Zhang Jianyu [Thu, 1 Feb 2024 19:48:53 +0000 (03:48 +0800)]
add --no-mmap in llama-bench (#5257)

* add --no-mmap, show sycl backend

* fix conflict

* fix code format, change print for --no-mmap

* ren no_mmap to mmap, show mmap when not default value in printer

* update guide for mmap

* mv position to reduce model reload

17 months agoVulkan Phi Fix for AMD Proprietary Drivers (#5260)
0cc4m [Thu, 1 Feb 2024 18:25:24 +0000 (19:25 +0100)]
Vulkan Phi Fix for AMD Proprietary Drivers (#5260)

* Replace tanh to avoid NaN in gelu shader on AMD proprietary driver

* Fix another Vulkan CPY buffer size bug

17 months agocuda : fix LLAMA_CUDA_F16 (#5262)
slaren [Thu, 1 Feb 2024 17:30:17 +0000 (18:30 +0100)]
cuda : fix LLAMA_CUDA_F16 (#5262)

17 months agomake : generate .a library for static linking (#5205)
Ali Nehzat [Thu, 1 Feb 2024 15:18:53 +0000 (02:18 +1100)]
make : generate .a library for static linking (#5205)

17 months agollama : support InternLM2 (#5184)
Guoteng [Thu, 1 Feb 2024 09:19:51 +0000 (17:19 +0800)]
llama : support InternLM2 (#5184)

* support InternLM2 inference
  * add add_space_prefix KV pair

17 months agoFix broken Vulkan Cmake (properly) (#5230)
Eve [Wed, 31 Jan 2024 19:21:55 +0000 (19:21 +0000)]
Fix broken Vulkan Cmake (properly) (#5230)

* build vulkan as object

* vulkan ci

17 months agollama : reorder build_orion() at correct place (#5118)
Georgi Gerganov [Wed, 31 Jan 2024 16:47:10 +0000 (18:47 +0200)]
llama : reorder build_orion() at correct place (#5118)

17 months agollama : remove LLAMA_MAX_DEVICES and LLAMA_SUPPORTS_GPU_OFFLOAD (#5240)
Georgi Gerganov [Wed, 31 Jan 2024 15:30:17 +0000 (17:30 +0200)]
llama : remove LLAMA_MAX_DEVICES and LLAMA_SUPPORTS_GPU_OFFLOAD (#5240)

* llama : remove LLAMA_MAX_DEVICES from llama.h

ggml-ci

* Update llama.cpp

Co-authored-by: slaren <redacted>
* server : remove LLAMA_MAX_DEVICES

ggml-ci

* llama : remove LLAMA_SUPPORTS_GPU_OFFLOAD

ggml-ci

* train : remove LLAMA_SUPPORTS_GPU_OFFLOAD

* readme : add deprecation notice

* readme : change deprecation notice to "remove" and fix url

* llama : remove gpu includes from llama.h

ggml-ci

---------

Co-authored-by: slaren <redacted>
17 months agometal : add im2col F32 dst support (#5132)
Georgi Gerganov [Wed, 31 Jan 2024 13:35:41 +0000 (15:35 +0200)]
metal : add im2col F32 dst support (#5132)

17 months agollava : add MobileVLM support (#5132)
JidongZhang-THU [Wed, 31 Jan 2024 13:10:15 +0000 (21:10 +0800)]
llava : add MobileVLM support (#5132)

* New Feature:
    1. Sum_Rows:
        fix cuda kernel overflow
        fix block shape error when nrows too big
    2. Im2Col:
        Support Batch in cuda
        Support f32 to f32 both in cpu && cuda
    3. DepthWiseConv:
        Support by Im2Col && MulMat
    4. Pool_2d:
        Supoort avg pooling in cuda
    5. HardSigmoid:
        Imp in cuda
    6. HardSwish:
        Imp in cuda

* fix tabs instead of spaces

* code clean

* CUDA POOL2D

* ADD POOL2D test case in test-backend-ops.cpp

* code clean

* fix pool2d_kernel

nits

* fix bug in pool2d kernel

* fix avg pooling, count_include_pad

nits

* test-backend-ops : add more pool_2d tests

* cuda : fix warnings and formatting

* ggml : check types in release builds too in pool_2d

* test-backend-ops : remove f16 pool_2d tests

* cuda : more style fixes

* Add assert in ggml_cuda_op_pool2d

* pool2d float padding fallback

* test-backend-ops : add dst_type to im2col

---------

Co-authored-by: slaren <redacted>
17 months agoformat license text, restore apache license by legal suggestion (#5233)
Neo Zhang Jianyu [Wed, 31 Jan 2024 13:04:46 +0000 (21:04 +0800)]
format license text, restore apache license by legal suggestion (#5233)

17 months agoggml : limit n_threads to the max n_tasks (#5238)
slaren [Wed, 31 Jan 2024 12:43:03 +0000 (13:43 +0100)]
ggml : limit n_threads to the max n_tasks (#5238)

17 months agoVulkan Fixes (#5223)
0cc4m [Wed, 31 Jan 2024 10:44:19 +0000 (11:44 +0100)]
Vulkan Fixes (#5223)

* Fix Vulkan F16 models

* Fix Vulkan context shift crash

* Add Vulkan to common.cpp dump_non_result_info_yaml function

* Fix bug in Vulkan CPY op

* Fix small matrix multiplication errors in AMD GPUs on Windows or with amdvlk

Co-authored-by: Engininja2 <redacted>
---------

Co-authored-by: Engininja2 <redacted>
17 months agoFix typos of IQ2_XXS and IQ3_XXS in llama.cpp (#5231)
Yiming Cui [Wed, 31 Jan 2024 03:04:21 +0000 (11:04 +0800)]
Fix typos of IQ2_XXS and IQ3_XXS in llama.cpp (#5231)

17 months agosupport SYCL backend windows build (#5208)
Neo Zhang Jianyu [Wed, 31 Jan 2024 02:38:07 +0000 (10:38 +0800)]
support SYCL backend windows build (#5208)

* support SYCL backend windows build

* add windows build in CI

* add for win build CI

* correct install oneMKL

* fix install issue

* fix ci

* fix install cmd

* fix install cmd

* fix install cmd

* fix install cmd

* fix install cmd

* fix win build

* fix win build

* fix win build

* restore other CI part

* restore as base

* rm no new line

* fix no new line issue, add -j

* fix grammer issue

* allow to trigger manually, fix format issue

* fix format

* add newline

* fix format

* fix format

* fix format issuse

---------

Co-authored-by: Abhilash Majumder <redacted>
17 months agokompute : llama-bench support and ggml_cpu_has_kompute() (#5226)
Jared Van Bortel [Wed, 31 Jan 2024 00:04:37 +0000 (19:04 -0500)]
kompute : llama-bench support and ggml_cpu_has_kompute() (#5226)

17 months agoRevert "server : change deps.sh xxd files to string literals (#5221)"
Georgi Gerganov [Tue, 30 Jan 2024 19:19:26 +0000 (21:19 +0200)]
Revert "server : change deps.sh xxd files to string literals (#5221)"

This reverts commit 4003be0e5feef320f3707786f22722b73cff9356.

17 months agoserver : fix context shift (#5195)
Georgi Gerganov [Tue, 30 Jan 2024 18:17:30 +0000 (20:17 +0200)]
server : fix context shift (#5195)

* server : fix context shift + simplify self-extend

* server : take system_tokens into account

* server : more n_past fixes

* server : rever n_past_se changes

17 months agoserver : change deps.sh xxd files to string literals (#5221)
JohnnyB [Tue, 30 Jan 2024 18:15:05 +0000 (12:15 -0600)]
server : change deps.sh xxd files to string literals (#5221)

* Changed ugly xxd to literals.

HPP files are much more readable as multiline literals rather than hex arrays.

* Dashes in literal variable names.

Replace . and - with _ in file names -> variable names.

* Comment on removing xxd.

XXD-> string literals

* XXD to string literals.

Replaced these unreadable headers with string literal versions using new deps.sh.

17 months agoggml : fix IQ3_XXS on Metal (#5219)
Kawrakow [Tue, 30 Jan 2024 17:15:28 +0000 (19:15 +0200)]
ggml : fix IQ3_XXS on Metal (#5219)

Co-authored-by: Iwan Kawrakow <redacted>
17 months agosync : ggml (#0)
Georgi Gerganov [Tue, 30 Jan 2024 14:21:57 +0000 (16:21 +0200)]
sync : ggml (#0)

17 months agogguf : fix comparison (ggml/715)
Georgi Gerganov [Mon, 29 Jan 2024 19:08:18 +0000 (21:08 +0200)]
gguf : fix comparison (ggml/715)

ggml-ci

17 months ago`ggml_cuda_cpy` support for 4d tensors and float16->float32 upcasting (ggml/686)
John Balis [Mon, 29 Jan 2024 12:37:33 +0000 (06:37 -0600)]
`ggml_cuda_cpy` support for 4d tensors and float16->float32 upcasting (ggml/686)

* added cuda float16->float32 upcasting to ggml_cuda_cpy

* added ability to copy 4d tensors with the cuda backend

* added tests for float16_>float32 upcast and 4d tensor cuda copys

* added 4d copy test for float32->float16 copy

* applied patch suggested by @iamlemec

* simplify cpy tests

---------

Co-authored-by: slaren <redacted>
17 months agogguf : add input validation, prevent integer overflows (ggml/709)
Georgi Gerganov [Mon, 29 Jan 2024 12:00:10 +0000 (14:00 +0200)]
gguf : add input validation, prevent integer overflows (ggml/709)

* gguf : add input validation, prevent integer overflows

ggml-ci

* gguf : fix switch default case

* gguf : sanitize info->n_dims and info->type

ggml-ci

* gguf : assert GGUF_TYPE_SIZE access

ggml-ci

* ggml : assert mallocs are successful

ggml-ci

* gguf : prevent integer overflow

* gguf : sanitize tensor info

ggml-ci

* gguf : stricter limit on the number of items

ggml-ci

17 months agoci : fix yolo URLs + fix metal capture (ggml/712)
Georgi Gerganov [Mon, 29 Jan 2024 11:29:46 +0000 (13:29 +0200)]
ci : fix yolo URLs + fix metal capture (ggml/712)

17 months agometal : add debug capture backend function (ggml/694)
Jack Mousseau [Mon, 29 Jan 2024 09:22:23 +0000 (01:22 -0800)]
metal : add debug capture backend function (ggml/694)

Co-authored-by: Georgi Gerganov <redacted>
17 months agoFaster AVX2 dot product for IQ2_XS (#5187)
Kawrakow [Tue, 30 Jan 2024 13:15:07 +0000 (15:15 +0200)]
Faster AVX2 dot product for IQ2_XS (#5187)

* iq2xs: faster AVX2 dot product

* iq2xs: small AVX2 imrovement

* Speed up computing sign bits in AVX2 iq2_xs dot product

---------

Co-authored-by: Iwan Kawrakow <redacted>
Co-authored-by: Peter Reid <redacted>
17 months agoSOTA 3-bit quants (#5196)
Kawrakow [Tue, 30 Jan 2024 13:14:12 +0000 (15:14 +0200)]
SOTA 3-bit quants  (#5196)

* iq3_xxs: quantize/dequantize

RMSE seems a bit high-ish at about half-way between q2_K and
q3_K, so need to check more.

* iq3_xxs: CUDA dequantize works

* iq2_xxs: tuning quantization

* iq3_xxs: starting to look better

PPL on wiki.test.raw
LLaMA-v1-7B: 6.4218
LLaMA-v2-7B: 6.3560
Mistral-7B : 6.0717

This is better than Q3_K_XS, with a 5% reduction in quantized model
size.

* iq3_xxs: CUDA dot product

We have
PP-512: 5891 t/s
TG-128: 143.9 t/s

* iq3_xxs: scalar and AVX2 dot products

* iq3_xxs: ARM_NEON and Metal

Metal performance is decent, ARM_NEON is pathetic

* iq3_xxs: slightly better grid points

* Faster iq3_xxs and iq2_xs dot products on CUDA

* iq3_xxs: add some quant mix

* iq3_xxs: fix failing quantization test

Dot product still fails. Is this real?

* iq3_xxs: hopefully fix ROCm

* iq3_xxs: failing tests

This time the dot product accuracy did find an actual bug
in the AVX2 implementation.

* Add IQ3_XXS to test-backend-ops

---------

Co-authored-by: Iwan Kawrakow <redacted>
17 months agoVulkan Windows APU Memory Handling (#5199)
0cc4m [Tue, 30 Jan 2024 12:59:30 +0000 (13:59 +0100)]
Vulkan Windows APU Memory Handling (#5199)

* Add basic UMA memory handling

Improve memory OOM behavior

Fix tests

* Fix UMA handling

* Also fix UMA handling for prealloc buffers

* Remove unnecessary warning message

* Remove outdated comment

17 months agoquantize : fix typo (#5211)
Vladimir Malyutin [Tue, 30 Jan 2024 10:57:07 +0000 (17:57 +0700)]
quantize : fix typo (#5211)

Fix misprint in quantize help

17 months agomain : allow empty --prompt-cache file (#5176)
divinity76 [Tue, 30 Jan 2024 09:18:02 +0000 (10:18 +0100)]
main : allow empty --prompt-cache file (#5176)

* allow empty --prompt-cache file

This allows the use of std::tmpnam(), std::tmpfile(), Python's tempfile.NamedTemporaryFile(), and similar create-empty-file API's for the user.

I switched from the C fopen API to the C++ filesystem api to get around the fact that, to the best of my knowledge, C has no portable way to get the file size above LONG_MAX, with std::ftell() returning long? fallback to std::ifstream for c++  < 17
(the project is currently targeting C++11 it seems - file_exists() and file_size() can be removed when we upgrade to c++17)

* formatting

(requested in codereview)

* remove c++17, file_is_empty

17 months agoreadme : minor (#5204)
Romain Neutron [Tue, 30 Jan 2024 09:16:38 +0000 (10:16 +0100)]
readme : minor (#5204)

This is about tuning the code formatting of the README file

17 months agoreadme : update hot topics
Georgi Gerganov [Tue, 30 Jan 2024 09:14:44 +0000 (11:14 +0200)]
readme : update hot topics

17 months agoserver : improve README (#5209)
Wu Jian Ping [Tue, 30 Jan 2024 09:11:46 +0000 (17:11 +0800)]
server : improve README (#5209)

17 months agoggml alloc: Fix for null dereference on alloc failure (#5200)
Paul Tsochantaris [Mon, 29 Jan 2024 22:19:29 +0000 (22:19 +0000)]
ggml alloc: Fix for null dereference on alloc failure (#5200)

* Fix for a null pointer dereference if a metal GGML buffer fails to be allocated

* Freeing the allocated buffers rather than the pointer in ggml-alloc.c

* Fixed the fix of the fix

17 months agokompute : fix fallback to CPU (#5201)
Jared Van Bortel [Mon, 29 Jan 2024 22:11:27 +0000 (17:11 -0500)]
kompute : fix fallback to CPU (#5201)

17 months agoNomic Vulkan backend (#4456)
Jared Van Bortel [Mon, 29 Jan 2024 20:50:50 +0000 (15:50 -0500)]
Nomic Vulkan backend (#4456)

Signed-off-by: Jared Van Bortel <redacted>
Co-authored-by: niansa <redacted>
Co-authored-by: Adam Treat <redacted>
Co-authored-by: Aaron Miller <redacted>
Co-authored-by: ToKiNoBug <redacted>
Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: slaren <redacted>
17 months agofix typo "RLIMIT_MLOCK" (#5175)
divinity76 [Mon, 29 Jan 2024 14:45:41 +0000 (15:45 +0100)]
fix typo "RLIMIT_MLOCK" (#5175)

17 months agoserver : embeddings compatibility for OpenAI (#5190)
Wu Jian Ping [Mon, 29 Jan 2024 13:48:10 +0000 (21:48 +0800)]
server : embeddings compatibility for OpenAI (#5190)

17 months agopy : fix except (#5194)
Georgi Gerganov [Mon, 29 Jan 2024 13:35:54 +0000 (15:35 +0200)]
py : fix except (#5194)

ggml-ci

17 months agopy : improve BPE tokenizer support (#5189)
Sang-Kil Park [Mon, 29 Jan 2024 09:24:19 +0000 (18:24 +0900)]
py : improve BPE tokenizer support (#5189)

17 months agoggml : add max buffer sizes to opencl and metal backends (#5181)
slaren [Mon, 29 Jan 2024 08:05:13 +0000 (09:05 +0100)]
ggml : add max buffer sizes to opencl and metal backends (#5181)

17 months agocmake : fix Vulkan build (#5182)
Eve [Mon, 29 Jan 2024 08:04:47 +0000 (08:04 +0000)]
cmake : fix Vulkan build (#5182)

17 months agometal : free metal objects (#5161)
Paul Tsochantaris [Sun, 28 Jan 2024 19:50:16 +0000 (19:50 +0000)]
metal : free metal objects (#5161)

* Releasing MTLFunction references after Metal pipeline construction

* Keeping the `ggml_metal_kernel` structure

* Spacing fix

* Whitespace fix

17 months agosync : ggml
Georgi Gerganov [Sun, 28 Jan 2024 17:48:05 +0000 (19:48 +0200)]
sync : ggml

17 months agoggml : minor type fix (int64_t -> size_t)
Georgi Gerganov [Sun, 28 Jan 2024 16:44:58 +0000 (18:44 +0200)]
ggml : minor type fix (int64_t -> size_t)

17 months agoggml : add Vulkan backend (#2059)
0cc4m [Sun, 28 Jan 2024 17:03:59 +0000 (18:03 +0100)]
ggml : add Vulkan backend (#2059)

* Vulkan loader code

* Fix matmul kernel, continue implementation

* Continue implementation

* Vulkan memory management

* Vulkan development

* Matmul call

* Add aligned malloc and free for VMA

* Continue implementation

* First matmul success

* GEMM Kernel optimization

* 1D Blocktiling

* 2D Blocktiling

* Write coalescing

* Continue vulkan implementation and optimization

* First FP16 attempt, disabled for now

* Code abstraction, FP16 implementation, fix kernel, add FP16 to FP32 kernel

* Enable device extensions properly, restore fp16 matmul op

* Fix mulmat_f16

* Output FP32 in fp16 matmul shader

* Fix f16_to_f32 kernel

* dequant_q4_0 kernel

* Add VMA library

* Avoid requesting dedicated memory, VMA can decide that by itself

* Add bounds checking to matmul kernels, improve implementation, fix command buffers not freed properly

* add cmake commands

* Add 2d write operation, profiling code

* Fix 2d write

* Fix queue selection for AMD RADV

* Fix trailing whitespace in vk_mem_alloc.h

* Add WIP warp tile mat mul shaders

* Disable glslc optimization

* Disable glslc optimization for CMake

* Optimize warptile matmul shader, replace blocktile with it

* Add split-k optimization for small matrix multiplication

Use semaphores for synchronization instead of fences or waitidle

Rework async write/read for synchronization

* Fix validation errors, improve compatibility with AMD GPUs

* Rework command buffer handling

* Variable matmul kernel using specialization constants

* Fix synchronization on AMD, add barriers for buffer ownership transfer, add debug flag and prints

* Reuse semaphores

* Handle stage flags during command buffer submission properly

* Increase matmul test runs for consistent results

* Fix F32 matmul

* Add vectorized loading and zeropadding for matrix multiplication

* Use pinned memory for f16 preprocessing

* Don't force aligned matmul

* Don't free before queue done

* Replace VMA library with native Vulkan buffer management

* Basic offloading support with mul_f32 and dmmv for q4_0

* Run glslc commands in parallel

* Unroll loops in dmmv shader

* Reduce usage of waitIdle

* Reuse pinned allocation for f16 conversion

* Handle devices with only a single queue

* Fix trailing whitespace in CMakeLists.txt

* Allow parallel execution of kernels, parallelize third and fourth dimension calls

* Add fallback for devices only supporting one DescriptorSet per DescriptorPool

* Move to graph function similar to CUDA implementation

* Use F16 kernel for most things, replace q_f32 with mul_mat_q_f16 function

* Add F32 dmmv shaders

* Batch submissions

* Add .spv to gitignore

* Split off matrix vector multiplication for separate optimization

* Use single command buffer for matrix vector multiplication ops

* Reduce overhead of mul_f32 calls by using a single command buffer

* Add submission batching to mul_f32

* Fix tests

* Add missing barrier

* Add further missing barrier

* Add further ops

* Replace vk::QueueFamilyIgnored with VK_QUEUE_FAMILY_IGNORED to support more Vulkan header versions

* Remove unnecessary cblas link

* Fix descriptor set pre-allocation assert

* Add runtime shader compilation, start transferring shaders to this approach

* Transfer remaining shaders to header and compile on runtime

* Fix fp32 fallback if device doesn't support fp16, add force disable env var GGML_VULKAN_DISABLE_F16

* Add support for q4_1, q5_0, q5_1 and q8_0

* Remove unnecessary scalar layout extension

* Parse graph early to pre-record command buffers

* Add q6_k support

* Add multi-submit for command buffers

* Fix q6_k dequant shader for AMD

* Fix q6_k for GPUs without fp16 support

* Simplify q6_k fp16 fix

* Minor fixes

* Fix wg_denom of m-mulmat shaders

* Add Python-based Vulkan shader generator

* Replace shaderc dependency with precompiled shaders

Fix python script to generate shaders

* Clean up code

* Fix shader generator script Windows compatibility

Co-authored-by: Concedo <redacted>
* Close file before deletion

* Fix vulkan shader fp32 name

* Add q2_k and q3_k support

Add validation check to compare shader results to cpu results

* Add q4_k support

* Add q5_k support

* Bake SPIR-V bytecode into the library instead of loading shaders from file

* Switch to signal semaphores for flexibility

Prepare broadcasting support for mul mat

* Finish broadcasting mul mat support for GQA

* Clean up unused functions

Add repeat op

* Add further ops, not yet enabled. Improve semaphore code

* Reduce number of used semaphores by utilizing timelines more properly

* Remove queue information

* Reuse timeline semaphores, allow parallel operation with binary semaphores to work around nvidia driver limitations

* Add Vulkan to llama-bench

* Remove cblas dependency

* Fix matmul k-split bug

* Fix q4_k dmmv K_QUANTS_PER_ITERATION 1 shader

* Add RMS Norm shader, rework op_f32 shader setup, fix matmul bug

* Fix issues with float16 overflows in shaders

* Fix issues with older Vulkan headers on Ubuntu 22.04

* Allow multi-op partial offloading by parsing the graph to preallocate enough between-op buffers

* Implement further ops, rework op_f32 calls, fix bugs

* Finish full offloading support, add last remaining ops, fix bugs, remove redundant code

* Upload generated file ggml-vulkan-shaders.hpp, remove redundant shaders

* Merge upstream changes, fix conflicts, adapt soft_max op

* Fix Python and shader header format

* Free model gpu buffers on exit

* Use single queue per device to simplify code

* Add matmul shader support for running multiple calculations in parallel

* Switch from semaphore-synchronized multiple command buffers per op to single command buffer for multiple ops, whole graph if possible

* Fix missing event cast

* Replace uint64_t(-1) with UINT64_MAX, rename function for clarity

* Fix warning about empty C function parameters

* Fix compiler warnings

* Properly implement Vulkan backend buffer handling

* Fix oversized host staging buffers

* Simplify barrier synchronization calls

* Fix gcc warnings

* Implement max_size for backend buffer types to limit the size of a single allocation

* Use min of maxMemoryAllocationSize and maxBufferSize for device max allocation size

* refactor multi buf

* Disable unsupported ops to fix tests

* Check for maintenance4 support before using it

* Handle devices with only a single queue

* Fix single queue logic

* propagate buffer usage in multi buffers

* Implement rope_neox op

* Cleanup header and other files

* Simplify gpu_extras by removing events and putting staging memcpys into contexts

* Move queue into context

Add not-yet-enabled async backend ops

* Simplify context use, optimize matmul shader for warp size 64 (AMD GCN), fix split_k matmul shader optimization

* Add get_max_size to SYCL backend.

Co-authored-by: Georgi Gerganov <redacted>
* llama : fix trailing whitespace

---------

Co-authored-by: Henri Vasserman <redacted>
Co-authored-by: Concedo <redacted>
Co-authored-by: slaren <redacted>
Co-authored-by: Georgi Gerganov <redacted>
17 months agoggml : add unified SYCL backend for Intel GPUs (#2690)
Abhilash Majumder [Sun, 28 Jan 2024 15:56:23 +0000 (21:26 +0530)]
ggml : add unified SYCL backend for Intel GPUs (#2690)

* first update for migration

* update init_cublas

* add debug functio, commit all help code

* step 1

* step 2

* step3 add fp16, slower 31->28

* add GGML_LIST_DEVICE function

* step 5 format device and print

* step6, enhance error check, remove CUDA macro, enhance device id to fix none-zero id issue

* support main device is non-zero

* step7 add debug for code path, rm log

* step 8, rename all macro & func from cuda by sycl

* fix error of select non-zero device, format device list

* ren ggml-sycl.hpp -> ggml-sycl.h

* clear CMAKE to rm unused lib and options

* correct queue: rm dtct:get_queue

* add print tensor function to debug

* fix error: wrong result in 658746bb26702e50f2c59c0e4ada8e9da6010481

* summary dpct definition in one header file to replace folder:dpct

* refactor device log

* mv dpct definition from folder dpct to ggml-sycl.h

* update readme, refactor build script

* fix build with sycl

* set nthread=1 when sycl, increase performance

* add run script, comment debug code

* add ls-sycl-device tool

* add ls-sycl-device, rm unused files

* rm rear space

* dos2unix

* Update README_sycl.md

* fix return type

* remove sycl version from include path

* restore rm code to fix hang issue

* add syc and link for sycl readme

* rm original sycl code before refactor

* fix code err

* add know issue for pvc hang issue

* enable SYCL_F16 support

* align pr4766

* check for sycl blas, better performance

* cleanup 1

* remove extra endif

* add build&run script, clean CMakefile, update guide by review comments

* rename macro to intel hardware

* editor config format

* format fixes

* format fixes

* editor format fix

* Remove unused headers

* skip build sycl tool for other code path

* replace tab by space

* fix blas matmul function

* fix mac build

* restore hip dependency

* fix conflict

* ren as review comments

* mv internal function to .cpp file

* export funciton print_sycl_devices(), mv class dpct definition to source file

* update CI/action for sycl code, fix CI error of repeat/dup

* fix action ID format issue

* rm unused strategy

* enable llama_f16 in ci

* fix conflict

* fix build break on MacOS, due to CI of MacOS depend on external ggml, instead of internal ggml

* fix ci cases for unsupported data type

* revert unrelated changed in cuda cmake
remove useless nommq
fix typo of GGML_USE_CLBLAS_SYCL

* revert hip cmake changes

* fix indent

* add prefix in func name

* revert no mmq

* rm cpu blas duplicate

* fix no_new_line

* fix src1->type==F16 bug.

* pass batch offset for F16 src1

* fix batch error

* fix wrong code

* revert sycl checking in test-sampling

* pass void as arguments of ggml_backend_sycl_print_sycl_devices

* remove extra blank line in test-sampling

* revert setting n_threads in sycl

* implement std::isinf for icpx with fast math.

* Update ci/run.sh

Co-authored-by: Georgi Gerganov <redacted>
* Update examples/sycl/run-llama2.sh

Co-authored-by: Georgi Gerganov <redacted>
* Update examples/sycl/run-llama2.sh

Co-authored-by: Georgi Gerganov <redacted>
* Update CMakeLists.txt

Co-authored-by: Georgi Gerganov <redacted>
* Update CMakeLists.txt

Co-authored-by: Georgi Gerganov <redacted>
* Update CMakeLists.txt

Co-authored-by: Georgi Gerganov <redacted>
* Update CMakeLists.txt

Co-authored-by: Georgi Gerganov <redacted>
* add copyright and MIT license declare

* update the cmd example

---------

Co-authored-by: jianyuzh <redacted>
Co-authored-by: luoyu-intel <redacted>
Co-authored-by: Meng, Hengyu <redacted>
Co-authored-by: Georgi Gerganov <redacted>