]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
2 years agocmake : add auto detection of BLAS_INCLUDE_DIRS (#1886)
Zenix [Fri, 16 Jun 2023 18:53:04 +0000 (03:53 +0900)]
cmake : add auto detection of BLAS_INCLUDE_DIRS (#1886)

2 years agollama : fix embd when offloading non-repeating layers (#1891)
Johannes Gäßler [Fri, 16 Jun 2023 18:25:51 +0000 (20:25 +0200)]
llama : fix embd when offloading non-repeating layers (#1891)

2 years agoFixed possible macro redefinition (#1892)
FrankHB [Fri, 16 Jun 2023 18:25:01 +0000 (02:25 +0800)]
Fixed possible macro redefinition (#1892)

MinGW libstdc++ may define `NOMINMAX` unconditionally. This fixes the case when it is already defined.

2 years agobuild : fix and ignore MSVC warnings (#1889)
Borislav Stanimirov [Fri, 16 Jun 2023 18:23:53 +0000 (21:23 +0300)]
build : fix and ignore MSVC warnings (#1889)

2 years agoCUDA : faster k-quant dot kernels (#1862)
Kawrakow [Fri, 16 Jun 2023 17:08:44 +0000 (20:08 +0300)]
CUDA : faster k-quant dot kernels (#1862)

* cuda : faster k-quant dot kernels

* Imrove Q2_K dot kernel on older GPUs

We now have a K_QUANTS_PER_ITERATION macro, which should be
set to 1 on older and to 2 on newer GPUs.
With this, we preserve the performance of the original
PR on RTX-4080, and are faster compared to master on
GTX-1660.

* Imrove Q6_K dot kernel on older GPUs

Using the same K_QUANTS_PER_ITERATION macro as last commit,
we preserve performance on RTX-4080 and speed up
Q6_K on a GTX-1660.

* Add LLAMA_CUDA_KQUANTS_ITER to CMakeLists.txt and Makefile

Allowed values are 1 or 2. 2 gives the best performance on
modern GPUs and is set as default. On older GPUs 1 may work
better.

* PR comments

---------

Co-authored-by: Iwan Kawrakow <redacted>
2 years agogitignore : add several entries specific to Visual Studio (#1888)
Borislav Stanimirov [Fri, 16 Jun 2023 06:58:11 +0000 (09:58 +0300)]
gitignore : add several entries specific to Visual Studio (#1888)

2 years agoFixed CUDA runtime version check (#1879)
Johannes Gäßler [Thu, 15 Jun 2023 19:49:08 +0000 (21:49 +0200)]
Fixed CUDA runtime version check (#1879)

2 years agocmake : remove whitespaces
Georgi Gerganov [Thu, 15 Jun 2023 18:56:50 +0000 (21:56 +0300)]
cmake : remove whitespaces

2 years agoexamples : add chat-vicuna.sh (#1854)
yangli2 [Thu, 15 Jun 2023 18:05:53 +0000 (11:05 -0700)]
examples : add chat-vicuna.sh (#1854)

Co-authored-by: Yang Li <redacted>
2 years agocmake : set include path for OpenBlas (#1830)
Igor Okulist [Thu, 15 Jun 2023 17:51:26 +0000 (12:51 -0500)]
cmake : set include path for OpenBlas (#1830)

2 years agoswift : Package compile breaks due to ggml-metal.metal (#1831)
Frederik Vogel [Thu, 15 Jun 2023 17:47:04 +0000 (02:47 +0900)]
swift : Package compile breaks due to ggml-metal.metal (#1831)

* Ignore metal file in spm

* Add ggml.h to spm public Headers

---------

Co-authored-by: Vogel Frederik <redacted>
2 years agomake : add train-text-from-scratch (#1850)
daboe01 [Thu, 15 Jun 2023 17:42:48 +0000 (19:42 +0200)]
make : add train-text-from-scratch (#1850)

* make finetuning example accessible

* fixed: targed was in wrong line

* fixed: name of executable was wrong

* fixed: naming of binary

* fixed: model path was wrong

* fixed clean target

* Update examples/train-text-from-scratch/README.md

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoreadme : server compile flag (#1874)
Srinivas Billa [Thu, 15 Jun 2023 17:36:38 +0000 (18:36 +0100)]
readme : server compile flag (#1874)

Explicitly include the server make instructions for C++ noobsl like me ;)

2 years agomake : clean *.so files (#1857)
sandyiscool [Thu, 15 Jun 2023 17:36:06 +0000 (23:06 +0530)]
make : clean *.so files (#1857)

2 years agoFix the validation of main device (#1872)
Howard Su [Thu, 15 Jun 2023 17:29:59 +0000 (01:29 +0800)]
Fix the validation of main device (#1872)

2 years agometal : parallel command buffer encoding (#1860)
Georgi Gerganov [Thu, 15 Jun 2023 17:29:48 +0000 (20:29 +0300)]
metal : parallel command buffer encoding (#1860)

* metal : parallel command buffer encoding

* metal : determine number of command buffers based on gf->n_threads

2 years agoBetter error when using both LoRA + GPU layers (#1861)
Johannes Gäßler [Thu, 15 Jun 2023 17:06:46 +0000 (19:06 +0200)]
Better error when using both LoRA + GPU layers (#1861)

2 years agoCUDA full GPU acceleration, KV cache in VRAM (#1827)
Johannes Gäßler [Wed, 14 Jun 2023 17:47:19 +0000 (19:47 +0200)]
CUDA full GPU acceleration, KV cache in VRAM (#1827)

* Fixed CUDA RoPE

* ggml_cuda_mul_mat_vec_p021

* ggml_cuda_scale

* ggml_cuda_diag_mask_inf

* ggml_is_permuted

* ggml_cuda_cpy

* flatten rows for ggml_cuda_op

* Added a --low-vram option

* Fixed Windows performance

* Fixed LLAMA_CUDA_DMMV_Y > 1 for WizardLM

2 years agobaby-llama : fix operator!= (#1821)
0xspringtime [Tue, 13 Jun 2023 19:37:54 +0000 (15:37 -0400)]
baby-llama : fix operator!= (#1821)

* Update baby-llama.cpp

Seems to be an error in the implementation of the operator!= function. It attempts to compare the this pointer (a llama_hparams_lora object) with the other pointer (a llama_hparams object) using memcmp. This can lead to incorrect results because the sizes of the objects being compared (sizeof(llama_hparams) and sizeof(llama_hparams_lora)) are different, should now be able to compare two llama_hparams_lora objects for inequality.

* Update baby-llama.cpp

* Update baby-llama.cpp

2 years agotrain : improved training-from-scratch example (#1652)
xaedes [Tue, 13 Jun 2023 19:04:40 +0000 (21:04 +0200)]
train : improved training-from-scratch example (#1652)

* add python wrapper

https://gist.github.com/abetlen/2b90e5f153f6efd00931d098de5c73ce

* fix decoding error. adds errors=ignore parameter

* add python bindings for functions to get and set the whole llama state
(rng, logits, embedding and kv_cache)

* update python bindings

* add text generating baby-llama from scratch example

* fix race condition bug in ggml_compute_forward_diag_mask_f32

* implement ggml_soft_max_back for more performant backward pass of soft_max

avoids creating big intermediate matrices of size n_embd x n_embd for llama layers and n_vocab x n_vocab for cross entropy loss

* improve softmax backward pass

go from quadratic runtime to linear runtime by simplifying the formulas

* fix race condition bug in non-inplace ggml_compute_forward_diag_mask_f32

memcpy needs to be synchronized across threads to avoid race conditions.
=> do it in INIT phase

* fix bug in ggml_compute_forward_soft_max_back_f32 on DEBUG build

* improve performance of mul_mat backward pass

avoid transpose by using mul_mat with swapped arguments

* avoid printing too much newlines in baby-llama-text

* activate threading in baby-llama-text

* add ggml_out_prod and use it for mul_mat backward pass for improved performance

performance stats report improvement from 37 seconds to 16 seconds runtime during my training tests

* better weight initialization improves training convergence at start

* better weight initialization improves training convergence at start

* improve ggml_out_prod performance

- change iteration order (>15s -> 10s runtime)
- parallelize over one more dimension: over dst matrix rows (10s -> <5s runtime)

* add llama sampler, shuffle samples and constrain sampling to tokens occurring in train data

* fix get_samples call, add model tensor names, increase model size, start training samples after newline

* save train trained model to checkpoint and load model to be trained from checkpoint

* use inplace functions where possible

* initialize rng with srand

* use different arguments for input and output checkpoint

* ggml fixes to support backward pass on inplace operations

* remove duplicate include

* fix cross entropy loss

- add target probabilities for each sample which is then used in cross entropy loss

* print used memory before and after optimization

* sample with non-greedy sampling parameters at the end of training

* add cmake target for baby-llama-text

* add ggml_add1_inplace to header

* enable gradient propagation for inplace add1 and scale operations

those functions backward passes don't need the original src0, so they also work when forward is inplace

* implement AdamW in ggml_opt_adam by adding weight decay parameter (default 0.001f)

also add a schedule parameter (default 1.0f) that can be used to scale alpha and decay according to learning schedule.
setting the decay parameter to zero disables AdamW resulting in normal Adam optimizer.

since the difference between Adam and AdamW is minimal it is not implemented as another optimizer, but integrated into the existing Adam optimizer.

* use inplace operations in cross_entropy_loss

* fix random weight initialization scale

* add missing default parameters for adam optimizer

* add ggml_opt_context, so that we can properly resume training

otherwise the optimizer states, tracking statistics about the error function and its derivates,
will reset to zero each time ggml_opt is called, hindering convergence on resumed training.

now the optimizer context and all its memory is stored in a separate struct.

* fix bug in llama_sample_token_mirostat_v2

when all candidates are filtered out through mu threshold, the following soft_max operation will fail.
so keep at least one.

* add forward function without using cache, for more performant training

during training on whole samples no cache is required.
removing the cache and simplifying the remaining code results in performance and memory usage improvement.

* print suppressed newline tokens as string "\n"

printing too much actual newlines is suppressed to avoid flooding the console.

* store optimizer state in training checkpoint and add learning schedule

persistent optimizer state allows to resume training without resetting the optimizer
learning schedule consists of linear warmup ramp followed by cosine decay with restarts

* remove unused functions

* fix bug in get_samples which corrupted training targets

* save checkpoint only when it was trained

* simplify code

* remove trailing whitespace

* simplify backward pass for SQRT

* replace inefficient repeat backward pass with dedicated repeat_back operation

* add ggml_cross_entropy_loss with backward pass for faster training

cross entropy loss can also be implemented using softmax and log, but as dedicated operation it is faster and especially avoids unnecessary memory overhead.

* add tests for cross_entropy_loss backward pass

finite differences regularly results in estimated gradient of zero, despite the backward pass giving non zero gradient.
_probably_ the finite differences fails due to numerical issues

* use ggml_cross_entropy_loss in text training example

* remove trailing whitespace

* slightly improve how cross entropy loss is compute

btw: directly implemented cross entropy loss seems to have way lower magnitudes than when implemented with softmax and log.
probably the input to log gets closer to zero due to float numerics.
maybe the multiplication by (1.0-eps)/sum is more accurate..

* add llama_get_vocab to get the vocabulary as output parameters

* set default model.type for unknown models with few layers

* add export of training checkpoint to llama compatible model file

* get vocabulary for exporting training checkpoint to llama compatible model file

* implement backward pass of flash attention

* bugfixes for backward pass of flash attention

* test flash attention backward pass

need to set loose error bounds to pass.
the finitie differences are close to numeric limits and often return quite different values than the backward pass.
reducing eps further lets the gradients vanish completely.
likewise setting eps to big results in wronger values.
the softmax in the middle of the function is probably the most responsible for the numeric issues using finite differences.

* add option to train with flash attention and move options to the top of the main function

training from scratch also works with flash attention
training convergence and generation results after fix number of iterations are worse than when not using flash attention.
maybe there still lingers a bug in the flash attention backward pass?
but training works, just with slower convergence.

flash attention is still worth to use, because it requires way less memory and is faster with high n_ctx

* add train_params and command line option parser

* remove unnecessary comments

* add train params to specify memory size

* remove python bindings

* rename baby-llama-text to train-text-from-scratch

* replace auto parameters in lambda function

* add #include <climits>

* add explicit cast to fix compile error

"error: non-constant-expression cannot be narrowed from type 'int64_t' (aka 'long long') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]"

* remove trailing whitespace

* add ggml_opt_resume_g which accepts forward and backward cgraphs

* fix formulas in comments

* bug fix for ggml_compute_forward_get_rows_back_f32

the result should be set to zero, not to whatever data is in opt0

* improve training memory usage with scratch buffers

instead of relying on the automatic backward pass, we manually create the graph for the backward pass.
it turns out that all backward pass operations need only temporary memory which can be reused after each layer.

will compute backward pass for ALL model parameters

* add option to use scratch buffers in training or not

make it configurable because currently training with scratch buffers implies flash attention and optimization over all parameters.

* ci : disable temporary

* store view offset and permute axes in opt[0] instead of storing it in padding

use memcpy to store offset, because offset is of type size_t.
when storing it as int32_t offset would have to be smaller than 2^31 which is not necessarily true.

* minor : fix compile warnings + minor style changes

* fix bug in threaded indices calculation of ggml_compute_forward_flash_attn_back_f32

* store view offset like in master branch

* bug fix in forward_batch_wo_cache_flash_attn_train

* scratch buffer bug fixes in forward_batch_wo_cache_flash_attn_train

data of permute and reshape is the same as their input.
if we want to preserve the output of permute/reshape, we also need to preserve their inputs.

replace reshape(src0, src1) with reshape_nd calls so that we don't need src1.

replace (temporary) t03 with ggml_repeat(ctx0, layer.attention_norm, t02).
in the future we could also use the new broadcasting ggml_mul to avoid these repeat calls.
for this we need backward pass of broadcasting ggml_mul.

* remove unnecessary scratch buffer 0

buf 0 is persistent memory, so we can just disable scratch for this by using buf -1

* avoid creating unnecessary grad tensors

previously we need to create grads for model parameters, so that expand(..) correctly populates cgraph->leafs & cgraph->grads
this wasted memory, because unnecessary grad for each op were automatically created:
the automatically generated grad was unnecessary because we later manually set the grad (e.g. t35->grad = expand(gb, ...) ).
this discarded the automatically generated grad resulting in wasted memory.

improved this by changing expand(..) to not use ggml_build_forward_expand.
expand set cgraph->nodes but not the leafs.
cgraph->leafs & cgraph->grads are set in another pass after the last expand call.

* print used training seed

* zero initialize gfbuf and gbbuf

* ci : re-enable workflows + add README for training

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agollama : do a warm-up eval at start for better timings (#1824)
Georgi Gerganov [Tue, 13 Jun 2023 17:20:07 +0000 (20:20 +0300)]
llama : do a warm-up eval at start for better timings (#1824)

2 years agoAllow "quantizing" to f16 and f32 (#1787)
Kerfuffle [Tue, 13 Jun 2023 10:23:23 +0000 (04:23 -0600)]
Allow "quantizing" to f16 and f32 (#1787)

* Allow "quantizing" to f16 and f32

Fix an issue where quantizing didn't respect LLAMA_NO_K_QUANTS

Add brief help to the list of quantization types in the quantize tool

Ignore case for quantization type arguments in the quantize tool

2 years agoMetal implementation for all k_quants (#1807)
Kawrakow [Mon, 12 Jun 2023 19:39:21 +0000 (22:39 +0300)]
Metal implementation for all k_quants (#1807)

* metal : improve q4_K

28.3 -> 26.0 ms/token by avoiding a branch in the
calculation of the scales.

* metal : small improvement for Q4_K

* metal : still optimizing Q4_K

This commit pushes it down to 25.3 ms / token.

The crazy idea of using 6 bits for the scales is really costly on
Metal: if I remove the bit fiddling necessary to make the block
scales, time goes almost to the Q4_0 23 ms/token.

Before pushing the k-quants upstream I had a Q4_K variant that
had used 8-bit scales. It wasn't more accurate, used 0.125 bits more per weight,
was running slightly slower on the CPU (due to the larger model size
and being memory bound there), and the difference was entirely
negligible under CUDA. So, I decided to publish the version with 6-bit
scales. Perhaps I should re-consider and change to 8-bit scales?

* metal : some more optimizations

Q2_K: 25.4 ms/token
Q6_K: 27.3 ms/token
Q4_0: 22.8 ms/token
Q4_1: 23.1 ms/token

* metal : Q3_K support

Something is not quite right yet.

* metal : Q5_K support

Initial version achieves 31.2 ms/token, 210 GB/s

* metal : still not able to figure out why q3_K does not work

* Minor

* metal : yet another failed attempt to make q3_K work

* metal : optimize Q5_K

31.2 ms -> 27.8 ms.
250 GB/s.

* metal : q3_K still not working

Adding a heavily commented q3_K metal kernel to explain
my obviously faulty logic. Perhaps someone could spot the issue?

* metal : q3_K finally working

Not optimized at all.

What was the issue? The scales are not 4-bytes aligned,
and I was accessing them with a uint32_t pointer.
When I tried that on CUDA, I got an error (illegal memory access)
and added a memcpy to a local array of 3 uint32_t's.
But on Metal it told me there is no memcpy, so I tried
accessing directly. There is no error, just garbage results.
At some point I did try accessing the scales with an uint16_t
pointer (the scales are for sure 2-byte aligned), but was
still getting garbage. I guess, there must have been another bug.

No access to scales is via a uint16_t pointer and, after starting
from scratch from the C dequantize function, it finally works.

* metal : Q3_K 1st optimization pass

* metal : Q3_K second optimization pass - 29.6 ms/token

* metal : Q3_K cleanup

* metal : fixed accidentally broken Q2_K

---------

Co-authored-by: Iwan Kawrakow <redacted>
2 years agoci : run when changing only the CUDA sources (#1800)
slaren [Mon, 12 Jun 2023 17:12:47 +0000 (19:12 +0200)]
ci : run when changing only the CUDA sources (#1800)

2 years agoLeverage mmap for offloading tensors to GPU (#1597)
Howard Su [Mon, 12 Jun 2023 12:44:16 +0000 (20:44 +0800)]
Leverage mmap for offloading tensors to GPU (#1597)

* Rebase to latest

* Show progress

* Add assert to make sure we only allocate temp buffer for non-CPU backend tensor

Co-authored-by: Johannes Gäßler <redacted>
---------

Co-authored-by: Johannes Gäßler <redacted>
2 years agometal : fix failure to load model (#1817)
Kawrakow [Mon, 12 Jun 2023 11:31:36 +0000 (14:31 +0300)]
metal : fix failure to load model (#1817)

The number of buffers in the ggml context was left unitialized.
This leads to sporadic failures to load the model on
startup. It is actually strange that the failure occurred so
infrequantly.

Co-authored-by: Iwan Kawrakow <redacted>
2 years agoFix issue where interactive mode crashes when input exceeds ctx size (#1789)
Kerfuffle [Sun, 11 Jun 2023 14:19:17 +0000 (08:19 -0600)]
Fix issue where interactive mode crashes when input exceeds ctx size (#1789)

* Fix issue where interactive mode in the main example crashes when input exceeds ctx size

* Ensure the context size is at least 8 tokens in the main example.

Closes #1768

2 years agoFixed WSL cuda's OOM error (#1594)
Kyle Liang [Sun, 11 Jun 2023 13:20:52 +0000 (21:20 +0800)]
Fixed WSL cuda's OOM error (#1594)

* In the function , add the cuda error bypass.

* remove excessive codes and prints

---------

Co-authored-by: liang <redacted>
2 years agoUpdate SHA256SUMS with current hashes for models quantized using q4_0 (#1798)
Ryan Landay [Sun, 11 Jun 2023 09:38:53 +0000 (17:38 +0800)]
Update SHA256SUMS with current hashes for models quantized using q4_0 (#1798)

2 years agocmake : fix Metal build (close #1791)
Georgi Gerganov [Sat, 10 Jun 2023 19:56:53 +0000 (22:56 +0300)]
cmake : fix Metal build (close #1791)

2 years agok-quants : GCC12 compilation fix (#1792)
Artyom Lebedev [Sat, 10 Jun 2023 19:51:36 +0000 (22:51 +0300)]
k-quants : GCC12 compilation fix (#1792)

2 years agometal : fix issue with ggml-metal.metal path. Closes #1769 (#1782)
Andrei [Sat, 10 Jun 2023 14:47:34 +0000 (10:47 -0400)]
metal : fix issue with ggml-metal.metal path. Closes #1769 (#1782)

* Fix issue with ggml-metal.metal path

* Add ggml-metal.metal as a resource for llama target

* Update flake.nix metal kernel substitution

2 years agodoc : fix wrong address of BLIS.md (#1772)
Aisuko [Sat, 10 Jun 2023 14:08:11 +0000 (00:08 +1000)]
doc : fix wrong address of BLIS.md (#1772)

Signed-off-by: Aisuko <redacted>
2 years agoggml : force no_alloc == false when creating opt tensors (close #1699)
Georgi Gerganov [Sat, 10 Jun 2023 09:06:45 +0000 (12:06 +0300)]
ggml : force no_alloc == false when creating opt tensors (close #1699)

This is needed to make operators like ggml_view() be able to store their
parameters in the ggml context's memory and not get discarded when
no_alloc is true

2 years agometal : add Q4_1 implementation (#1785)
Kawrakow [Sat, 10 Jun 2023 08:28:11 +0000 (11:28 +0300)]
metal : add Q4_1 implementation (#1785)

23.3 ms / token, so just ~1% slower than q4_0.
Achieves 290 GB/s memory throughput.

Co-authored-by: Iwan Kawrakow <redacted>
2 years agollama : support requantizing models instead of only allowing quantization from 16...
Kerfuffle [Sat, 10 Jun 2023 07:59:17 +0000 (01:59 -0600)]
llama : support requantizing models instead of only allowing quantization from 16/32bit (#1691)

* Add support for quantizing already quantized models

* Threaded dequantizing and f16 to f32 conversion

* Clean up thread blocks with spares calculation a bit

* Use std::runtime_error exceptions.

2 years agoggml : workaround for missing _mm256_setr_m128i in GCC < 8 (#1638)
Xingchen Song(宋星辰) [Sat, 10 Jun 2023 07:49:40 +0000 (15:49 +0800)]
ggml : workaround for missing _mm256_setr_m128i in GCC < 8 (#1638)

2 years agomake : add SSSE3 compilation use case (#1659)
rankaiyx [Sat, 10 Jun 2023 06:41:59 +0000 (14:41 +0800)]
make : add SSSE3 compilation use case (#1659)

2 years agoOpenCL: Add release memory (#1741)
Robert Sung-wook Shin [Fri, 9 Jun 2023 16:24:40 +0000 (01:24 +0900)]
OpenCL: Add release memory (#1741)

* Add opencl release memory

* Rename function name

2 years agoWindows nvcc workaround (#1753)
Johannes Gäßler [Fri, 9 Jun 2023 11:58:15 +0000 (13:58 +0200)]
Windows nvcc workaround (#1753)

Fix gibberish output on Windows when using CUDA

2 years agometal : fix build "tanhf" -> "tanh"
Georgi Gerganov [Fri, 9 Jun 2023 08:11:04 +0000 (11:11 +0300)]
metal : fix build "tanhf" -> "tanh"

2 years agometal : add GELU implementation (#1770)
AT [Fri, 9 Jun 2023 08:00:51 +0000 (04:00 -0400)]
metal : add GELU implementation (#1770)

Co-authored-by: Adam Treat <redacted>
2 years agometal : faster q4_0 (#1775)
Kawrakow [Fri, 9 Jun 2023 07:39:59 +0000 (10:39 +0300)]
metal : faster q4_0 (#1775)

* metal : 8% faster q4_0

Avoid copying into local uchar4 anf float4.

* metal : 17% faster Q4_0

Use 64 threads in a thread group.

---------

Co-authored-by: Iwan Kawrakow <redacted>
2 years agometal : add Q2_K implementation (#1762)
Kawrakow [Thu, 8 Jun 2023 19:28:21 +0000 (22:28 +0300)]
metal : add Q2_K implementation (#1762)

* metal : add Q2_K implementation

27.1 ms / token on M2 Max 30-core GPU, so about the
same speed as Q4_0. Memory throughput is ~156 GB/s.

The access pattern used in the Q2_K
CUDA implementation resulted in significantly lower
performance (~31 ms/token).

* Fixing merge conflicts

---------

Co-authored-by: Iwan Kawrakow <redacted>
2 years agoRevert "ggml : load data into int8x16x4_t using vld4q_s8 on arm64 (#1738)"
Georgi Gerganov [Thu, 8 Jun 2023 17:48:14 +0000 (20:48 +0300)]
Revert "ggml : load data into int8x16x4_t using vld4q_s8 on arm64 (#1738)"

This reverts commit 8432d4d9f716b25133e3ed671d91e21f6f3be867.

2 years agoggml : load data into int8x16x4_t using vld4q_s8 on arm64 (#1738)
le.chang [Thu, 8 Jun 2023 16:47:56 +0000 (00:47 +0800)]
ggml : load data into int8x16x4_t using vld4q_s8 on arm64 (#1738)

2 years agometal : Q6_K implementation (#1752)
Kawrakow [Thu, 8 Jun 2023 16:46:22 +0000 (19:46 +0300)]
metal : Q6_K implementation (#1752)

* Metal implementation for Q4_K

Very slow for now:
42 ms / token, Q4_0 runs in 28 ms/token on my
30-core M2 Max GPU.

* Optimizing Q4_K on metal

The first token always takes longer, I guess because
the metal kernel is being jit-compiled.
So, using n = 128 to measure time.

At this point Q4_K takes 29.5 ms / token
compared to 27.2 ms / token for Q4_0.
Quite a bit better than the initial attempt,
but still not good enough.

* Optimizing q4_K metal dot some more

For n = 256 it is now 28.1 ms/token compared to
27 ms/token for q4_0.

* Fix after merge with master

* Metal implementation for Q6_K

Similar to the CUDA implementation.
No idea if this is the optimum for Metal, but the few
alternative variants I tried all had a lower performance.

We get 36.5 ms / token on M2 Max with 30 GPU cores.
This corresponds to ~200 GB/second throughput.

* clang-tidy : add config back

* Much better Q6_K implementation for metal

28.3 ms / token for 7B. Subtracting ~9 ms that is spent in
other compute graph operations, we are left with ~19 ms
for the matrix multiplications. The model is ~5.5 GB,
so we are getting 1000 / 19 * 5.5 = 290 GB/s!

---------

Co-authored-by: Iwan Kawrakow <redacted>
2 years agoAdd llama.cpp docker support for non-latin languages (#1673)
qingfengfenga [Thu, 8 Jun 2023 07:58:53 +0000 (15:58 +0800)]
Add llama.cpp docker support for non-latin languages (#1673)

* Modify Dockerfile default character set to improve compatibility (#1673)

2 years agoggml : fix fprintf warnings (#1720)
Steven Roussey [Thu, 8 Jun 2023 07:12:28 +0000 (00:12 -0700)]
ggml : fix fprintf warnings (#1720)

2 years agoclang-tidy : restore dot file from accidental deletion
Georgi Gerganov [Thu, 8 Jun 2023 07:09:08 +0000 (10:09 +0300)]
clang-tidy : restore dot file from accidental deletion

2 years agometal : add Q4_K implementation (#1733)
Kawrakow [Thu, 8 Jun 2023 07:08:23 +0000 (10:08 +0300)]
metal : add Q4_K implementation (#1733)

* Metal implementation for Q4_K

Very slow for now:
42 ms / token, Q4_0 runs in 28 ms/token on my
30-core M2 Max GPU.

* Optimizing Q4_K on metal

The first token always takes longer, I guess because
the metal kernel is being jit-compiled.
So, using n = 128 to measure time.

At this point Q4_K takes 29.5 ms / token
compared to 27.2 ms / token for Q4_0.
Quite a bit better than the initial attempt,
but still not good enough.

* Optimizing q4_K metal dot some more

For n = 256 it is now 28.1 ms/token compared to
27 ms/token for q4_0.

* Fix after merge with master

---------

Co-authored-by: Iwan Kawrakow <redacted>
2 years agok-quants : add missing compile definition to CMakeLists (#1748)
johnson442 [Thu, 8 Jun 2023 07:02:48 +0000 (08:02 +0100)]
k-quants : add missing compile definition to CMakeLists (#1748)

2 years agok-quants : allow to optionally disable at compile time (#1734)
Georgi Gerganov [Wed, 7 Jun 2023 07:59:52 +0000 (10:59 +0300)]
k-quants : allow to optionally disable at compile time (#1734)

* k-quants : put behind optional compile flag LLAMA_K_QUANTS

* build : enable k-quants by default

2 years agoflake : update to support metal on m1/m2 (#1724)
jacobi petrucciani [Wed, 7 Jun 2023 04:15:31 +0000 (00:15 -0400)]
flake : update to support metal on m1/m2 (#1724)

2 years agoreadme : add June roadmap
Georgi Gerganov [Wed, 7 Jun 2023 04:15:08 +0000 (07:15 +0300)]
readme : add June roadmap

2 years agomain: add the possibility to open the prompt cache read-only (#1640)
Willy Tarreau [Wed, 7 Jun 2023 02:10:17 +0000 (04:10 +0200)]
main: add the possibility to open the prompt cache read-only (#1640)

The prompt cache constitutes a nice speed up when using the same prompt
prefix across multiple evaluations, but when using it, it will also be
updated, which is not always desirable. One use case is to have a large
prompt containing some context and usage rules, and a second part
containing variable data of the problem being studied. In this case it's
desirable to be able to save the first part once, and to always reuse it
as-is without updating it with the second part.

The new argument --prompt-cache-ro enables this read-only mode on the
prompt cache. The prompt's contents that match the cache are loaded
from the cache but the rest is not modified. This allowed to reduce a
total analysis time from 112s to 49.7s here, without having to backup
and restore a copy of the prompt, which takes significant time at 500
MB.

Signed-off-by: Willy Tarreau <redacted>
2 years agollama : fix vram_scratch var
Georgi Gerganov [Tue, 6 Jun 2023 19:54:39 +0000 (22:54 +0300)]
llama : fix vram_scratch var

2 years agollama : fix compile warnings
Georgi Gerganov [Tue, 6 Jun 2023 19:41:53 +0000 (22:41 +0300)]
llama : fix compile warnings

2 years agoMulti GPU support, CUDA refactor, CUDA scratch buffer (#1703)
Johannes Gäßler [Tue, 6 Jun 2023 19:33:23 +0000 (21:33 +0200)]
Multi GPU support, CUDA refactor, CUDA scratch buffer (#1703)

* CUDA multi GPU + scratch

ggml_cuda_compute_forward

Tensor parallelism

ggml_cuda_add

ggml_cuda_rms_norm

ggml_cuda_silu

CUDA scratch buffer

--main-gpu CLI option

2 years agometal : add f16 support
Georgi Gerganov [Tue, 6 Jun 2023 17:16:57 +0000 (20:16 +0300)]
metal : add f16 support

2 years agoClblast fixes + enhancements to save VRAM and offload more layers (#1675)
LostRuins [Tue, 6 Jun 2023 17:00:01 +0000 (01:00 +0800)]
Clblast fixes + enhancements to save VRAM and offload more layers (#1675)

* Use events instead of clFinish, where possible

* OpenCL: Don't load gpu layers into RAM, add mul_f32 kernel

* Reduce queueing overhead for contiguous tensors by using single mul kernel call

* Adapt to #1612 cl_mem malloc changes

* Reduce code duplication between cuda and opencl branches

* Improve implementation

* Clblast fixes + enhancements to save VRAM:

1. Change all Clblast buffers to CL_MEM_READ_WRITE, as the pool malloc currently doesn't properly handle them.
2. When recycling buffers in pool malloc, always assign the SMALLEST available buffer that fits, instead of the FIRST available buffer
3. When failing to recycle a buffer in pool malloc (all too small), instead recycle the largest available free buffer by resizing it.

* change max value size_t to use limits

* removed flags from the CL pool malloc, apply code tidying suggestions.

2 years agoggml : fix builds, add ggml-quants-k.o (close #1712, close #1710)
Georgi Gerganov [Tue, 6 Jun 2023 07:18:03 +0000 (10:18 +0300)]
ggml : fix builds, add ggml-quants-k.o (close #1712, close #1710)

2 years agogitignore : add .clang-tidy
Georgi Gerganov [Tue, 6 Jun 2023 06:55:10 +0000 (09:55 +0300)]
gitignore : add .clang-tidy

2 years agollama : temporary disable Q6_K output quantization (#1711)
Georgi Gerganov [Tue, 6 Jun 2023 06:39:38 +0000 (09:39 +0300)]
llama : temporary disable Q6_K output quantization (#1711)

2 years agometal : add checks for buffer size (#1706)
Spencer Sutton [Tue, 6 Jun 2023 03:28:17 +0000 (23:28 -0400)]
metal : add checks for buffer size (#1706)

Co-authored-by: Spencer Sutton <redacted>
2 years agodocs : add performance troubleshoot + example benchmark documentation (#1674)
Yuval Peled [Mon, 5 Jun 2023 20:32:36 +0000 (23:32 +0300)]
docs : add performance troubleshoot + example benchmark documentation (#1674)

* test anchor link

* test table

* add benchmarks

* Add performance troubleshoot & benchmark

* add benchmarks

* remove unneeded line

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoreadme : fix typo (#1700)
Foul-Tarnished [Mon, 5 Jun 2023 20:28:37 +0000 (22:28 +0200)]
readme : fix typo (#1700)

Fix a typo in a command in README.md

2 years agollama : consistently catch and throw only exceptions deriving from std::exception...
mgroeber9110 [Mon, 5 Jun 2023 20:24:29 +0000 (22:24 +0200)]
llama : consistently catch and throw only exceptions deriving from std::exception (#1599)

Co-authored-by: Georgi Gerganov <redacted>
2 years agometal : use shared buffers between CPU and GPU (#1696)
kiltyj [Mon, 5 Jun 2023 20:24:04 +0000 (13:24 -0700)]
metal : use shared buffers between CPU and GPU (#1696)

* Use MTLDevice.newBufferWithBytesNoCopy to share buffers between CPU and GPU

* Page-align buffers used by Metal

* Remove trailing whitespace

* Only import unistd.h for Metal builds

* metal : remove unnecessary copies

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoggml : fix internal overflow in ggml_time_us on Windows (#1702)
grahameth [Mon, 5 Jun 2023 20:11:49 +0000 (22:11 +0200)]
ggml : fix internal overflow in ggml_time_us on Windows (#1702)

Co-authored-by: grahameth <->
2 years agoci : disable auto tidy (#1705)
Georgi Gerganov [Mon, 5 Jun 2023 20:05:05 +0000 (23:05 +0300)]
ci : disable auto tidy (#1705)

2 years agoggml : add SOTA 2,3,4,5,6 bit k-quantizations (#1684)
Kawrakow [Mon, 5 Jun 2023 19:56:18 +0000 (22:56 +0300)]
ggml : add SOTA 2,3,4,5,6 bit k-quantizations (#1684)

* Starting to add k-quantization to ggml

I think it is better to have quantization separate from
ggml. For now just adding the k-quants there, but it would be
better to also factor out the existing ggml quantizations.

* Adding Q3_K and Q8_K (de)-quantization

* Q3_K now working on CUDA and AVX2/scalar

CUDA is not ideal - ~50% slower than Q4_0 for
single token prediction, about the same in batch
mode (perplexity). CPU single token is ~55 ms
(on Ryzen 7950X).

* Some improvement for Q3_K on CUDA

It is now ~22.5 ms/token on my GPU, so ~30% slower than Q4_0.

* Some more CUDA optimizations for Q3_K

Single token is now 20.5 ms/token (~20% slower than Q4_0).
Perplexity is on par with Q4_0.

* Adding Q4_K - scalar, AVX2, CUDA

Performance is the same or perhaps very slightly better than Q4_0 on the CPU.
On the GPU, single token prediction is ~10% better than Q4_0,
batch mode (perplexity is about the same).

* Adding Q6_K - scalar, AVX2, CUDA

Performance is ~40% lower compared to Q4_K on the CPU.
This is to be expected, considering that we are memory bound
on the CPU and the 6-bit model is ~44% larger than the 4-bit.
On the GPU, single token prediction is ~6% lower than Q4_0,
batch mode (perplexity) is even closer (but still slower).

* Adding Q5_K - scalar, AVX2, CUDA

Performance is ~20% lower compared to Q4_K on the CPU.
This is to be expected, considering that we are memory bound
on the CPU and the 5-bit model is ~22% larger than the 4-bit.
On the GPU, single token prediction is about the same as Q4_0
for both, single token and batch prediction.

* Per convention, all QX_K quantizations use Q5_K for output.weight

* Adding quantization mixes

* Quantization mixes: didn't quite get what I wanted in the last commit

* Q4_K dot product for ARM_NEON

* Q6_K dot product for ARM_NEON

* Q5_K dot product for ARM_NEON

* Adding Q3_K dot for ARM_NEON

It is 22% slower than Q4_K, despite the smaller model size.
On x86_64, where we are memory bound, the Q3_K model is
quite a bit faster than Q4_K.

* A very slightly faster ARM_NEON Q3_K dot

* Adding Q2_K - just CUDA for now

Token prediction is pretty good - about 15.5 ms on a RTX 4080.
Perplexity is about the same as Q4_K.

* Adding scalar and AVX2 Q2_K dot

* Adding ARM_NEON Q2_K dot

About the same performance as Q4_K.

* A slightly faster ARM_NEON Q2_K dot

Single token prediction is now ~36 ms on M2 Max.
The code is much simpler too.

* Fixed bug in Q2_K CUDA dot product kernel

Stranegly enough, for the few prompts I tried with the 7B model
the responses looked perfectly reasonable. Only realized something
is not quite right when I tried the larger models and started getting
nonse back.

In any case, Q2_K single token evaluation time on an RTX 4080 in a Ryzen7950X
box iusing CUDA and model fully loaded on the GPU are
  ~15.5 ms for 7B, ~25.4 ms for 13B, and ~55.8 ms for 30B.
The max number of layers that fit in VRAM for The 65B is 32.
With that, we get ~330 ms per token, which is not that much faster
than just running on the CPU (~470 ms per token).

* Don't print zeros/NaNs when no count histogram has been collected

* A 10% faster CUDA vector dot kernel for Q3_K

Q3_K is now running at ~18.5 ms / token on CUDA,
so the gap to Q4_0 is only 10%.
It seems memory acccess pattern is more important for
performance than the amount of computation the kernel
does.

* A slightly daster Q4_K AVX2 dot product

For perplexity, where we are less memory bound, time per
pass drops by ~5%. Barely measurable difference for single
token prediction.

* A slightly faster ARM_NEON A4_K dot product

* Minor

* Fix quantization error test

We cannot possibly be expecting rmse < 0.002 for 2- and 3-bit
quantization variants.

* Fix docker build

I have been sloppy with vector reinterpret casts on ARM_NEON.
It seems clang is very forgiving in that regard.

* Added forgotten ggml.o dependence on k_quants.h to the Makefile

* Had unintentionally committed the Makefile with -Ofast enabled

* ggml : rename k_quants -> ggml-quants-k, use lowercase in code

---------

Co-authored-by: Iwan Kawrakow <redacted>
Co-authored-by: Georgi Gerganov <redacted>
2 years agoIncrease 3B scratch buffers. (#1698)
Henri Vasserman [Mon, 5 Jun 2023 10:43:08 +0000 (13:43 +0300)]
Increase 3B scratch buffers. (#1698)

The 128 MB was too optimistic.
Too bad it is not dynamically computed.

2 years agollama : fix Metal KV cache sync (close #1695)
Georgi Gerganov [Mon, 5 Jun 2023 07:19:03 +0000 (10:19 +0300)]
llama : fix Metal KV cache sync (close #1695)

2 years agoreadme : update hot topics
Georgi Gerganov [Sun, 4 Jun 2023 20:38:19 +0000 (23:38 +0300)]
readme : update hot topics

2 years agollama : Metal inference (#1642)
Georgi Gerganov [Sun, 4 Jun 2023 20:34:30 +0000 (23:34 +0300)]
llama : Metal inference (#1642)

* mtl : export the LLaMA computation graph

* ci : disable temporary

* mtl : adapt the MNIST example as starter

* mtl : no need for mtl-export tool, add cli arg for main instead

* mtl : export just a small part of the graph for now to make it easier

* mtl : move MSL code into separate file for easy editing

* mtl : initial get_rows_q4_0 kernel

* mtl : confirmed get_rows_q4_0 is working correctly

* mtl : add rms_norm kernel + confirm working

* mtl : add mul kernel + confirm working

* mtl : initial mul_mat Q4 kernel (wrong results)

* mtl : mul_mat fixes (still wrong)

* mtl : another mul_mat Q4 (still does not work)

* mtl : working mul_mat q4

* ggml : fix handling of "view" ops in ggml_graph_import()

* mtl : add rope kernel

* mtl : add reshape and transpose handling

* ggml : store offset as opt arg for ggml_view_xd() operators

* mtl : add cpy kernel + handle view ops

* mtl : confirm f16 x f32 attention mul mat

* mtl : add scale kernel

* mtl : add diag_mask_inf kernel

* mtl : fix soft_max kernel

* ggml : update ggml_nbytes() to handle non-contiguous tensors

* mtl : verify V tensor contents

* mtl : add f32 -> f32 cpy kernel

* mtl : add silu kernel

* mtl : add non-broadcast mul kernel

* mtl : full GPU inference of the computation graph

* mtl : optimize rms_norm and soft_max kernels

* mtl : add f16 mat x f32 vec multiplication kernel

* mtl : fix bug in f16 x f32 mul mat + speed-up computation

* mtl : faster mul_mat_q4_0_f32 kernel

* mtl : fix kernel signature + roll inner loop

* mtl : more threads for rms_norm + better timing

* mtl : remove printfs from inner loop

* mtl : simplify implementation

* mtl : add save/load vocab to ggml file

* mtl : plug Metal inference into llama.cpp (very quick-n-dirty)

* mtl : make it work with main example

Lots of hacks but at least now it generates text

* mtl : preparing for merge

* mtl : clean-up ggml mtl interface + suport scratch / inplace

* mtl : remove temp / debug code

* metal : final refactoring and simplification

* Revert "ci : disable temporary"

This reverts commit 98c267fc77fe811082f672538fc91bcfc9072d63.

* metal : add comments

* metal : clean-up stuff, fix typos

* readme : add Metal instructions

* readme : add example for main

2 years agoOpenCL: Fix duplication of layers in VRAM and RAM, add GPU mul kernel (#1653)
0cc4m [Sun, 4 Jun 2023 06:12:05 +0000 (08:12 +0200)]
OpenCL: Fix duplication of layers in VRAM and RAM, add GPU mul kernel (#1653)

* Use events instead of clFinish, where possible

* OpenCL: Don't load gpu layers into RAM, add mul_f32 kernel

* Reduce queueing overhead for contiguous tensors by using single mul kernel call

* Adapt to #1612 cl_mem malloc changes

* Reduce code duplication between cuda and opencl branches

* Improve implementation

2 years agoAdd info about CUDA_VISIBLE_DEVICES (#1682)
Henri Vasserman [Sat, 3 Jun 2023 13:35:20 +0000 (16:35 +0300)]
Add info about CUDA_VISIBLE_DEVICES (#1682)

2 years agoDocker: change to calling convert.py (#1641)
Jiří Podivín [Sat, 3 Jun 2023 12:11:53 +0000 (14:11 +0200)]
Docker: change to calling convert.py (#1641)

Deprecation disclaimer was added to convert-pth-to-ggml.py

2 years agoFix prompt cache saving and chat-persistent rollover (#1678)
Evan Jones [Sat, 3 Jun 2023 11:28:45 +0000 (07:28 -0400)]
Fix prompt cache saving and chat-persistent rollover (#1678)

* Fix prompt cache saving and chat-persistent rollover (fixes #1670)

* clang-tidy

Co-authored-by: github-actions[bot] <redacted>
---------

Co-authored-by: github-actions[bot] <redacted>
2 years agoOpenLLaMA 3B support (#1588)
Henri Vasserman [Tue, 30 May 2023 18:24:22 +0000 (21:24 +0300)]
OpenLLaMA 3B support (#1588)

This adds support to llama.cpp to load the model.

Currently missing are changes that are required from convert.py to convert the model correctly. It needs some changes to start reading the JSON configuration for HF models instead of deriving the values by guessing.

Co-authored-by: FNsi <redacted>
2 years agoggml : sync cgraph import / export API
Georgi Gerganov [Mon, 29 May 2023 16:31:44 +0000 (19:31 +0300)]
ggml : sync cgraph import / export API

2 years agoggml : fix bug in ggml_alibi
Georgi Gerganov [Mon, 29 May 2023 16:30:49 +0000 (19:30 +0300)]
ggml : fix bug in ggml_alibi

2 years agoWork around for recalculating logits in cached prompts (Fixes #1585) (#1609)
DannyDaemonic [Mon, 29 May 2023 12:13:40 +0000 (05:13 -0700)]
Work around for recalculating logits in cached prompts (Fixes #1585) (#1609)

* Work around for recalculating logits in cached prompts

2 years agoAdding git in container package dependencies (#1621)
Jiří Podivín [Mon, 29 May 2023 04:45:50 +0000 (06:45 +0200)]
Adding git in container package dependencies (#1621)

Git added to build packages for version information in docker image

Signed-off-by: Jiri Podivin <redacted>
2 years agoLLAMA_DEBUG adds debug symbols (#1617)
Johannes Gäßler [Sun, 28 May 2023 19:01:02 +0000 (21:01 +0200)]
LLAMA_DEBUG adds debug symbols (#1617)

2 years agoOnly show -ngl option when relevant + other doc/arg handling updates (#1625)
Kerfuffle [Sun, 28 May 2023 17:48:57 +0000 (11:48 -0600)]
Only show -ngl option when relevant + other doc/arg handling updates (#1625)

1. Add a `LLAMA_SUPPORTS_GPU_OFFLOAD` define to `llama.h` (defined when compiled with CLBlast or cuBLAS)
2. Update the argument handling in the common example code to only show the `-ngl`, `--n-gpu-layers` option when GPU offload is possible.
3. Add an entry for the `-ngl`, `--n-gpu-layers` option to the `main` and `server` examples documentation
4. Update `main` and `server` examples documentation to use the new style dash separator argument format
5. Update the `server` example to use dash separators for its arguments and adds `-ngl` to `--help` (only shown when compiled with appropriate support). It will still support `--memory_f32` and `--ctx_size` for compatibility.
6. Add a warning discouraging use of `--memory-f32` for the `main` and `server` examples `--help` text as well as documentation. Rationale: https://github.com/ggerganov/llama.cpp/discussions/1593#discussioncomment-6004356

2 years agoexamples : add --alias option to gpt_params to set use friendly model name (#1614)
Vladimir Zorin [Sun, 28 May 2023 17:14:24 +0000 (20:14 +0300)]
examples : add --alias option to gpt_params to set use friendly model name (#1614)

2 years agoopencl : no need to allocate cl_mem on heap (#1612)
Howard Su [Sun, 28 May 2023 17:13:36 +0000 (01:13 +0800)]
opencl : no need to allocate cl_mem on heap (#1612)

2 years agoopencl : use strstr to check if fp16 supported (#1611)
Howard Su [Sun, 28 May 2023 17:09:56 +0000 (01:09 +0800)]
opencl : use strstr to check if fp16 supported (#1611)

* Use strstr to check if fp16 supported

* Ensure ext_buffer is null terminated

2 years agoggml : add support for the RISCV architecture (#1616)
apcameron [Sat, 27 May 2023 20:03:25 +0000 (21:03 +0100)]
ggml : add support for the RISCV architecture (#1616)

2 years agoInclude server in releases + other build system cleanups (#1610)
Kerfuffle [Sat, 27 May 2023 17:04:14 +0000 (11:04 -0600)]
Include server in releases + other build system cleanups (#1610)

Set `LLAMA_BUILD_SERVER` in workflow so the `server` example gets build. This currently only applies to Windows builds because it seems like only Windows binary artifacts are included in releases.

Add `server` example target to `Makefile` (still uses `LLAMA_BUILD_SERVER` define and does not build by default)

Fix issue where `vdot` binary wasn't removed when running `make clean`.

Fix compile warnings in `server` example.

Add `.hpp` files to trigger workflow (the server example has one).

2 years agoAdd documentation about CLBlast (#1604)
Henri Vasserman [Sat, 27 May 2023 15:47:55 +0000 (18:47 +0300)]
Add documentation about CLBlast (#1604)

Installing, compiling and using.

2 years ago[CI] Fix openblas (#1613)
Henri Vasserman [Sat, 27 May 2023 14:24:06 +0000 (17:24 +0300)]
[CI] Fix openblas (#1613)

* Fix OpenBLAS build

* Fix `LLAMA_BLAS_VENDOR` CMake variable that should be a string and not a boolean.

2 years agoggml : add ggml_tensor_overhead()
Georgi Gerganov [Sat, 27 May 2023 13:19:56 +0000 (16:19 +0300)]
ggml : add ggml_tensor_overhead()

2 years ago[CI] CLBlast: Fix directory name (#1606)
Henri Vasserman [Sat, 27 May 2023 12:18:25 +0000 (15:18 +0300)]
[CI] CLBlast: Fix directory name (#1606)

2 years agoggml : sync ggml core (minor additions, e.g. ggml_get_tensor_by_name())
Georgi Gerganov [Sat, 27 May 2023 09:22:05 +0000 (12:22 +0300)]
ggml : sync ggml core (minor additions, e.g. ggml_get_tensor_by_name())

2 years agoSome improvements to loading the session with --prompt-cache (#1550)
Kerfuffle [Fri, 26 May 2023 02:18:01 +0000 (20:18 -0600)]
Some improvements to loading the session with --prompt-cache (#1550)

Improvements to loading the session with `--prompt-cache` in the `main` example.

1. Fix an issue where the `--seed` parameter was ignored when loading a cached prompt.
2. When loading a cached prompt, you previously had to specify the saved prompt (or a prefix of it) again. This pull changes that behavior to default to the prompt that was cached if a prompt wasn't specified by the user.

2 years agocuda : performance optimizations (#1530)
Johannes Gäßler [Thu, 25 May 2023 21:07:29 +0000 (23:07 +0200)]
cuda : performance optimizations (#1530)

* xor hack

* block y dim

* loop unrolling

* Fixed cmake LLAMA_CUDA_BY option

* Removed hipblas compatibility code

* Define GGML_CUDA_DMMV_BLOCK_Y if not defined

* Fewer iters, more ops per iter

* Renamed DMMV X/Y compilation options

2 years agoUpdate CLBlast to 1.6.0 (#1580)
Henri Vasserman [Wed, 24 May 2023 07:30:09 +0000 (10:30 +0300)]
Update CLBlast to 1.6.0 (#1580)

* Update CLBlast to 1.6.0