toy 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +1124 -0
- data/LICENSE +21 -0
- data/Makefile +2022 -0
- data/README.md +154 -0
- data/bin/toy +10 -0
- data/lib/toy/compute.rb +135 -0
- data/lib/toy/compute_cuda.rb +104 -0
- data/lib/toy/compute_metal.rb +97 -0
- data/lib/toy/core/cli/describe.rb +188 -0
- data/lib/toy/core/cli/eval.rb +385 -0
- data/lib/toy/core/cli/exit_codes.rb +15 -0
- data/lib/toy/core/cli/fetch.rb +238 -0
- data/lib/toy/core/cli/infer.rb +268 -0
- data/lib/toy/core/cli/install.rb +228 -0
- data/lib/toy/core/cli/list.rb +86 -0
- data/lib/toy/core/cli/manifest.rb +49 -0
- data/lib/toy/core/cli/new.rb +594 -0
- data/lib/toy/core/cli/serve.rb +237 -0
- data/lib/toy/core/cli/train.rb +471 -0
- data/lib/toy/core/cli.rb +165 -0
- data/lib/toy/core/config.rb +64 -0
- data/lib/toy/core/gguf_meta.rb +161 -0
- data/lib/toy/core/model_scan.rb +221 -0
- data/lib/toy/core/run_log.rb +94 -0
- data/lib/toy/core/toy_root.rb +95 -0
- data/lib/toy/dev/toy_card.rb +299 -0
- data/lib/toy/dev/toy_describe_flow.rb +412 -0
- data/lib/toy/dev/toy_logprobs.rb +86 -0
- data/lib/toy/dev/toy_tap.rb +183 -0
- data/lib/toy/dev/toy_token_drift.rb +121 -0
- data/lib/toy/ffi/tinynn.rb +1491 -0
- data/lib/toy/ffi/tinynn_cuda.rb +1124 -0
- data/lib/toy/ffi/tinynn_metal.rb +359 -0
- data/lib/toy/ffi_manifest.rb +84 -0
- data/lib/toy/io/bpe.rb +325 -0
- data/lib/toy/io/gguf_kv.rb +35 -0
- data/lib/toy/io/gguf_load.rb +331 -0
- data/lib/toy/io/loaders/toy_gpt2_loader.rb +70 -0
- data/lib/toy/io/loaders/toy_smollm2_loader.rb +754 -0
- data/lib/toy/io/model_index.rb +206 -0
- data/lib/toy/io/run_bundle.rb +280 -0
- data/lib/toy/io/tokenizer.rb +613 -0
- data/lib/toy/io/toy_corpus_loader.rb +52 -0
- data/lib/toy/io/toy_events.rb +56 -0
- data/lib/toy/io/toy_image_loader.rb +48 -0
- data/lib/toy/llm/adamw.rb +169 -0
- data/lib/toy/llm/archs/llama_arch.rb +233 -0
- data/lib/toy/llm/archs/llama_arch_cuda.rb +237 -0
- data/lib/toy/llm/archs/llama_arch_metal.rb +237 -0
- data/lib/toy/llm/blocks/transformer_block.rb +876 -0
- data/lib/toy/llm/blocks/transformer_block_cuda.rb +880 -0
- data/lib/toy/llm/blocks/transformer_block_metal.rb +880 -0
- data/lib/toy/llm/classify_batch.rb +88 -0
- data/lib/toy/llm/engine/gpt2_fwd_engine.rb +360 -0
- data/lib/toy/llm/engine/gpt2_fwd_engine_cuda.rb +362 -0
- data/lib/toy/llm/engine/gpt2_fwd_engine_metal.rb +362 -0
- data/lib/toy/llm/engine/gpt2_kv_engine.rb +346 -0
- data/lib/toy/llm/engine/gpt2_kv_engine_cuda.rb +348 -0
- data/lib/toy/llm/engine/gpt2_kv_engine_metal.rb +348 -0
- data/lib/toy/llm/engine/gpt2_seq_engine.rb +289 -0
- data/lib/toy/llm/engine/gpt2_seq_engine_cuda.rb +293 -0
- data/lib/toy/llm/engine/gpt2_seq_engine_metal.rb +293 -0
- data/lib/toy/llm/engine/llama_kv_engine.rb +1593 -0
- data/lib/toy/llm/engine/llama_kv_engine_cuda.rb +1526 -0
- data/lib/toy/llm/engine/llama_kv_engine_metal.rb +1526 -0
- data/lib/toy/llm/engine/llama_seq_engine.rb +1233 -0
- data/lib/toy/llm/engine/llama_seq_engine_cuda.rb +1238 -0
- data/lib/toy/llm/engine/llama_seq_engine_metal.rb +1238 -0
- data/lib/toy/llm/engine/vit_tiny_engine.rb +467 -0
- data/lib/toy/llm/labels.rb +142 -0
- data/lib/toy/llm/primitives/gqa.rb +62 -0
- data/lib/toy/llm/primitives/gqa_cuda.rb +66 -0
- data/lib/toy/llm/primitives/gqa_metal.rb +66 -0
- data/lib/toy/llm/primitives/rms_norm.rb +39 -0
- data/lib/toy/llm/primitives/rms_norm_cuda.rb +43 -0
- data/lib/toy/llm/primitives/rms_norm_metal.rb +43 -0
- data/lib/toy/llm/primitives/rope.rb +68 -0
- data/lib/toy/llm/primitives/rope_cuda.rb +72 -0
- data/lib/toy/llm/primitives/rope_metal.rb +72 -0
- data/lib/toy/llm/primitives/swiglu.rb +41 -0
- data/lib/toy/llm/primitives/swiglu_cuda.rb +45 -0
- data/lib/toy/llm/primitives/swiglu_metal.rb +45 -0
- data/lib/toy/llm/recipe_options.rb +71 -0
- data/lib/toy/llm/recipes/from_scratch.rb +105 -0
- data/lib/toy/llm/recipes/from_scratch_cuda.rb +109 -0
- data/lib/toy/llm/recipes/from_scratch_metal.rb +109 -0
- data/lib/toy/llm/recipes/lora.rb +110 -0
- data/lib/toy/llm/recipes/lora_cuda.rb +114 -0
- data/lib/toy/llm/recipes/lora_metal.rb +114 -0
- data/lib/toy/llm/recipes/vit_tiny.rb +75 -0
- data/lib/toy/llm/recipes/warm_start.rb +235 -0
- data/lib/toy/llm/recipes/warm_start_cuda.rb +239 -0
- data/lib/toy/llm/recipes/warm_start_metal.rb +239 -0
- data/lib/toy/llm/training_batch.rb +133 -0
- data/lib/toy/models/arch.rb +253 -0
- data/lib/toy/models/gpt2.rb +311 -0
- data/lib/toy/models/toy_gpt2.rb +177 -0
- data/lib/toy/models/toy_smollm2.rb +393 -0
- data/lib/toy/models/toy_vit.rb +83 -0
- data/lib/toy/models/transformer.rb +1494 -0
- data/lib/toy/models/transformer_lm.rb +298 -0
- data/lib/toy/models/transformer_lm_cuda.rb +159 -0
- data/lib/toy/models/transformer_lm_metal.rb +142 -0
- data/lib/toy/mri.rb +300 -0
- data/lib/toy/run/eval.rb +76 -0
- data/lib/toy/run/eval_cuda.rb +66 -0
- data/lib/toy/run/eval_lmc.rb +334 -0
- data/lib/toy/run/eval_metal.rb +67 -0
- data/lib/toy/run/infer.rb +130 -0
- data/lib/toy/run/infer_cuda.rb +118 -0
- data/lib/toy/run/infer_metal.rb +119 -0
- data/lib/toy/run/infer_trace.rb +37 -0
- data/lib/toy/run/serve.rb +144 -0
- data/lib/toy/run/train.rb +404 -0
- data/lib/toy/run/train_cuda.rb +397 -0
- data/lib/toy/run/train_gpt2.rb +103 -0
- data/lib/toy/run/train_gpt2_cuda.rb +85 -0
- data/lib/toy/run/train_gpt2_metal.rb +85 -0
- data/lib/toy/run/train_lora.rb +207 -0
- data/lib/toy/run/train_lora_cuda.rb +219 -0
- data/lib/toy/run/train_metal.rb +227 -0
- data/lib/toy/run/train_vit.rb +251 -0
- data/lib/toy/serve/openai/embeddings_handler.rb +92 -0
- data/lib/toy/serve/openai/handlers.rb +143 -0
- data/lib/toy/serve/openai/server.rb +159 -0
- data/lib/toy/train/sampler.rb +314 -0
- data/lib/toy/train/toy_chat_template.rb +179 -0
- data/lib/toy/train/toy_drift_grad.rb +176 -0
- data/lib/toy/train/toy_gguf_fuse.rb +428 -0
- data/lib/toy/train/toy_gguf_writer.rb +100 -0
- data/lib/toy/train/toy_lr_schedule.rb +39 -0
- data/lib/toy/train/toy_sample.rb +125 -0
- data/lib/toy/train/toy_trainer.rb +86 -0
- data/lib/toy/train/training.rb +160 -0
- data/lib/toy/version.rb +11 -0
- data/lib/toy.rb +902 -0
- data/prep/progress +118 -0
- data/prep/quietly +64 -0
- data/sig/toy.rbs +397 -0
- data/sig/toy_compute.rbs +450 -0
- data/spinel-ext.json +122 -0
- data/tinynn/Makefile +71 -0
- data/tinynn/tinynn_backend_cuda.c +99 -0
- data/tinynn/tinynn_backend_metal.m +75 -0
- data/tinynn/tinynn_events.c +122 -0
- data/tinynn/tinynn_events.h +83 -0
- data/tinynn/tinynn_ggml.c +2460 -0
- data/tinynn/tinynn_ggml.h +545 -0
- data/tinynn/tinynn_gguf.c +783 -0
- data/tinynn/tinynn_gguf.h +167 -0
- data/tinynn/tinynn_trace.c +180 -0
- data/tinynn/tinynn_trace.h +85 -0
- data/vendor/ggml/AUTHORS +335 -0
- data/vendor/ggml/CMakeLists.txt +505 -0
- data/vendor/ggml/CONTRIBUTING.md +3 -0
- data/vendor/ggml/LICENSE +21 -0
- data/vendor/ggml/README.md +50 -0
- data/vendor/ggml/ci/run.sh +395 -0
- data/vendor/ggml/cmake/FindNCCL.cmake +36 -0
- data/vendor/ggml/cmake/GitVars.cmake +22 -0
- data/vendor/ggml/cmake/common.cmake +50 -0
- data/vendor/ggml/cmake/ggml-config.cmake.in +191 -0
- data/vendor/ggml/docs/gguf.md +828 -0
- data/vendor/ggml/examples/CMakeLists.txt +34 -0
- data/vendor/ggml/examples/common-ggml.cpp +244 -0
- data/vendor/ggml/examples/common-ggml.h +18 -0
- data/vendor/ggml/examples/common.cpp +675 -0
- data/vendor/ggml/examples/common.h +322 -0
- data/vendor/ggml/examples/gpt-2/CMakeLists.txt +32 -0
- data/vendor/ggml/examples/gpt-2/README.md +225 -0
- data/vendor/ggml/examples/gpt-2/convert-cerebras-to-ggml.py +183 -0
- data/vendor/ggml/examples/gpt-2/convert-ckpt-to-ggml.py +159 -0
- data/vendor/ggml/examples/gpt-2/convert-h5-to-ggml.py +195 -0
- data/vendor/ggml/examples/gpt-2/download-ggml-model.sh +69 -0
- data/vendor/ggml/examples/gpt-2/download-model.sh +48 -0
- data/vendor/ggml/examples/gpt-2/main-alloc.cpp +880 -0
- data/vendor/ggml/examples/gpt-2/main-backend.cpp +946 -0
- data/vendor/ggml/examples/gpt-2/main-batched.cpp +1210 -0
- data/vendor/ggml/examples/gpt-2/main-ctx.cpp +840 -0
- data/vendor/ggml/examples/gpt-2/main-sched.cpp +1079 -0
- data/vendor/ggml/examples/gpt-2/quantize.cpp +184 -0
- data/vendor/ggml/examples/gpt-j/CMakeLists.txt +13 -0
- data/vendor/ggml/examples/gpt-j/README.md +239 -0
- data/vendor/ggml/examples/gpt-j/convert-h5-to-ggml.py +173 -0
- data/vendor/ggml/examples/gpt-j/download-ggml-model.sh +69 -0
- data/vendor/ggml/examples/gpt-j/download-model.sh +11 -0
- data/vendor/ggml/examples/gpt-j/main.cpp +755 -0
- data/vendor/ggml/examples/gpt-j/quantize.cpp +182 -0
- data/vendor/ggml/examples/magika/CMakeLists.txt +17 -0
- data/vendor/ggml/examples/magika/README.md +23 -0
- data/vendor/ggml/examples/magika/convert.py +32 -0
- data/vendor/ggml/examples/magika/main.cpp +374 -0
- data/vendor/ggml/examples/mnist/CMakeLists.txt +58 -0
- data/vendor/ggml/examples/mnist/README.md +206 -0
- data/vendor/ggml/examples/mnist/mnist-common.cpp +496 -0
- data/vendor/ggml/examples/mnist/mnist-common.h +166 -0
- data/vendor/ggml/examples/mnist/mnist-eval.cpp +67 -0
- data/vendor/ggml/examples/mnist/mnist-train-cnn.py +91 -0
- data/vendor/ggml/examples/mnist/mnist-train-fc.py +131 -0
- data/vendor/ggml/examples/mnist/mnist-train.cpp +39 -0
- data/vendor/ggml/examples/mnist/server.py +36 -0
- data/vendor/ggml/examples/mnist/web/index.html +178 -0
- data/vendor/ggml/examples/perf-metal/CMakeLists.txt +7 -0
- data/vendor/ggml/examples/perf-metal/perf-metal.cpp +152 -0
- data/vendor/ggml/examples/prompts/dolly-v2.txt +100 -0
- data/vendor/ggml/examples/prompts/gpt-2-chinese.txt +1 -0
- data/vendor/ggml/examples/prompts/gpt-2.txt +100 -0
- data/vendor/ggml/examples/prompts/gpt-j.txt +100 -0
- data/vendor/ggml/examples/prompts/gpt-neox-japanese.txt +1 -0
- data/vendor/ggml/examples/prompts/gpt-neox.txt +100 -0
- data/vendor/ggml/examples/prompts/polyglot-ko.txt +3 -0
- data/vendor/ggml/examples/prompts/replit.txt +100 -0
- data/vendor/ggml/examples/prompts/starcoder.txt +100 -0
- data/vendor/ggml/examples/prompts/test-cases.txt +110 -0
- data/vendor/ggml/examples/prompts/tokenize_huggingface.py +65 -0
- data/vendor/ggml/examples/prompts/whisper.txt +100 -0
- data/vendor/ggml/examples/python/README.md +115 -0
- data/vendor/ggml/examples/python/api.h +14 -0
- data/vendor/ggml/examples/python/example_add_quant.py +25 -0
- data/vendor/ggml/examples/python/example_test_all_quants.py +68 -0
- data/vendor/ggml/examples/python/ggml/__init__.py +58 -0
- data/vendor/ggml/examples/python/ggml/__init__.pyi +2406 -0
- data/vendor/ggml/examples/python/ggml/cffi.py +11 -0
- data/vendor/ggml/examples/python/ggml/ffi/__init__.pyi +7 -0
- data/vendor/ggml/examples/python/ggml/utils.py +182 -0
- data/vendor/ggml/examples/python/regenerate.py +42 -0
- data/vendor/ggml/examples/python/stubs.py +128 -0
- data/vendor/ggml/examples/python/test_tensor.py +258 -0
- data/vendor/ggml/examples/sam/CMakeLists.txt +13 -0
- data/vendor/ggml/examples/sam/README.md +95 -0
- data/vendor/ggml/examples/sam/convert-pth-to-ggml.py +147 -0
- data/vendor/ggml/examples/sam/example.jpg +0 -0
- data/vendor/ggml/examples/sam/sam.cpp +2370 -0
- data/vendor/ggml/examples/simple/CMakeLists.txt +21 -0
- data/vendor/ggml/examples/simple/README.md +61 -0
- data/vendor/ggml/examples/simple/simple-backend.cpp +153 -0
- data/vendor/ggml/examples/simple/simple-ctx.cpp +127 -0
- data/vendor/ggml/examples/stb_image.h +7987 -0
- data/vendor/ggml/examples/stb_image_write.h +1724 -0
- data/vendor/ggml/examples/test-cmake/CMakeLists.txt +10 -0
- data/vendor/ggml/examples/test-cmake/README.md +3 -0
- data/vendor/ggml/examples/test-cmake/test-cmake.cpp +6 -0
- data/vendor/ggml/examples/yolo/CMakeLists.txt +6 -0
- data/vendor/ggml/examples/yolo/README.md +59 -0
- data/vendor/ggml/examples/yolo/convert-yolov3-tiny.py +53 -0
- data/vendor/ggml/examples/yolo/data/coco.names +80 -0
- data/vendor/ggml/examples/yolo/data/labels/100_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/100_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/101_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/102_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/103_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/104_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/105_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/106_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/107_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/108_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/109_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/110_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/111_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/112_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/113_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/114_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/115_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/116_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/117_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/118_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/119_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/120_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/121_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/122_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/123_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/124_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/125_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/126_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/32_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/33_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/34_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/35_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/36_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/37_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/38_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/39_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/40_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/41_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/42_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/43_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/44_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/45_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/46_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/47_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/48_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/49_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/50_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/51_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/52_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/53_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/54_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/55_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/56_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/57_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/58_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/59_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/60_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/61_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/62_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/63_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/64_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/65_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/66_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/67_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/68_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/69_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/70_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/71_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/72_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/73_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/74_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/75_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/76_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/77_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/78_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/79_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/80_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/81_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/82_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/83_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/84_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/85_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/86_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/87_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/88_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/89_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/90_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/91_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/92_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/93_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/94_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/95_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/96_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/97_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/98_7.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_0.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_1.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_2.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_3.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_4.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_5.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_6.png +0 -0
- data/vendor/ggml/examples/yolo/data/labels/99_7.png +0 -0
- data/vendor/ggml/examples/yolo/yolo-image.cpp +210 -0
- data/vendor/ggml/examples/yolo/yolo-image.h +39 -0
- data/vendor/ggml/examples/yolo/yolov3-tiny.cpp +661 -0
- data/vendor/ggml/ggml.pc.in +10 -0
- data/vendor/ggml/include/ggml-alloc.h +85 -0
- data/vendor/ggml/include/ggml-backend.h +431 -0
- data/vendor/ggml/include/ggml-blas.h +25 -0
- data/vendor/ggml/include/ggml-cann.h +123 -0
- data/vendor/ggml/include/ggml-cpp.h +39 -0
- data/vendor/ggml/include/ggml-cpu.h +151 -0
- data/vendor/ggml/include/ggml-cuda.h +50 -0
- data/vendor/ggml/include/ggml-hexagon.h +19 -0
- data/vendor/ggml/include/ggml-metal.h +61 -0
- data/vendor/ggml/include/ggml-opencl.h +26 -0
- data/vendor/ggml/include/ggml-openvino.h +37 -0
- data/vendor/ggml/include/ggml-opt.h +256 -0
- data/vendor/ggml/include/ggml-rpc.h +35 -0
- data/vendor/ggml/include/ggml-sycl.h +49 -0
- data/vendor/ggml/include/ggml-virtgpu.h +14 -0
- data/vendor/ggml/include/ggml-vulkan.h +29 -0
- data/vendor/ggml/include/ggml-webgpu.h +19 -0
- data/vendor/ggml/include/ggml-zdnn.h +17 -0
- data/vendor/ggml/include/ggml-zendnn.h +22 -0
- data/vendor/ggml/include/ggml.h +2845 -0
- data/vendor/ggml/include/gguf.h +204 -0
- data/vendor/ggml/requirements.txt +12 -0
- data/vendor/ggml/scripts/gen-authors.sh +9 -0
- data/vendor/ggml/scripts/release.sh +296 -0
- data/vendor/ggml/scripts/sync-llama-am.sh +167 -0
- data/vendor/ggml/scripts/sync-llama.last +1 -0
- data/vendor/ggml/scripts/sync-llama.sh +21 -0
- data/vendor/ggml/scripts/sync-whisper-am.sh +138 -0
- data/vendor/ggml/scripts/sync-whisper.last +1 -0
- data/vendor/ggml/scripts/sync-whisper.sh +17 -0
- data/vendor/ggml/src/CMakeLists.txt +493 -0
- data/vendor/ggml/src/ggml-alloc.c +1248 -0
- data/vendor/ggml/src/ggml-backend-dl.cpp +48 -0
- data/vendor/ggml/src/ggml-backend-dl.h +45 -0
- data/vendor/ggml/src/ggml-backend-impl.h +275 -0
- data/vendor/ggml/src/ggml-backend-meta.cpp +2144 -0
- data/vendor/ggml/src/ggml-backend-reg.cpp +586 -0
- data/vendor/ggml/src/ggml-backend.cpp +2371 -0
- data/vendor/ggml/src/ggml-blas/CMakeLists.txt +101 -0
- data/vendor/ggml/src/ggml-blas/ggml-blas.cpp +522 -0
- data/vendor/ggml/src/ggml-cann/CMakeLists.txt +89 -0
- data/vendor/ggml/src/ggml-cann/acl_tensor.cpp +195 -0
- data/vendor/ggml/src/ggml-cann/acl_tensor.h +349 -0
- data/vendor/ggml/src/ggml-cann/aclnn_ops.cpp +4436 -0
- data/vendor/ggml/src/ggml-cann/aclnn_ops.h +1190 -0
- data/vendor/ggml/src/ggml-cann/common.h +651 -0
- data/vendor/ggml/src/ggml-cann/ggml-cann.cpp +3062 -0
- data/vendor/ggml/src/ggml-common.h +1900 -0
- data/vendor/ggml/src/ggml-cpu/CMakeLists.txt +731 -0
- data/vendor/ggml/src/ggml-cpu/amx/amx.cpp +249 -0
- data/vendor/ggml/src/ggml-cpu/amx/amx.h +8 -0
- data/vendor/ggml/src/ggml-cpu/amx/common.h +115 -0
- data/vendor/ggml/src/ggml-cpu/amx/mmq.cpp +2512 -0
- data/vendor/ggml/src/ggml-cpu/amx/mmq.h +10 -0
- data/vendor/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp +98 -0
- data/vendor/ggml/src/ggml-cpu/arch/arm/quants.c +4245 -0
- data/vendor/ggml/src/ggml-cpu/arch/arm/repack.cpp +5156 -0
- data/vendor/ggml/src/ggml-cpu/arch/loongarch/quants.c +2158 -0
- data/vendor/ggml/src/ggml-cpu/arch/powerpc/cpu-feats.cpp +82 -0
- data/vendor/ggml/src/ggml-cpu/arch/powerpc/quants.c +2304 -0
- data/vendor/ggml/src/ggml-cpu/arch/riscv/cpu-feats.cpp +38 -0
- data/vendor/ggml/src/ggml-cpu/arch/riscv/quants.c +4553 -0
- data/vendor/ggml/src/ggml-cpu/arch/riscv/repack.cpp +1703 -0
- data/vendor/ggml/src/ggml-cpu/arch/s390/cpu-feats.cpp +50 -0
- data/vendor/ggml/src/ggml-cpu/arch/s390/quants.c +1465 -0
- data/vendor/ggml/src/ggml-cpu/arch/wasm/quants.c +1220 -0
- data/vendor/ggml/src/ggml-cpu/arch/x86/cpu-feats.cpp +327 -0
- data/vendor/ggml/src/ggml-cpu/arch/x86/quants.c +3970 -0
- data/vendor/ggml/src/ggml-cpu/arch/x86/repack.cpp +6407 -0
- data/vendor/ggml/src/ggml-cpu/arch-fallback.h +348 -0
- data/vendor/ggml/src/ggml-cpu/binary-ops.cpp +154 -0
- data/vendor/ggml/src/ggml-cpu/binary-ops.h +16 -0
- data/vendor/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +100 -0
- data/vendor/ggml/src/ggml-cpu/cmake/FindSMTIME.cmake +32 -0
- data/vendor/ggml/src/ggml-cpu/common.h +95 -0
- data/vendor/ggml/src/ggml-cpu/ggml-cpu-impl.h +539 -0
- data/vendor/ggml/src/ggml-cpu/ggml-cpu.c +3835 -0
- data/vendor/ggml/src/ggml-cpu/ggml-cpu.cpp +703 -0
- data/vendor/ggml/src/ggml-cpu/hbm.cpp +55 -0
- data/vendor/ggml/src/ggml-cpu/hbm.h +8 -0
- data/vendor/ggml/src/ggml-cpu/kleidiai/kernels.cpp +939 -0
- data/vendor/ggml/src/ggml-cpu/kleidiai/kernels.h +90 -0
- data/vendor/ggml/src/ggml-cpu/kleidiai/kleidiai.cpp +1513 -0
- data/vendor/ggml/src/ggml-cpu/kleidiai/kleidiai.h +17 -0
- data/vendor/ggml/src/ggml-cpu/llamafile/sgemm.cpp +4051 -0
- data/vendor/ggml/src/ggml-cpu/llamafile/sgemm.h +25 -0
- data/vendor/ggml/src/ggml-cpu/ops.cpp +11373 -0
- data/vendor/ggml/src/ggml-cpu/ops.h +119 -0
- data/vendor/ggml/src/ggml-cpu/quants.c +1288 -0
- data/vendor/ggml/src/ggml-cpu/quants.h +103 -0
- data/vendor/ggml/src/ggml-cpu/repack.cpp +4836 -0
- data/vendor/ggml/src/ggml-cpu/repack.h +245 -0
- data/vendor/ggml/src/ggml-cpu/simd-gemm.h +226 -0
- data/vendor/ggml/src/ggml-cpu/simd-mappings.h +1319 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime.cpp +1740 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime.h +21 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime1_kernels.cpp +1027 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime2_kernels.cpp +5768 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime_env.cpp +320 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime_env.h +55 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/ime_kernels.h +189 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/repack.cpp +1795 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/repack.h +14 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/rvv_kernels.cpp +3178 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/rvv_kernels.h +95 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/spine_barrier.h +34 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/spine_mem_pool.cpp +760 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/spine_mem_pool.h +32 -0
- data/vendor/ggml/src/ggml-cpu/spacemit/spine_tcm.h +409 -0
- data/vendor/ggml/src/ggml-cpu/traits.cpp +36 -0
- data/vendor/ggml/src/ggml-cpu/traits.h +38 -0
- data/vendor/ggml/src/ggml-cpu/unary-ops.cpp +337 -0
- data/vendor/ggml/src/ggml-cpu/unary-ops.h +35 -0
- data/vendor/ggml/src/ggml-cpu/vec.cpp +629 -0
- data/vendor/ggml/src/ggml-cpu/vec.h +1588 -0
- data/vendor/ggml/src/ggml-cuda/CMakeLists.txt +268 -0
- data/vendor/ggml/src/ggml-cuda/acc.cu +61 -0
- data/vendor/ggml/src/ggml-cuda/acc.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/add-id.cu +58 -0
- data/vendor/ggml/src/ggml-cuda/add-id.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/allreduce.cu +971 -0
- data/vendor/ggml/src/ggml-cuda/allreduce.cuh +29 -0
- data/vendor/ggml/src/ggml-cuda/arange.cu +34 -0
- data/vendor/ggml/src/ggml-cuda/arange.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/argmax.cu +91 -0
- data/vendor/ggml/src/ggml-cuda/argmax.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/argsort.cu +266 -0
- data/vendor/ggml/src/ggml-cuda/argsort.cuh +19 -0
- data/vendor/ggml/src/ggml-cuda/binbcast.cu +534 -0
- data/vendor/ggml/src/ggml-cuda/binbcast.cuh +12 -0
- data/vendor/ggml/src/ggml-cuda/clamp.cu +45 -0
- data/vendor/ggml/src/ggml-cuda/clamp.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/common.cuh +1489 -0
- data/vendor/ggml/src/ggml-cuda/concat.cu +204 -0
- data/vendor/ggml/src/ggml-cuda/concat.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/conv-transpose-1d.cu +86 -0
- data/vendor/ggml/src/ggml-cuda/conv-transpose-1d.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/conv2d-dw.cu +161 -0
- data/vendor/ggml/src/ggml-cuda/conv2d-dw.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/conv2d-transpose.cu +115 -0
- data/vendor/ggml/src/ggml-cuda/conv2d-transpose.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/conv2d.cu +166 -0
- data/vendor/ggml/src/ggml-cuda/conv2d.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/convert.cu +892 -0
- data/vendor/ggml/src/ggml-cuda/convert.cuh +66 -0
- data/vendor/ggml/src/ggml-cuda/count-equal.cu +64 -0
- data/vendor/ggml/src/ggml-cuda/count-equal.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/cp-async.cuh +57 -0
- data/vendor/ggml/src/ggml-cuda/cpy-utils.cuh +217 -0
- data/vendor/ggml/src/ggml-cuda/cpy.cu +558 -0
- data/vendor/ggml/src/ggml-cuda/cpy.cuh +7 -0
- data/vendor/ggml/src/ggml-cuda/cross-entropy-loss.cu +177 -0
- data/vendor/ggml/src/ggml-cuda/cross-entropy-loss.cuh +7 -0
- data/vendor/ggml/src/ggml-cuda/cumsum.cu +307 -0
- data/vendor/ggml/src/ggml-cuda/cumsum.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/dequantize.cuh +99 -0
- data/vendor/ggml/src/ggml-cuda/diag.cu +77 -0
- data/vendor/ggml/src/ggml-cuda/diag.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/diagmask.cu +40 -0
- data/vendor/ggml/src/ggml-cuda/diagmask.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/fattn-common.cuh +1212 -0
- data/vendor/ggml/src/ggml-cuda/fattn-mma-f16.cuh +2020 -0
- data/vendor/ggml/src/ggml-cuda/fattn-tile.cu +61 -0
- data/vendor/ggml/src/ggml-cuda/fattn-tile.cuh +1347 -0
- data/vendor/ggml/src/ggml-cuda/fattn-vec.cuh +600 -0
- data/vendor/ggml/src/ggml-cuda/fattn-wmma-f16.cu +696 -0
- data/vendor/ggml/src/ggml-cuda/fattn-wmma-f16.cuh +51 -0
- data/vendor/ggml/src/ggml-cuda/fattn.cu +562 -0
- data/vendor/ggml/src/ggml-cuda/fattn.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/fill.cu +37 -0
- data/vendor/ggml/src/ggml-cuda/fill.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/gated_delta_net.cu +311 -0
- data/vendor/ggml/src/ggml-cuda/gated_delta_net.cuh +4 -0
- data/vendor/ggml/src/ggml-cuda/getrows.cu +300 -0
- data/vendor/ggml/src/ggml-cuda/getrows.cuh +15 -0
- data/vendor/ggml/src/ggml-cuda/ggml-cuda.cu +5684 -0
- data/vendor/ggml/src/ggml-cuda/gla.cu +93 -0
- data/vendor/ggml/src/ggml-cuda/gla.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/im2col.cu +267 -0
- data/vendor/ggml/src/ggml-cuda/im2col.cuh +6 -0
- data/vendor/ggml/src/ggml-cuda/mean.cu +75 -0
- data/vendor/ggml/src/ggml-cuda/mean.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/mma.cuh +1456 -0
- data/vendor/ggml/src/ggml-cuda/mmf.cu +191 -0
- data/vendor/ggml/src/ggml-cuda/mmf.cuh +908 -0
- data/vendor/ggml/src/ggml-cuda/mmid.cu +164 -0
- data/vendor/ggml/src/ggml-cuda/mmid.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/mmq.cu +372 -0
- data/vendor/ggml/src/ggml-cuda/mmq.cuh +4176 -0
- data/vendor/ggml/src/ggml-cuda/mmvf.cu +862 -0
- data/vendor/ggml/src/ggml-cuda/mmvf.cuh +14 -0
- data/vendor/ggml/src/ggml-cuda/mmvq.cu +1161 -0
- data/vendor/ggml/src/ggml-cuda/mmvq.cuh +16 -0
- data/vendor/ggml/src/ggml-cuda/norm.cu +672 -0
- data/vendor/ggml/src/ggml-cuda/norm.cuh +18 -0
- data/vendor/ggml/src/ggml-cuda/opt-step-adamw.cu +78 -0
- data/vendor/ggml/src/ggml-cuda/opt-step-adamw.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/opt-step-sgd.cu +49 -0
- data/vendor/ggml/src/ggml-cuda/opt-step-sgd.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/out-prod.cu +84 -0
- data/vendor/ggml/src/ggml-cuda/out-prod.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/pad.cu +106 -0
- data/vendor/ggml/src/ggml-cuda/pad.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/pad_reflect_1d.cu +91 -0
- data/vendor/ggml/src/ggml-cuda/pad_reflect_1d.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/pool2d.cu +94 -0
- data/vendor/ggml/src/ggml-cuda/pool2d.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/quantize.cu +443 -0
- data/vendor/ggml/src/ggml-cuda/quantize.cuh +41 -0
- data/vendor/ggml/src/ggml-cuda/reduce_rows.cuh +39 -0
- data/vendor/ggml/src/ggml-cuda/roll.cu +67 -0
- data/vendor/ggml/src/ggml-cuda/roll.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/rope.cu +665 -0
- data/vendor/ggml/src/ggml-cuda/rope.cuh +9 -0
- data/vendor/ggml/src/ggml-cuda/scale.cu +34 -0
- data/vendor/ggml/src/ggml-cuda/scale.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/set-rows.cu +330 -0
- data/vendor/ggml/src/ggml-cuda/set-rows.cuh +7 -0
- data/vendor/ggml/src/ggml-cuda/set.cu +39 -0
- data/vendor/ggml/src/ggml-cuda/set.cuh +7 -0
- data/vendor/ggml/src/ggml-cuda/snake.cu +72 -0
- data/vendor/ggml/src/ggml-cuda/snake.cuh +8 -0
- data/vendor/ggml/src/ggml-cuda/softcap.cu +34 -0
- data/vendor/ggml/src/ggml-cuda/softcap.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/softmax.cu +472 -0
- data/vendor/ggml/src/ggml-cuda/softmax.cuh +7 -0
- data/vendor/ggml/src/ggml-cuda/solve_tri.cu +275 -0
- data/vendor/ggml/src/ggml-cuda/solve_tri.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/ssm-conv.cu +197 -0
- data/vendor/ggml/src/ggml-cuda/ssm-conv.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/ssm-scan.cu +342 -0
- data/vendor/ggml/src/ggml-cuda/ssm-scan.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/sum.cu +41 -0
- data/vendor/ggml/src/ggml-cuda/sum.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/sumrows.cu +43 -0
- data/vendor/ggml/src/ggml-cuda/sumrows.cuh +4 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_16.cu +6 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_32.cu +6 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_8.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_1.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_2.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_4.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_16.cu +6 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_32.cu +6 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_4.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_8.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_1.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_2.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_16.cu +6 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_2.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_4.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_8.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_64-ncols2_1.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_1.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_2.cu +10 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_4.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_8.cu +12 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq112-dv112.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq128-dv128.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq192-dv128.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq256-dv256.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq320-dv256.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq40-dv40.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq512-dv512.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq576-dv512.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq64-dv64.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq72-dv72.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq80-dv80.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq96-dv96.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-bf16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-f16.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_1.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q8_0.cu +7 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/generate_cu_files.py +110 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_1.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_10.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_11.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_12.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_13.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_14.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_15.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_16.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_2.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_3.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_4.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_5.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_6.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_7.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_8.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_9.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq1_s.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_s.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xs.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xxs.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_s.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_xxs.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_nl.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_xs.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-mxfp4.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-nvfp4.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q1_0.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q2_k.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q3_k.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_0.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_1.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_k.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_0.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_1.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_k.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q6_k.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q8_0.cu +5 -0
- data/vendor/ggml/src/ggml-cuda/top-k.cu +95 -0
- data/vendor/ggml/src/ggml-cuda/top-k.cuh +3 -0
- data/vendor/ggml/src/ggml-cuda/topk-moe.cu +415 -0
- data/vendor/ggml/src/ggml-cuda/topk-moe.cuh +27 -0
- data/vendor/ggml/src/ggml-cuda/tri.cu +136 -0
- data/vendor/ggml/src/ggml-cuda/tri.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/tsembd.cu +47 -0
- data/vendor/ggml/src/ggml-cuda/tsembd.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/unary.cu +640 -0
- data/vendor/ggml/src/ggml-cuda/unary.cuh +114 -0
- data/vendor/ggml/src/ggml-cuda/upscale.cu +293 -0
- data/vendor/ggml/src/ggml-cuda/upscale.cuh +5 -0
- data/vendor/ggml/src/ggml-cuda/vecdotq.cuh +1317 -0
- data/vendor/ggml/src/ggml-cuda/vendors/cuda.h +28 -0
- data/vendor/ggml/src/ggml-cuda/vendors/hip.h +304 -0
- data/vendor/ggml/src/ggml-cuda/vendors/musa.h +150 -0
- data/vendor/ggml/src/ggml-cuda/wkv.cu +199 -0
- data/vendor/ggml/src/ggml-cuda/wkv.cuh +7 -0
- data/vendor/ggml/src/ggml-hexagon/CMakeLists.txt +118 -0
- data/vendor/ggml/src/ggml-hexagon/ggml-hexagon.cpp +3680 -0
- data/vendor/ggml/src/ggml-hexagon/htp/CMakeLists.txt +78 -0
- data/vendor/ggml/src/ggml-hexagon/htp/act-ops.c +782 -0
- data/vendor/ggml/src/ggml-hexagon/htp/argsort-ops.c +293 -0
- data/vendor/ggml/src/ggml-hexagon/htp/binary-ops.c +872 -0
- data/vendor/ggml/src/ggml-hexagon/htp/cmake-toolchain.cmake +157 -0
- data/vendor/ggml/src/ggml-hexagon/htp/cpy-ops.c +275 -0
- data/vendor/ggml/src/ggml-hexagon/htp/cumsum-ops.c +270 -0
- data/vendor/ggml/src/ggml-hexagon/htp/diag-ops.c +216 -0
- data/vendor/ggml/src/ggml-hexagon/htp/fill-ops.c +123 -0
- data/vendor/ggml/src/ggml-hexagon/htp/flash-attn-ops.c +727 -0
- data/vendor/ggml/src/ggml-hexagon/htp/gated-delta-net-ops.c +955 -0
- data/vendor/ggml/src/ggml-hexagon/htp/get-rows-ops.c +124 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hex-dma.c +63 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hex-dma.h +372 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hex-dump.h +86 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hex-fastdiv.h +37 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hex-utils.h +137 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-flash-attn-ops.c +1841 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-matmul-ops.c +1785 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-ops.h +71 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-profile.h +34 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-queue.c +158 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-queue.h +134 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hmx-utils.h +200 -0
- data/vendor/ggml/src/ggml-hexagon/htp/htp-ctx.h +111 -0
- data/vendor/ggml/src/ggml-hexagon/htp/htp-ops.h +181 -0
- data/vendor/ggml/src/ggml-hexagon/htp/htp_iface.idl +22 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-arith.h +443 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-base.h +308 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-copy.h +262 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-div.h +291 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-dump.h +129 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-exp.h +216 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-floor.h +100 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-inverse.h +210 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-reduce.h +296 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-repl.h +74 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-scale.h +133 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-sigmoid.h +142 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-sqrt.h +126 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-types.h +36 -0
- data/vendor/ggml/src/ggml-hexagon/htp/hvx-utils.h +19 -0
- data/vendor/ggml/src/ggml-hexagon/htp/main.c +880 -0
- data/vendor/ggml/src/ggml-hexagon/htp/matmul-ops.c +3173 -0
- data/vendor/ggml/src/ggml-hexagon/htp/repeat-ops.c +148 -0
- data/vendor/ggml/src/ggml-hexagon/htp/rope-ops.c +494 -0
- data/vendor/ggml/src/ggml-hexagon/htp/set-rows-ops.c +184 -0
- data/vendor/ggml/src/ggml-hexagon/htp/softmax-ops.c +407 -0
- data/vendor/ggml/src/ggml-hexagon/htp/solve-tri-ops.c +267 -0
- data/vendor/ggml/src/ggml-hexagon/htp/ssm-conv.c +340 -0
- data/vendor/ggml/src/ggml-hexagon/htp/sum-rows-ops.c +128 -0
- data/vendor/ggml/src/ggml-hexagon/htp/unary-ops.c +657 -0
- data/vendor/ggml/src/ggml-hexagon/htp/vtcm-utils.h +16 -0
- data/vendor/ggml/src/ggml-hexagon/htp/worker-pool.c +293 -0
- data/vendor/ggml/src/ggml-hexagon/htp/worker-pool.h +57 -0
- data/vendor/ggml/src/ggml-hexagon/htp-drv.cpp +418 -0
- data/vendor/ggml/src/ggml-hexagon/htp-drv.h +121 -0
- data/vendor/ggml/src/ggml-hexagon/libdl.h +79 -0
- data/vendor/ggml/src/ggml-hexagon/libggml-htp.inf +40 -0
- data/vendor/ggml/src/ggml-hexagon/op-desc.h +153 -0
- data/vendor/ggml/src/ggml-hip/CMakeLists.txt +157 -0
- data/vendor/ggml/src/ggml-impl.h +783 -0
- data/vendor/ggml/src/ggml-metal/CMakeLists.txt +124 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-common.cpp +457 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-common.h +52 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-context.h +41 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-context.m +739 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-device.cpp +2053 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-device.h +296 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-device.m +1829 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-impl.h +1175 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-ops.cpp +4606 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal-ops.h +97 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal.cpp +950 -0
- data/vendor/ggml/src/ggml-metal/ggml-metal.metal +10679 -0
- data/vendor/ggml/src/ggml-musa/CMakeLists.txt +124 -0
- data/vendor/ggml/src/ggml-musa/mudnn.cu +112 -0
- data/vendor/ggml/src/ggml-musa/mudnn.cuh +12 -0
- data/vendor/ggml/src/ggml-opencl/CMakeLists.txt +189 -0
- data/vendor/ggml/src/ggml-opencl/ggml-opencl.cpp +16374 -0
- data/vendor/ggml/src/ggml-opencl/kernels/add.cl +190 -0
- data/vendor/ggml/src/ggml-opencl/kernels/add_id.cl +42 -0
- data/vendor/ggml/src/ggml-opencl/kernels/argsort.cl +86 -0
- data/vendor/ggml/src/ggml-opencl/kernels/clamp.cl +20 -0
- data/vendor/ggml/src/ggml-opencl/kernels/concat.cl +51 -0
- data/vendor/ggml/src/ggml-opencl/kernels/conv2d.cl +185 -0
- data/vendor/ggml/src/ggml-opencl/kernels/conv2d_f16_f32.cl +176 -0
- data/vendor/ggml/src/ggml-opencl/kernels/cpy.cl +229 -0
- data/vendor/ggml/src/ggml-opencl/kernels/cumsum.cl +139 -0
- data/vendor/ggml/src/ggml-opencl/kernels/cvt.cl +1471 -0
- data/vendor/ggml/src/ggml-opencl/kernels/diag.cl +27 -0
- data/vendor/ggml/src/ggml-opencl/kernels/diag_mask_inf.cl +58 -0
- data/vendor/ggml/src/ggml-opencl/kernels/div.cl +138 -0
- data/vendor/ggml/src/ggml-opencl/kernels/embed_kernel.py +26 -0
- data/vendor/ggml/src/ggml-opencl/kernels/exp.cl +125 -0
- data/vendor/ggml/src/ggml-opencl/kernels/expm1.cl +113 -0
- data/vendor/ggml/src/ggml-opencl/kernels/fill.cl +17 -0
- data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f16.cl +370 -0
- data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f32.cl +371 -0
- data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f32_f16.cl +373 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gelu.cl +89 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_f32.cl +162 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_f32_ns.cl +302 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_0_f32_ns.cl +252 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_1_f32_ns.cl +254 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q5_0_f32_ns.cl +256 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q5_1_f32_ns.cl +258 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_iq4_nl_f32.cl +150 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_0_f32.cl +139 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_1_f32.cl +132 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_k_f32.cl +172 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q5_k_f32.cl +176 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q6_k_f32.cl +140 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q8_0_f32.cl +129 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemm_xmem_f16_f32_os8.cl +233 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_mxfp4_f32.cl +156 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_mxfp4_f32_ns.cl +161 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q4_0_f32_ns.cl +116 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q4_1_f32_ns.cl +119 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q5_0_f32_ns.cl +119 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q5_1_f32_ns.cl +121 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_iq4_nl_f32.cl +302 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_0_f32.cl +274 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_0_f32_spec.cl +268 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_1_f32.cl +283 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_k_f32.cl +318 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q5_k_f32.cl +326 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q6_k_f32.cl +293 -0
- data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q8_0_f32.cl +195 -0
- data/vendor/ggml/src/ggml-opencl/kernels/get_rows.cl +187 -0
- data/vendor/ggml/src/ggml-opencl/kernels/glu.cl +378 -0
- data/vendor/ggml/src/ggml-opencl/kernels/group_norm.cl +121 -0
- data/vendor/ggml/src/ggml-opencl/kernels/im2col_f16.cl +57 -0
- data/vendor/ggml/src/ggml-opencl/kernels/im2col_f32.cl +57 -0
- data/vendor/ggml/src/ggml-opencl/kernels/l2_norm.cl +71 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mean.cl +140 -0
- data/vendor/ggml/src/ggml-opencl/kernels/moe_reorder_b.cl +30 -0
- data/vendor/ggml/src/ggml-opencl/kernels/moe_sort_by_expert.cl +82 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul.cl +152 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mat_f16_f32.cl +130 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_f16_f32_kq_kqv.cl +273 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_f16_f32_l4_lm.cl +146 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_f32_f32_l4_lm.cl +147 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_iq4_nl_f32_l4_lm.cl +171 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q4_0_f32_l4_lm.cl +163 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q4_1_f32_l4_lm.cl +165 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q4_k_f32_l4_lm.cl +179 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q5_k_f32_l4_lm.cl +192 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q6_k_f32_l4_lm.cl +158 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q8_0_f32_l4_lm.cl +154 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f16.cl +118 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32.cl +118 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_1row.cl +94 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl +84 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f32_f32.cl +118 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_mxfp4_f32.cl +189 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_mxfp4_f32_flat.cl +176 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_q4_0_f32_8x_flat.cl +283 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_q8_0_f32.cl +140 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_q8_0_f32_flat.cl +222 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_iq4_nl_f32.cl +164 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_iq4_nl_f32_flat.cl +202 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_mxfp4_f32.cl +144 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_mxfp4_f32_flat.cl +167 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32.cl +192 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_1d_16x_flat.cl +307 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_1d_8x_flat.cl +265 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_8x_flat.cl +272 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_v.cl +254 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_1_f32.cl +219 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_1_f32_flat.cl +229 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32.cl +180 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32_flat.cl +196 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_k_f32.cl +187 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_k_f32_flat.cl +203 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q6_k_f32.cl +194 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q6_k_f32_flat.cl +194 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q8_0_f32.cl +125 -0
- data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q8_0_f32_flat.cl +202 -0
- data/vendor/ggml/src/ggml-opencl/kernels/neg.cl +125 -0
- data/vendor/ggml/src/ggml-opencl/kernels/norm.cl +161 -0
- data/vendor/ggml/src/ggml-opencl/kernels/pad.cl +39 -0
- data/vendor/ggml/src/ggml-opencl/kernels/relu.cl +16 -0
- data/vendor/ggml/src/ggml-opencl/kernels/repeat.cl +38 -0
- data/vendor/ggml/src/ggml-opencl/kernels/rms_norm.cl +190 -0
- data/vendor/ggml/src/ggml-opencl/kernels/rope.cl +747 -0
- data/vendor/ggml/src/ggml-opencl/kernels/scale.cl +27 -0
- data/vendor/ggml/src/ggml-opencl/kernels/set_rows.cl +208 -0
- data/vendor/ggml/src/ggml-opencl/kernels/sigmoid.cl +29 -0
- data/vendor/ggml/src/ggml-opencl/kernels/silu.cl +30 -0
- data/vendor/ggml/src/ggml-opencl/kernels/softmax_4_f16.cl +108 -0
- data/vendor/ggml/src/ggml-opencl/kernels/softmax_4_f32.cl +108 -0
- data/vendor/ggml/src/ggml-opencl/kernels/softmax_f16.cl +107 -0
- data/vendor/ggml/src/ggml-opencl/kernels/softmax_f32.cl +107 -0
- data/vendor/ggml/src/ggml-opencl/kernels/softplus.cl +116 -0
- data/vendor/ggml/src/ggml-opencl/kernels/solve_tri.cl +51 -0
- data/vendor/ggml/src/ggml-opencl/kernels/sqr.cl +53 -0
- data/vendor/ggml/src/ggml-opencl/kernels/sqrt.cl +53 -0
- data/vendor/ggml/src/ggml-opencl/kernels/ssm_conv.cl +77 -0
- data/vendor/ggml/src/ggml-opencl/kernels/sub.cl +138 -0
- data/vendor/ggml/src/ggml-opencl/kernels/sum_rows.cl +140 -0
- data/vendor/ggml/src/ggml-opencl/kernels/tanh.cl +109 -0
- data/vendor/ggml/src/ggml-opencl/kernels/transpose.cl +143 -0
- data/vendor/ggml/src/ggml-opencl/kernels/tri.cl +32 -0
- data/vendor/ggml/src/ggml-opencl/kernels/tsembd.cl +48 -0
- data/vendor/ggml/src/ggml-opencl/kernels/upscale.cl +120 -0
- data/vendor/ggml/src/ggml-openvino/CMakeLists.txt +22 -0
- data/vendor/ggml/src/ggml-openvino/ggml-decoder.cpp +985 -0
- data/vendor/ggml/src/ggml-openvino/ggml-decoder.h +294 -0
- data/vendor/ggml/src/ggml-openvino/ggml-openvino-extra.cpp +380 -0
- data/vendor/ggml/src/ggml-openvino/ggml-openvino-extra.h +182 -0
- data/vendor/ggml/src/ggml-openvino/ggml-openvino.cpp +1132 -0
- data/vendor/ggml/src/ggml-openvino/ggml-quants.cpp +956 -0
- data/vendor/ggml/src/ggml-openvino/ggml-quants.h +153 -0
- data/vendor/ggml/src/ggml-openvino/openvino/decoder.h +74 -0
- data/vendor/ggml/src/ggml-openvino/openvino/frontend.cpp +27 -0
- data/vendor/ggml/src/ggml-openvino/openvino/frontend.h +23 -0
- data/vendor/ggml/src/ggml-openvino/openvino/input_model.cpp +17 -0
- data/vendor/ggml/src/ggml-openvino/openvino/input_model.h +29 -0
- data/vendor/ggml/src/ggml-openvino/openvino/node_context.h +112 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/cont.cpp +48 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/cpy.cpp +21 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/flash_attn_ext.cpp +90 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/get_rows.cpp +69 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/glu_geglu.cpp +61 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/glu_swiglu.cpp +62 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/mulmat.cpp +90 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/permute.cpp +102 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/reshape.cpp +83 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp +46 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/rope.cpp +149 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/scale.cpp +41 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/set_rows.cpp +76 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/softmax.cpp +89 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/transpose.cpp +23 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/unary_gelu.cpp +25 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/unary_silu.cpp +27 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op/view.cpp +53 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op_table.cpp +47 -0
- data/vendor/ggml/src/ggml-openvino/openvino/op_table.h +40 -0
- data/vendor/ggml/src/ggml-openvino/openvino/pass/fuse_to_sdpa.cpp +60 -0
- data/vendor/ggml/src/ggml-openvino/openvino/pass/fuse_to_sdpa.h +17 -0
- data/vendor/ggml/src/ggml-openvino/openvino/pass/mark_decompression_convert_constant_folding.h +29 -0
- data/vendor/ggml/src/ggml-openvino/openvino/pass/squeeze_matmul.cpp +58 -0
- data/vendor/ggml/src/ggml-openvino/openvino/pass/squeeze_matmul.h +17 -0
- data/vendor/ggml/src/ggml-openvino/openvino/rt_info/weightless_caching_attributes.hpp +41 -0
- data/vendor/ggml/src/ggml-openvino/openvino/translate_session.cpp +317 -0
- data/vendor/ggml/src/ggml-openvino/openvino/translate_session.h +28 -0
- data/vendor/ggml/src/ggml-openvino/openvino/utils.cpp +257 -0
- data/vendor/ggml/src/ggml-openvino/openvino/utils.h +86 -0
- data/vendor/ggml/src/ggml-openvino/utils.cpp +880 -0
- data/vendor/ggml/src/ggml-openvino/utils.h +143 -0
- data/vendor/ggml/src/ggml-opt.cpp +1094 -0
- data/vendor/ggml/src/ggml-quants.c +5491 -0
- data/vendor/ggml/src/ggml-quants.h +112 -0
- data/vendor/ggml/src/ggml-rpc/CMakeLists.txt +33 -0
- data/vendor/ggml/src/ggml-rpc/ggml-rpc.cpp +1974 -0
- data/vendor/ggml/src/ggml-rpc/transport.cpp +683 -0
- data/vendor/ggml/src/ggml-rpc/transport.h +34 -0
- data/vendor/ggml/src/ggml-sycl/CMakeLists.txt +207 -0
- data/vendor/ggml/src/ggml-sycl/add-id.cpp +81 -0
- data/vendor/ggml/src/ggml-sycl/add-id.hpp +8 -0
- data/vendor/ggml/src/ggml-sycl/backend.hpp +48 -0
- data/vendor/ggml/src/ggml-sycl/binbcast.cpp +346 -0
- data/vendor/ggml/src/ggml-sycl/binbcast.hpp +39 -0
- data/vendor/ggml/src/ggml-sycl/common.cpp +155 -0
- data/vendor/ggml/src/ggml-sycl/common.hpp +1002 -0
- data/vendor/ggml/src/ggml-sycl/concat.cpp +202 -0
- data/vendor/ggml/src/ggml-sycl/concat.hpp +20 -0
- data/vendor/ggml/src/ggml-sycl/conv.cpp +101 -0
- data/vendor/ggml/src/ggml-sycl/conv.hpp +20 -0
- data/vendor/ggml/src/ggml-sycl/convert.cpp +825 -0
- data/vendor/ggml/src/ggml-sycl/convert.hpp +64 -0
- data/vendor/ggml/src/ggml-sycl/count-equal.cpp +79 -0
- data/vendor/ggml/src/ggml-sycl/count-equal.hpp +9 -0
- data/vendor/ggml/src/ggml-sycl/cpy.cpp +602 -0
- data/vendor/ggml/src/ggml-sycl/cpy.hpp +223 -0
- data/vendor/ggml/src/ggml-sycl/cumsum.cpp +148 -0
- data/vendor/ggml/src/ggml-sycl/cumsum.hpp +5 -0
- data/vendor/ggml/src/ggml-sycl/dequantize.hpp +975 -0
- data/vendor/ggml/src/ggml-sycl/diag.cpp +67 -0
- data/vendor/ggml/src/ggml-sycl/diag.hpp +5 -0
- data/vendor/ggml/src/ggml-sycl/dmmv.cpp +1579 -0
- data/vendor/ggml/src/ggml-sycl/dmmv.hpp +27 -0
- data/vendor/ggml/src/ggml-sycl/dpct/helper.hpp +3774 -0
- data/vendor/ggml/src/ggml-sycl/element_wise.cpp +1124 -0
- data/vendor/ggml/src/ggml-sycl/element_wise.hpp +94 -0
- data/vendor/ggml/src/ggml-sycl/fattn-buffers.cpp +56 -0
- data/vendor/ggml/src/ggml-sycl/fattn-buffers.hpp +63 -0
- data/vendor/ggml/src/ggml-sycl/fattn-common.hpp +1181 -0
- data/vendor/ggml/src/ggml-sycl/fattn-tile.cpp +59 -0
- data/vendor/ggml/src/ggml-sycl/fattn-tile.hpp +1246 -0
- data/vendor/ggml/src/ggml-sycl/fattn-vec.hpp +674 -0
- data/vendor/ggml/src/ggml-sycl/fattn.cpp +227 -0
- data/vendor/ggml/src/ggml-sycl/fattn.hpp +22 -0
- data/vendor/ggml/src/ggml-sycl/fill.cpp +55 -0
- data/vendor/ggml/src/ggml-sycl/fill.hpp +5 -0
- data/vendor/ggml/src/ggml-sycl/gated_delta_net.cpp +307 -0
- data/vendor/ggml/src/ggml-sycl/gated_delta_net.hpp +9 -0
- data/vendor/ggml/src/ggml-sycl/gemm.hpp +93 -0
- data/vendor/ggml/src/ggml-sycl/getrows.cpp +219 -0
- data/vendor/ggml/src/ggml-sycl/getrows.hpp +20 -0
- data/vendor/ggml/src/ggml-sycl/ggml-sycl.cpp +5520 -0
- data/vendor/ggml/src/ggml-sycl/gla.cpp +106 -0
- data/vendor/ggml/src/ggml-sycl/gla.hpp +8 -0
- data/vendor/ggml/src/ggml-sycl/im2col.cpp +400 -0
- data/vendor/ggml/src/ggml-sycl/im2col.hpp +23 -0
- data/vendor/ggml/src/ggml-sycl/mmq.cpp +3030 -0
- data/vendor/ggml/src/ggml-sycl/mmq.hpp +33 -0
- data/vendor/ggml/src/ggml-sycl/mmvq.cpp +1380 -0
- data/vendor/ggml/src/ggml-sycl/mmvq.hpp +43 -0
- data/vendor/ggml/src/ggml-sycl/norm.cpp +656 -0
- data/vendor/ggml/src/ggml-sycl/norm.hpp +28 -0
- data/vendor/ggml/src/ggml-sycl/outprod.cpp +47 -0
- data/vendor/ggml/src/ggml-sycl/outprod.hpp +10 -0
- data/vendor/ggml/src/ggml-sycl/pad.cpp +97 -0
- data/vendor/ggml/src/ggml-sycl/pad.hpp +24 -0
- data/vendor/ggml/src/ggml-sycl/pad_reflect_1d.cpp +100 -0
- data/vendor/ggml/src/ggml-sycl/pad_reflect_1d.hpp +10 -0
- data/vendor/ggml/src/ggml-sycl/presets.hpp +79 -0
- data/vendor/ggml/src/ggml-sycl/quantize.hpp +133 -0
- data/vendor/ggml/src/ggml-sycl/quants.hpp +156 -0
- data/vendor/ggml/src/ggml-sycl/repeat_back.cpp +76 -0
- data/vendor/ggml/src/ggml-sycl/repeat_back.hpp +8 -0
- data/vendor/ggml/src/ggml-sycl/roll.cpp +122 -0
- data/vendor/ggml/src/ggml-sycl/roll.hpp +20 -0
- data/vendor/ggml/src/ggml-sycl/rope.cpp +641 -0
- data/vendor/ggml/src/ggml-sycl/rope.hpp +26 -0
- data/vendor/ggml/src/ggml-sycl/set.cpp +73 -0
- data/vendor/ggml/src/ggml-sycl/set.hpp +5 -0
- data/vendor/ggml/src/ggml-sycl/set_rows.cpp +240 -0
- data/vendor/ggml/src/ggml-sycl/set_rows.hpp +8 -0
- data/vendor/ggml/src/ggml-sycl/softmax.cpp +426 -0
- data/vendor/ggml/src/ggml-sycl/softmax.hpp +24 -0
- data/vendor/ggml/src/ggml-sycl/solve_tri.cpp +172 -0
- data/vendor/ggml/src/ggml-sycl/solve_tri.hpp +8 -0
- data/vendor/ggml/src/ggml-sycl/ssm_conv.cpp +132 -0
- data/vendor/ggml/src/ggml-sycl/ssm_conv.hpp +5 -0
- data/vendor/ggml/src/ggml-sycl/ssm_scan.cpp +156 -0
- data/vendor/ggml/src/ggml-sycl/ssm_scan.hpp +5 -0
- data/vendor/ggml/src/ggml-sycl/sycl_hw.cpp +67 -0
- data/vendor/ggml/src/ggml-sycl/sycl_hw.hpp +38 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq112-dv112.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq128-dv128.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq256-dv256.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq40-dv40.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq512-dv512.cpp +6 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq576-dv512.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq64-dv64.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq72-dv72.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq80-dv80.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq96-dv96.cpp +5 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-f16.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q4_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q4_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q5_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q5_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q8_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-f16.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q4_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q4_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q5_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q5_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q8_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-f16.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q4_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q4_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q5_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q5_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q8_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-f16.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q4_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q4_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q5_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q5_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q8_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-f16.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q4_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q4_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q5_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q5_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q8_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-f16.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q4_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q4_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q5_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q5_1.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q8_0.cpp +8 -0
- data/vendor/ggml/src/ggml-sycl/tsembd.cpp +73 -0
- data/vendor/ggml/src/ggml-sycl/tsembd.hpp +20 -0
- data/vendor/ggml/src/ggml-sycl/type.hpp +112 -0
- data/vendor/ggml/src/ggml-sycl/upscale.cpp +410 -0
- data/vendor/ggml/src/ggml-sycl/upscale.hpp +9 -0
- data/vendor/ggml/src/ggml-sycl/vecdotq.hpp +1508 -0
- data/vendor/ggml/src/ggml-sycl/wkv.cpp +293 -0
- data/vendor/ggml/src/ggml-sycl/wkv.hpp +10 -0
- data/vendor/ggml/src/ggml-threading.cpp +12 -0
- data/vendor/ggml/src/ggml-threading.h +14 -0
- data/vendor/ggml/src/ggml-virtgpu/CMakeLists.txt +70 -0
- data/vendor/ggml/src/ggml-virtgpu/apir_cs_ggml-rpc-front.cpp +87 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/CMakeLists.txt +21 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/apir_cs_ggml-rpc-back.cpp +115 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-convert.h +13 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-backend.cpp +102 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-buffer-type.cpp +105 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-buffer.cpp +179 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-device.cpp +148 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched.cpp +51 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched.gen.h +73 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched.h +27 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend-virgl-apir.h +32 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/backend.cpp +144 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/shared/api_remoting.h +95 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_backend.gen.h +94 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_backend.h +50 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_cs.h +378 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h +232 -0
- data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_cs_rpc.h +58 -0
- data/vendor/ggml/src/ggml-virtgpu/ggml-backend-buffer-type.cpp +81 -0
- data/vendor/ggml/src/ggml-virtgpu/ggml-backend-buffer.cpp +123 -0
- data/vendor/ggml/src/ggml-virtgpu/ggml-backend-device.cpp +160 -0
- data/vendor/ggml/src/ggml-virtgpu/ggml-backend-reg.cpp +213 -0
- data/vendor/ggml/src/ggml-virtgpu/ggml-backend.cpp +71 -0
- data/vendor/ggml/src/ggml-virtgpu/ggml-remoting.h +71 -0
- data/vendor/ggml/src/ggml-virtgpu/ggmlremoting_functions.yaml +166 -0
- data/vendor/ggml/src/ggml-virtgpu/include/apir_hw.h +9 -0
- data/vendor/ggml/src/ggml-virtgpu/regenerate_remoting.py +333 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-apir.h +15 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-backend.cpp +58 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-buffer-type.cpp +110 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-buffer.cpp +173 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-device.cpp +192 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-impl.h +36 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward.gen.h +53 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-shm.cpp +99 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-shm.h +23 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-utils.cpp +179 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu-utils.h +86 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu.cpp +545 -0
- data/vendor/ggml/src/ggml-virtgpu/virtgpu.h +115 -0
- data/vendor/ggml/src/ggml-vulkan/CMakeLists.txt +220 -0
- data/vendor/ggml/src/ggml-vulkan/cmake/host-toolchain.cmake.in +15 -0
- data/vendor/ggml/src/ggml-vulkan/ggml-vulkan.cpp +17208 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +31 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/abs.comp +21 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/acc.comp +37 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/add.comp +69 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/add1.comp +28 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/add_id.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/arange.comp +20 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/argmax.comp +60 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/argsort.comp +86 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/argsort_large.comp +114 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/ceil.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/clamp.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/concat.comp +41 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/contig_copy.comp +49 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_dw.comp +105 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_mm.comp +347 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv_transpose_1d.comp +98 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy.comp +23 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_from_quant.comp +51 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_to_quant.comp +320 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_transpose.comp +67 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cos.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/count_equal.comp +31 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/count_experts.comp +51 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cumsum.comp +83 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cumsum_multipass1.comp +60 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cumsum_multipass2.comp +66 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_f32.comp +20 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs.glsl +653 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs_cm2.glsl +768 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_head.glsl +13 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq1_m.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq1_s.comp +35 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_s.comp +44 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_xs.comp +43 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_xxs.comp +49 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq3_s.comp +40 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq3_xxs.comp +51 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq4_nl.comp +32 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq4_xs.comp +34 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_mxfp4.comp +32 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_nvfp4.comp +32 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q1_0.comp +29 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q2_k.comp +34 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q3_k.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_0.comp +30 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_1.comp +32 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_k.comp +68 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_0.comp +34 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_1.comp +35 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_k.comp +70 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q6_k.comp +33 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q8_0.comp +31 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/diag.comp +28 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/diag_mask_inf.comp +34 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/div.comp +27 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/elu.comp +27 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/exp.comp +20 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/bfloat16.comp +7 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/coopmat.comp +7 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/coopmat2.comp +7 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/integer_dot.comp +7 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/fill.comp +19 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn.comp +756 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_base.glsl +255 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm1.comp +626 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm2.comp +427 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_dequant.glsl +123 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_mask_opt.comp +162 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_mmq_funcs.glsl +203 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_split_k_reduce.comp +121 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/floor.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/gated_delta_net.comp +190 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/geglu.comp +13 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/geglu_erf.comp +27 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/geglu_quick.comp +11 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/gelu.comp +25 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/gelu_erf.comp +39 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/gelu_quick.comp +23 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/generic_binary_head.glsl +65 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/generic_head.glsl +11 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/generic_unary_head.glsl +83 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/get_rows.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/get_rows_quant.comp +51 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/glu_head.glsl +28 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/glu_main.glsl +39 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/group_norm.comp +66 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/hardsigmoid.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/hardswish.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/im2col.comp +93 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/im2col_3d.comp +124 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/l2_norm.comp +44 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/leaky_relu.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/log.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul.comp +27 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_split_k_reduce.comp +48 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec.comp +169 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_base.glsl +230 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iface.glsl +35 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq1_m.comp +132 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq1_s.comp +95 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq2_s.comp +90 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq2_xs.comp +105 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq2_xxs.comp +87 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq3_s.comp +90 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq3_xxs.comp +88 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_nc.comp +124 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_p021.comp +156 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q2_k.comp +128 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q3_k.comp +132 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q4_k.comp +134 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q5_k.comp +165 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q6_k.comp +130 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq.comp +143 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq_funcs.glsl +503 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp +464 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp +624 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_funcs.glsl +600 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_id_funcs.glsl +74 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq.comp +311 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq_funcs.glsl +454 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq_shmem_types.glsl +93 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/multi_add.comp +194 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/neg.comp +20 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/norm.comp +44 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/opt_step_adamw.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/opt_step_sgd.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/pad.comp +64 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/pool2d.comp +74 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/quantize_q8_1.comp +127 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/reglu.comp +9 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/relu.comp +21 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/repeat.comp +26 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/repeat_back.comp +37 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp +150 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm_back.comp +55 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm_partials.comp +65 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/roll.comp +46 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_funcs.glsl +207 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_head.glsl +19 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_multi.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_params.glsl +31 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_vision.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/round.comp +29 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/scale.comp +24 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sgn.comp +21 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sigmoid.comp +20 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/silu.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/silu_back.comp +26 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sin.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp +195 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_back.comp +54 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large1.comp +62 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large2.comp +79 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large3.comp +65 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large_common.glsl +53 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/softplus.comp +23 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/solve_tri.comp +81 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sqrt.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/square.comp +17 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/ssm_conv.comp +50 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/ssm_scan.comp +124 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/step.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sub.comp +29 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sum_rows.comp +47 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sum_rows.glsl +25 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/swiglu.comp +9 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/swiglu_oai.comp +14 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp +20 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/timestep_embedding.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_argsort.comp +118 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_moe.comp +213 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_nary_search.comp +246 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/tri.comp +42 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/trunc.comp +22 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/types.glsl +1846 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/upscale.comp +178 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/utils.glsl +25 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +1183 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/wkv6.comp +87 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/wkv7.comp +91 -0
- data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/xielu.comp +35 -0
- data/vendor/ggml/src/ggml-webgpu/CMakeLists.txt +80 -0
- data/vendor/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp +3231 -0
- data/vendor/ggml/src/ggml-webgpu/ggml-webgpu.cpp +4461 -0
- data/vendor/ggml/src/ggml-webgpu/pre_wgsl.hpp +778 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/add_id.wgsl +64 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/argmax.wgsl +72 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/argsort.wgsl +106 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/argsort_merge.wgsl +134 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/binary.wgsl +139 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/common_decls.tmpl +905 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/concat.wgsl +75 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/conv2d.wgsl +165 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/cpy.wgsl +81 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/cumsum.wgsl +66 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py +89 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn.wgsl +706 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_tile.wgsl +351 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_blk.wgsl +101 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_reduce.wgsl +84 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_split.wgsl +720 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/gated_delta_net.wgsl +132 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/get_rows.wgsl +773 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/glu.wgsl +155 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/im2col.wgsl +101 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/memset.wgsl +40 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat.wgsl +747 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_decls.tmpl +1210 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id.wgsl +195 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id_gather.wgsl +55 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id_vec.wgsl +154 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_reg_tile.wgsl +149 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_subgroup_matrix.wgsl +200 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec.wgsl +133 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_acc.tmpl +1433 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/pad.wgsl +86 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/repeat.wgsl +67 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/rms_norm_mul.wgsl +152 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/rope.wgsl +224 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/row_norm.wgsl +153 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/scale.wgsl +63 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/set.wgsl +109 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/set_rows.wgsl +109 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/soft_max.wgsl +245 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/solve_tri.wgsl +121 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/ssm_conv.wgsl +65 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/ssm_scan.wgsl +193 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/sum_rows.wgsl +55 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/unary.wgsl +210 -0
- data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/upscale.wgsl +240 -0
- data/vendor/ggml/src/ggml-zdnn/CMakeLists.txt +36 -0
- data/vendor/ggml/src/ggml-zdnn/common.hpp +59 -0
- data/vendor/ggml/src/ggml-zdnn/ggml-zdnn.cpp +637 -0
- data/vendor/ggml/src/ggml-zdnn/mmf.cpp +80 -0
- data/vendor/ggml/src/ggml-zdnn/mmf.hpp +12 -0
- data/vendor/ggml/src/ggml-zdnn/utils.cpp +79 -0
- data/vendor/ggml/src/ggml-zdnn/utils.hpp +19 -0
- data/vendor/ggml/src/ggml-zendnn/CMakeLists.txt +91 -0
- data/vendor/ggml/src/ggml-zendnn/ggml-zendnn.cpp +669 -0
- data/vendor/ggml/src/ggml.c +7777 -0
- data/vendor/ggml/src/ggml.cpp +26 -0
- data/vendor/ggml/src/gguf.cpp +1556 -0
- data/vendor/ggml/tests/CMakeLists.txt +356 -0
- data/vendor/ggml/tests/test-arange.cpp +100 -0
- data/vendor/ggml/tests/test-backend-ops.cpp +9786 -0
- data/vendor/ggml/tests/test-cont.c +170 -0
- data/vendor/ggml/tests/test-conv-transpose-1d.cpp +691 -0
- data/vendor/ggml/tests/test-conv-transpose.c +248 -0
- data/vendor/ggml/tests/test-conv1d-dw-c1.cpp +243 -0
- data/vendor/ggml/tests/test-conv1d-dw-c2.cpp +243 -0
- data/vendor/ggml/tests/test-conv1d.cpp +289 -0
- data/vendor/ggml/tests/test-conv2d-dw.cpp +153 -0
- data/vendor/ggml/tests/test-conv2d.cpp +391 -0
- data/vendor/ggml/tests/test-customop.c +300 -0
- data/vendor/ggml/tests/test-dup.c +111 -0
- data/vendor/ggml/tests/test-interpolate.cpp +166 -0
- data/vendor/ggml/tests/test-opt.cpp +1003 -0
- data/vendor/ggml/tests/test-pad-reflect-1d.cpp +213 -0
- data/vendor/ggml/tests/test-pool.c +274 -0
- data/vendor/ggml/tests/test-quantize-fns.cpp +196 -0
- data/vendor/ggml/tests/test-quantize-perf.cpp +356 -0
- data/vendor/ggml/tests/test-rel-pos.c +87 -0
- data/vendor/ggml/tests/test-roll.cpp +128 -0
- data/vendor/ggml/tests/test-timestep_embedding.cpp +180 -0
- data/vendor-patches/0001-cuda-buffer_from_ptr.patch +253 -0
- data/vendor-patches/0002-cuda-buffer_from_ptr-reuse-iface.patch +117 -0
- data/vendor-patches/0003-cuda-buffer_from_ptr-copy-mode.patch +128 -0
- data/vendor-patches/0004-cuda-cpy-strided.patch +61 -0
- data/vendor-patches/0005-concat-backward.patch +36 -0
- data/vendor-patches/0006-getrows-back-large-vocab.patch +69 -0
- data/vendor-patches/0007-gpt2-backward-kernels.patch +438 -0
- data/vendor-patches/0008-mul-mat-backward-mixed-precision.patch +50 -0
- data/vendor-patches/0009-sched-unsupported-node-diagnostic.patch +26 -0
- metadata +2161 -0
|
@@ -0,0 +1,2158 @@
|
|
|
1
|
+
#define GGML_COMMON_IMPL_C
|
|
2
|
+
#include "ggml-common.h"
|
|
3
|
+
#include "ggml-quants.h"
|
|
4
|
+
#include "ggml-impl.h"
|
|
5
|
+
#include "ggml-cpu.h"
|
|
6
|
+
#include "simd-mappings.h"
|
|
7
|
+
|
|
8
|
+
#include "../../quants.h"
|
|
9
|
+
#include "../../ggml-cpu-impl.h"
|
|
10
|
+
|
|
11
|
+
#include <math.h>
|
|
12
|
+
#include <string.h>
|
|
13
|
+
#include <assert.h>
|
|
14
|
+
#include <float.h>
|
|
15
|
+
#include <stdlib.h> // for qsort
|
|
16
|
+
#include <stdio.h> // for GGML_ASSERT
|
|
17
|
+
|
|
18
|
+
#define GROUP_MAX_EPS 1e-15f
|
|
19
|
+
#define GROUP_MAX_EPS_IQ3_XXS 1e-8f
|
|
20
|
+
#define GROUP_MAX_EPS_IQ2_S 1e-8f
|
|
21
|
+
#define GROUP_MAX_EPS_IQ1_M 1e-7f
|
|
22
|
+
#define GROUP_MAX_EPS_IQ1_S 1e-12f
|
|
23
|
+
|
|
24
|
+
#define UNUSED GGML_UNUSED
|
|
25
|
+
|
|
26
|
+
#if defined(__loongarch_sx)
|
|
27
|
+
|
|
28
|
+
static __m128i lsx_packs_w(__m128i a, __m128i b) {
|
|
29
|
+
__m128i tmp, tmp1;
|
|
30
|
+
tmp = __lsx_vsat_w(a, 15);
|
|
31
|
+
tmp1 = __lsx_vsat_w(b, 15);
|
|
32
|
+
return __lsx_vpickev_h(tmp1, tmp);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static __m128i lsx_packs_h(__m128i a, __m128i b) {
|
|
36
|
+
__m128i tmp, tmp1;
|
|
37
|
+
tmp = __lsx_vsat_h(a, 7);
|
|
38
|
+
tmp1 = __lsx_vsat_h(b, 7);
|
|
39
|
+
return __lsx_vpickev_b(tmp1, tmp);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static __m128i lsx_packus_h(__m128i a, __m128i b) {
|
|
43
|
+
__m128i tmp, tmp1;
|
|
44
|
+
tmp = __lsx_vsat_hu(a, 7);
|
|
45
|
+
tmp1 = __lsx_vsat_hu(b, 7);
|
|
46
|
+
return __lsx_vpickev_b(tmp1, tmp);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static __m128i lsx_maddubs_h(__m128i a, __m128i b) {
|
|
50
|
+
__m128i tmp1, tmp2;
|
|
51
|
+
tmp1 = __lsx_vmulwev_h_b(a, b);
|
|
52
|
+
tmp2 = __lsx_vmulwod_h_b(a, b);
|
|
53
|
+
return __lsx_vsadd_h(tmp1, tmp2);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static __m128i lsx_madd_h(__m128i a, __m128i b) {
|
|
57
|
+
__m128i tmp1, tmp2;
|
|
58
|
+
tmp1 = __lsx_vmulwev_w_h(a, b);
|
|
59
|
+
tmp2 = __lsx_vmulwod_w_h(a, b);
|
|
60
|
+
return __lsx_vadd_w(tmp1, tmp2);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static __m128i lsx_set_w(int32_t a, int32_t b, int32_t c, int32_t d) {
|
|
64
|
+
v4i32 __ret = {d, c, b, a};
|
|
65
|
+
return (__m128i)__ret;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static __m128i lsx_shuffle_b(__m128i a, __m128i b) {
|
|
69
|
+
__m128i mask_f, zero, tmp0, tmp2, mask;
|
|
70
|
+
int f = 0x8f;
|
|
71
|
+
mask_f = __lsx_vreplgr2vr_b(f);
|
|
72
|
+
zero = __lsx_vldi(0);
|
|
73
|
+
tmp0 = __lsx_vand_v(b, mask_f); // get mask with low 4 bit and sign bits
|
|
74
|
+
tmp0 = __lsx_vori_b(tmp0, 0x10); // make each mask or with 0x10 prepare for positive
|
|
75
|
+
mask = __lsx_vsle_b(zero, tmp0); // if mask >= 0, set mask
|
|
76
|
+
tmp2 = __lsx_vand_v(tmp0, mask); // maskout the in2 < ones
|
|
77
|
+
return __lsx_vshuf_b(a, zero, tmp2);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static __m128i lsx_hadd_h(__m128i a, __m128i b) {
|
|
81
|
+
__m128i tmp1 = __lsx_vpickev_h(b, a);
|
|
82
|
+
__m128i tmp2 = __lsx_vpickod_h(b, a);
|
|
83
|
+
return __lsx_vadd_h(tmp1, tmp2);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static __m128i lsx_hadd_w(__m128i a, __m128i b) {
|
|
87
|
+
__m128i tmp1 = __lsx_vpickev_w(b, a);
|
|
88
|
+
__m128i tmp2 = __lsx_vpickod_w(b, a);
|
|
89
|
+
return __lsx_vadd_w(tmp1, tmp2);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static __m128 lsx_hadd_s(__m128 a, __m128 b) {
|
|
93
|
+
__m128 tmp1 = (__m128)__lsx_vpickev_w((__m128i)b, (__m128i)a);
|
|
94
|
+
__m128 tmp2 = (__m128)__lsx_vpickod_w((__m128i)b, (__m128i)a);
|
|
95
|
+
|
|
96
|
+
return __lsx_vfadd_s(tmp1, tmp2);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static inline float hsum_float_4x4(const __m128 a, const __m128 b, const __m128 c, const __m128 d) {
|
|
100
|
+
__m128 res_0 =lsx_hadd_s(a, b);
|
|
101
|
+
__m128 res_1 =lsx_hadd_s(c, d);
|
|
102
|
+
__m128 res =lsx_hadd_s(res_0, res_1);
|
|
103
|
+
res =lsx_hadd_s(res, res);
|
|
104
|
+
res =lsx_hadd_s(res, res);
|
|
105
|
+
|
|
106
|
+
return ((v4f32)res)[0];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// multiply int8_t, add results pairwise twice
|
|
110
|
+
static inline __m128i mul_sum_i8_pairs(const __m128i x, const __m128i y) {
|
|
111
|
+
// Get absolute values of x vectors
|
|
112
|
+
const __m128i ax = __lsx_vsigncov_b(x, x);
|
|
113
|
+
// Sign the values of the y vectors
|
|
114
|
+
const __m128i sy = __lsx_vsigncov_b(x, y);
|
|
115
|
+
// Perform multiplication and create 16-bit values
|
|
116
|
+
const __m128i dot = lsx_maddubs_h(ax, sy);
|
|
117
|
+
const __m128i ones = __lsx_vreplgr2vr_h(1);
|
|
118
|
+
return lsx_madd_h(ones, dot);
|
|
119
|
+
}
|
|
120
|
+
#endif
|
|
121
|
+
|
|
122
|
+
#if defined(__loongarch_asx)
|
|
123
|
+
|
|
124
|
+
#ifdef __clang__
|
|
125
|
+
#define VREGS_PREFIX "$vr"
|
|
126
|
+
#define XREGS_PREFIX "$xr"
|
|
127
|
+
#else // GCC
|
|
128
|
+
#define VREGS_PREFIX "$f"
|
|
129
|
+
#define XREGS_PREFIX "$f"
|
|
130
|
+
#endif
|
|
131
|
+
#define __ALL_REGS "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31"
|
|
132
|
+
// Convert __m128i to __m256i
|
|
133
|
+
static inline __m256i ____m256i(__m128i in) {
|
|
134
|
+
__m256i out = __lasx_xvldi(0);
|
|
135
|
+
__asm__ volatile (
|
|
136
|
+
".irp i," __ALL_REGS "\n\t"
|
|
137
|
+
" .ifc %[out], " XREGS_PREFIX"\\i \n\t"
|
|
138
|
+
" .irp j," __ALL_REGS "\n\t"
|
|
139
|
+
" .ifc %[in], " VREGS_PREFIX "\\j \n\t"
|
|
140
|
+
" xvpermi.q $xr\\i, $xr\\j, 0x20 \n\t"
|
|
141
|
+
" .endif \n\t"
|
|
142
|
+
" .endr \n\t"
|
|
143
|
+
" .endif \n\t"
|
|
144
|
+
".endr \n\t"
|
|
145
|
+
: [out] "+f" (out) : [in] "f" (in)
|
|
146
|
+
);
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
// Convert two __m128i to __m256i
|
|
150
|
+
static inline __m256i lasx_set_q(__m128i inhi, __m128i inlo) {
|
|
151
|
+
__m256i out;
|
|
152
|
+
__asm__ volatile (
|
|
153
|
+
".irp i," __ALL_REGS "\n\t"
|
|
154
|
+
" .ifc %[hi], " VREGS_PREFIX "\\i \n\t"
|
|
155
|
+
" .irp j," __ALL_REGS "\n\t"
|
|
156
|
+
" .ifc %[lo], " VREGS_PREFIX "\\j \n\t"
|
|
157
|
+
" xvpermi.q $xr\\i, $xr\\j, 0x20 \n\t"
|
|
158
|
+
" .endif \n\t"
|
|
159
|
+
" .endr \n\t"
|
|
160
|
+
" .endif \n\t"
|
|
161
|
+
".endr \n\t"
|
|
162
|
+
".ifnc %[out], %[hi] \n\t"
|
|
163
|
+
".irp i," __ALL_REGS "\n\t"
|
|
164
|
+
" .ifc %[out], " XREGS_PREFIX "\\i \n\t"
|
|
165
|
+
" .irp j," __ALL_REGS "\n\t"
|
|
166
|
+
" .ifc %[hi], " VREGS_PREFIX "\\j \n\t"
|
|
167
|
+
" xvori.b $xr\\i, $xr\\j, 0 \n\t"
|
|
168
|
+
" .endif \n\t"
|
|
169
|
+
" .endr \n\t"
|
|
170
|
+
" .endif \n\t"
|
|
171
|
+
".endr \n\t"
|
|
172
|
+
".endif \n\t"
|
|
173
|
+
: [out] "=f" (out), [hi] "+f" (inhi)
|
|
174
|
+
: [lo] "f" (inlo)
|
|
175
|
+
);
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
// Convert __m256i low part to __m128i
|
|
179
|
+
static inline __m128i lasx_extracti128_lo(__m256i in) {
|
|
180
|
+
__m128i out;
|
|
181
|
+
__asm__ volatile (
|
|
182
|
+
".ifnc %[out], %[in] \n\t"
|
|
183
|
+
".irp i," __ALL_REGS "\n\t"
|
|
184
|
+
" .ifc %[out], " VREGS_PREFIX "\\i \n\t"
|
|
185
|
+
" .irp j," __ALL_REGS "\n\t"
|
|
186
|
+
" .ifc %[in], " XREGS_PREFIX "\\j \n\t"
|
|
187
|
+
" vori.b $vr\\i, $vr\\j, 0 \n\t"
|
|
188
|
+
" .endif \n\t"
|
|
189
|
+
" .endr \n\t"
|
|
190
|
+
" .endif \n\t"
|
|
191
|
+
".endr \n\t"
|
|
192
|
+
".endif \n\t"
|
|
193
|
+
: [out] "=f" (out) : [in] "f" (in)
|
|
194
|
+
);
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
// Convert __m256i high part to __m128i
|
|
198
|
+
static inline __m128i lasx_extracti128_hi(__m256i in) {
|
|
199
|
+
__m128i out;
|
|
200
|
+
__asm__ volatile (
|
|
201
|
+
".irp i," __ALL_REGS "\n\t"
|
|
202
|
+
" .ifc %[out], " VREGS_PREFIX "\\i \n\t"
|
|
203
|
+
" .irp j," __ALL_REGS "\n\t"
|
|
204
|
+
" .ifc %[in], " XREGS_PREFIX "\\j \n\t"
|
|
205
|
+
" xvpermi.q $xr\\i, $xr\\j, 0x11 \n\t"
|
|
206
|
+
" .endif \n\t"
|
|
207
|
+
" .endr \n\t"
|
|
208
|
+
" .endif \n\t"
|
|
209
|
+
".endr \n\t"
|
|
210
|
+
: [out] "=f" (out) : [in] "f" (in)
|
|
211
|
+
);
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
static __m256i lasx_set_w(int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0) {
|
|
216
|
+
v8i32 __ret = {e0, e1, e2, e3, e4, e5, e6, e7};
|
|
217
|
+
return (__m256i)__ret;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
static __m256i lasx_set_d(int64_t a, int64_t b, int64_t c, int64_t d) {
|
|
221
|
+
v4i64 __ret = {d, c, b, a};
|
|
222
|
+
return (__m256i)__ret;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
static __m256i lasx_insertf128( __m128i x, __m128i y) {
|
|
226
|
+
return lasx_set_q(x, y);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static __m256i lasx_shuffle_b(__m256i a, __m256i b) {
|
|
230
|
+
__m256i mask_f, zero, tmp0, tmp2, mask;
|
|
231
|
+
int f = 0x8f;
|
|
232
|
+
mask_f = __lasx_xvreplgr2vr_b(f);
|
|
233
|
+
zero = __lasx_xvldi(0);
|
|
234
|
+
tmp0 = __lasx_xvand_v(b, mask_f); // get mask with low 4 bit and sign bits
|
|
235
|
+
tmp0 = __lasx_xvori_b(tmp0, 0x10); // make each mask or with 0x10 prepare for positive
|
|
236
|
+
mask = __lasx_xvsle_b(zero, tmp0); // if mask >= 0, set mask
|
|
237
|
+
tmp2 = __lasx_xvand_v(tmp0, mask); // maskout the in2 < ones
|
|
238
|
+
return __lasx_xvshuf_b(a, zero, tmp2);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
static __m256i lasx_extu8_16(__m128i a) {
|
|
242
|
+
return __lasx_vext2xv_hu_bu(____m256i(a));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
static __m256i lasx_ext8_16(__m128i a) {
|
|
246
|
+
return __lasx_vext2xv_h_b(____m256i(a));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
static __m256i lasx_ext16_32(__m128i a) {
|
|
250
|
+
return __lasx_vext2xv_w_h(____m256i(a));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
static __m128i lasx_extracti128( __m256i a, int pos) {
|
|
254
|
+
__m128i ret;
|
|
255
|
+
if( pos == 0)
|
|
256
|
+
{
|
|
257
|
+
ret = lasx_extracti128_lo(a);
|
|
258
|
+
} else {
|
|
259
|
+
ret = lasx_extracti128_hi(a);
|
|
260
|
+
}
|
|
261
|
+
return ret;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
static __m128 lasx_extractf128( __m256 a, int pos) {
|
|
265
|
+
__m128 ret;
|
|
266
|
+
if( pos == 0)
|
|
267
|
+
{
|
|
268
|
+
ret = (__m128)lasx_extracti128_lo((__m256i)a);
|
|
269
|
+
} else {
|
|
270
|
+
ret = (__m128)lasx_extracti128_hi((__m256i)a);
|
|
271
|
+
}
|
|
272
|
+
return ret;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
static __m256i lasx_maddubs_h(__m256i a, __m256i b) {
|
|
276
|
+
__m256i tmp1, tmp2;
|
|
277
|
+
tmp1 = __lasx_xvmulwev_h_b(a, b);
|
|
278
|
+
tmp2 = __lasx_xvmulwod_h_b(a, b);
|
|
279
|
+
return __lasx_xvsadd_h(tmp1, tmp2);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
static __m256i lasx_madd_h(__m256i a, __m256i b) {
|
|
283
|
+
__m256i tmp1, tmp2;
|
|
284
|
+
tmp1 = __lasx_xvmulwev_w_h(a, b);
|
|
285
|
+
tmp2 = __lasx_xvmulwod_w_h(a, b);
|
|
286
|
+
return __lasx_xvadd_w(tmp1, tmp2);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static __m256i lasx_packs_w(__m256i a, __m256i b) {
|
|
290
|
+
__m256i tmp, tmp1;
|
|
291
|
+
tmp = __lasx_xvsat_w(a, 15);
|
|
292
|
+
tmp1 = __lasx_xvsat_w(b, 15);
|
|
293
|
+
return __lasx_xvpickev_h(tmp1, tmp);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
static __m256i lasx_packs_h(__m256i a, __m256i b) {
|
|
297
|
+
__m256i tmp, tmp1;
|
|
298
|
+
tmp = __lasx_xvsat_h(a, 7);
|
|
299
|
+
tmp1 = __lasx_xvsat_h(b, 7);
|
|
300
|
+
return __lasx_xvpickev_b(tmp1, tmp);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
static inline __m256i lasx_madd_h_b(__m256i a, __m256i b) {
|
|
304
|
+
__m256i tmp1, tmp2;
|
|
305
|
+
tmp1 = __lasx_xvmulwev_h_b(a, b);
|
|
306
|
+
tmp2 = __lasx_xvmulwod_h_b(a, b);
|
|
307
|
+
return __lasx_xvadd_h(tmp1, tmp2);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
static inline __m256i lasx_xvrepl128vei_h(__m256i a, const unsigned int b) {
|
|
311
|
+
switch (b) {
|
|
312
|
+
case 0: return __lasx_xvrepl128vei_h(a, 0);
|
|
313
|
+
case 1: return __lasx_xvrepl128vei_h(a, 1);
|
|
314
|
+
case 2: return __lasx_xvrepl128vei_h(a, 2);
|
|
315
|
+
case 3: return __lasx_xvrepl128vei_h(a, 3);
|
|
316
|
+
case 4: return __lasx_xvrepl128vei_h(a, 4);
|
|
317
|
+
case 5: return __lasx_xvrepl128vei_h(a, 5);
|
|
318
|
+
case 6: return __lasx_xvrepl128vei_h(a, 6);
|
|
319
|
+
case 7: return __lasx_xvrepl128vei_h(a, 7);
|
|
320
|
+
default: __builtin_unreachable();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static inline __m256i lasx_xvandi_b_bit(__m256i a, const unsigned int b) {
|
|
325
|
+
switch (b) {
|
|
326
|
+
case 0: return __lasx_xvandi_b(a, 1 << 0);
|
|
327
|
+
case 1: return __lasx_xvandi_b(a, 1 << 1);
|
|
328
|
+
case 2: return __lasx_xvandi_b(a, 1 << 2);
|
|
329
|
+
case 3: return __lasx_xvandi_b(a, 1 << 3);
|
|
330
|
+
case 4: return __lasx_xvandi_b(a, 1 << 4);
|
|
331
|
+
case 5: return __lasx_xvandi_b(a, 1 << 5);
|
|
332
|
+
case 6: return __lasx_xvandi_b(a, 1 << 6);
|
|
333
|
+
case 7: return __lasx_xvandi_b(a, 1 << 7);
|
|
334
|
+
default: __builtin_unreachable();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// horizontally add 8 floats
|
|
339
|
+
static inline float hsum_float_8(const __m256 x) {
|
|
340
|
+
__m128 res = lasx_extractf128(x, 1);
|
|
341
|
+
res = __lsx_vfadd_s(res, lasx_extractf128(x, 0));
|
|
342
|
+
res = __lsx_vfadd_s(res, (__m128)__lsx_vpickod_d((__m128i)res, (__m128i)res));
|
|
343
|
+
res = __lsx_vfadd_s(res, (__m128)__lsx_vinsgr2vr_w(__lsx_vldi(0), __lsx_vpickve2gr_w(res, 1), 0));
|
|
344
|
+
return ((v4f32)res)[0];
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// horizontally add 8 int32_t
|
|
348
|
+
static inline int hsum_i32_8(const __m256i a) {
|
|
349
|
+
|
|
350
|
+
__m256i tmp1 = __lasx_xvpermi_q(a, a, 0x11);
|
|
351
|
+
__m256i tmp2 = __lasx_xvpermi_q(a, a, 0x00);
|
|
352
|
+
|
|
353
|
+
__m128i tmp1_128 = lasx_extracti128_lo(tmp1);
|
|
354
|
+
__m128i tmp2_128 = lasx_extracti128_lo(tmp2);
|
|
355
|
+
|
|
356
|
+
__m128i sum128 = __lsx_vadd_w(tmp1_128, tmp2_128);
|
|
357
|
+
|
|
358
|
+
__m128i ev = __lsx_vpickev_w(sum128, sum128);
|
|
359
|
+
__m128i od = __lsx_vpickod_w(sum128, sum128);
|
|
360
|
+
__m128i sum64 = __lsx_vadd_w(ev, od);
|
|
361
|
+
|
|
362
|
+
int sum64_1, sum64_2;
|
|
363
|
+
sum64_1 = __lsx_vpickve2gr_w(sum64, 0);
|
|
364
|
+
sum64_2 = __lsx_vpickve2gr_w(sum64, 1);
|
|
365
|
+
|
|
366
|
+
return sum64_1 + sum64_2;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// horizontally add 4 int32_t
|
|
370
|
+
static inline int hsum_i32_4(const __m128i a) {
|
|
371
|
+
__m128i ev = __lsx_vpickev_w(a, a);
|
|
372
|
+
__m128i od = __lsx_vpickod_w(a, a);
|
|
373
|
+
__m128i sum64 = __lsx_vadd_w(ev, od);
|
|
374
|
+
|
|
375
|
+
int sum64_1, sum64_2;
|
|
376
|
+
sum64_1 = __lsx_vpickve2gr_w(sum64, 0);
|
|
377
|
+
sum64_2 = __lsx_vpickve2gr_w(sum64, 1);
|
|
378
|
+
|
|
379
|
+
return sum64_1 + sum64_2;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// spread 32 bits to 32 bytes { 0x00, 0xFF }
|
|
383
|
+
static inline __m256i bytes_from_bits_32(const uint8_t * x) {
|
|
384
|
+
|
|
385
|
+
uint32_t x32;
|
|
386
|
+
memcpy(&x32, x, sizeof(uint32_t));
|
|
387
|
+
const __m256i shuf_mask = lasx_set_d(
|
|
388
|
+
0x0303030303030303, 0x0202020202020202,
|
|
389
|
+
0x0101010101010101, 0x0000000000000000);
|
|
390
|
+
|
|
391
|
+
__m256i bytes = lasx_shuffle_b(__lasx_xvreplgr2vr_w(x32), shuf_mask);
|
|
392
|
+
const __m256i bit_mask = __lasx_xvreplgr2vr_d(0x7fbfdfeff7fbfdfe);
|
|
393
|
+
bytes = __lasx_xvor_v(bytes, bit_mask);
|
|
394
|
+
return __lasx_xvseq_b(bytes, __lasx_xvreplgr2vr_d(-1));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Unpack 32 4-bit fields into 32 bytes
|
|
398
|
+
// The output vector contains 32 bytes, each one in [ 0 .. 15 ] interval
|
|
399
|
+
static inline __m256i bytes_from_nibbles_32(const uint8_t * rsi) {
|
|
400
|
+
const __m128i lo = __lsx_vld((const __m128i *)rsi, 0);
|
|
401
|
+
__m128i hi = __lsx_vsrli_h(lo, 4);
|
|
402
|
+
return __lasx_xvandi_b(lasx_insertf128(hi, lo), 0xf);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// add int16_t pairwise and return as float vector
|
|
406
|
+
static inline __m256 sum_i16_pairs_float(const __m256i x) {
|
|
407
|
+
__m256i v = __lasx_xvpackod_h(x, x);
|
|
408
|
+
__m256i summed_pairs = __lasx_xvaddwev_w_h(x, v);
|
|
409
|
+
return __lasx_xvffint_s_w(summed_pairs);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
static inline __m256 mul_sum_us8_pairs_float(const __m256i ax, const __m256i sy) {
|
|
413
|
+
// Perform multiplication and create 16-bit values
|
|
414
|
+
const __m256i dot = lasx_maddubs_h(ax, sy);
|
|
415
|
+
return sum_i16_pairs_float(dot);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// multiply int8_t, add results pairwise twice and return as float vector
|
|
419
|
+
static inline __m256 mul_sum_i8_pairs_float(const __m256i x, const __m256i y) {
|
|
420
|
+
const __m256i dot = lasx_madd_h_b(x, y);
|
|
421
|
+
return sum_i16_pairs_float(dot);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
static inline __m128i packNibbles( __m256i bytes ) {
|
|
425
|
+
// Move bits within 16-bit lanes from 0000_abcd_0000_efgh into 0000_0000_abcd_efgh
|
|
426
|
+
const __m256i lowByte = __lasx_xvreplgr2vr_h(0xFF);
|
|
427
|
+
__m256i high = __lasx_xvandn_v(lowByte, bytes);
|
|
428
|
+
__m256i low = __lasx_xvand_v(lowByte, bytes);
|
|
429
|
+
high = __lasx_xvsrli_h(high, 4);
|
|
430
|
+
bytes = __lasx_xvor_v(low, high);
|
|
431
|
+
// Compress uint16_t lanes into bytes
|
|
432
|
+
__m128i *r0 = (__m128i *)&bytes;
|
|
433
|
+
__m256i tmp_h128 = __lasx_xvpermi_q(bytes, bytes, 0x11);
|
|
434
|
+
__m128i *r1 = (__m128i *)&tmp_h128;
|
|
435
|
+
|
|
436
|
+
__m128i zero = __lsx_vldi(0);
|
|
437
|
+
__m128i tmp, tmp2, tmp3;
|
|
438
|
+
|
|
439
|
+
tmp = __lsx_vmax_h(zero, *r0);
|
|
440
|
+
tmp2 = __lsx_vsat_hu(tmp, 7);
|
|
441
|
+
|
|
442
|
+
tmp = __lsx_vmax_h(zero, *r1);
|
|
443
|
+
tmp3 = __lsx_vsat_hu(tmp, 7);
|
|
444
|
+
return __lsx_vpickev_b(tmp3, tmp2);
|
|
445
|
+
}
|
|
446
|
+
#endif //__loongarch_asx
|
|
447
|
+
|
|
448
|
+
void quantize_row_q8_0(const float * GGML_RESTRICT x, void * GGML_RESTRICT vy, int64_t k) {
|
|
449
|
+
assert(QK8_0 == 32);
|
|
450
|
+
assert(k % QK8_0 == 0);
|
|
451
|
+
const int nb = k / QK8_0;
|
|
452
|
+
|
|
453
|
+
block_q8_0 * GGML_RESTRICT y = vy;
|
|
454
|
+
|
|
455
|
+
#if defined(__loongarch_asx)
|
|
456
|
+
for (int i = 0; i < nb; i++) {
|
|
457
|
+
__m256 v0 = (__m256)__lasx_xvld( x , 0);
|
|
458
|
+
__m256 v1 = (__m256)__lasx_xvld( x , 32);
|
|
459
|
+
__m256 v2 = (__m256)__lasx_xvld( x , 64);
|
|
460
|
+
__m256 v3 = (__m256)__lasx_xvld( x , 96);
|
|
461
|
+
x += 32;
|
|
462
|
+
|
|
463
|
+
// Compute max(abs(e)) for the block
|
|
464
|
+
const __m256 sign_bit = __lasx_xvreplfr2vr_s( -0.0f );
|
|
465
|
+
__m256 max_abs = (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v0 );
|
|
466
|
+
max_abs = __lasx_xvfmax_s( max_abs, (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v1 ) );
|
|
467
|
+
max_abs = __lasx_xvfmax_s( max_abs, (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v2 ) );
|
|
468
|
+
max_abs = __lasx_xvfmax_s( max_abs, (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v3 ) );
|
|
469
|
+
|
|
470
|
+
__m128 max4 = __lsx_vfmax_s( lasx_extractf128( max_abs, 1 ), lasx_extractf128( max_abs , 0) );
|
|
471
|
+
max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vpickod_d((__m128i) max4, (__m128i)max4 ) );
|
|
472
|
+
__m128 tmp = max4;
|
|
473
|
+
max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vinsgr2vr_w(tmp, __lsx_vpickve2gr_w( max4, 1 ), 0 ));
|
|
474
|
+
const float max_scalar = ((v4f32)max4)[0];
|
|
475
|
+
|
|
476
|
+
// Quantize these floats
|
|
477
|
+
const float d = max_scalar / 127.f;
|
|
478
|
+
y[i].d = GGML_CPU_FP32_TO_FP16(d);
|
|
479
|
+
const float id = ( max_scalar != 0.0f ) ? 127.f / max_scalar : 0.0f;
|
|
480
|
+
const __m256 mul = (__m256)__lasx_xvreplfr2vr_s( id );
|
|
481
|
+
|
|
482
|
+
// Apply the multiplier
|
|
483
|
+
v0 = __lasx_xvfmul_s( v0, mul );
|
|
484
|
+
v1 = __lasx_xvfmul_s( v1, mul );
|
|
485
|
+
v2 = __lasx_xvfmul_s( v2, mul );
|
|
486
|
+
v3 = __lasx_xvfmul_s( v3, mul );
|
|
487
|
+
|
|
488
|
+
// Round to nearest integer
|
|
489
|
+
__m256i i0 = __lasx_xvftintrne_w_s( v0 );
|
|
490
|
+
__m256i i1 = __lasx_xvftintrne_w_s( v1 );
|
|
491
|
+
__m256i i2 = __lasx_xvftintrne_w_s( v2 );
|
|
492
|
+
__m256i i3 = __lasx_xvftintrne_w_s( v3 );
|
|
493
|
+
|
|
494
|
+
__m128i ni0 = lasx_extracti128( i0, 0 );
|
|
495
|
+
__m128i ni1 = lasx_extracti128( i0, 1);
|
|
496
|
+
__m128i ni2 = lasx_extracti128( i1, 0);
|
|
497
|
+
__m128i ni3 = lasx_extracti128( i1, 1);
|
|
498
|
+
__m128i ni4 = lasx_extracti128( i2, 0);
|
|
499
|
+
__m128i ni5 = lasx_extracti128( i2, 1);
|
|
500
|
+
__m128i ni6 = lasx_extracti128( i3, 0);
|
|
501
|
+
__m128i ni7 = lasx_extracti128( i3, 1);
|
|
502
|
+
|
|
503
|
+
// Convert int32 to int16
|
|
504
|
+
ni0 = lsx_packs_w( ni0, ni1 );
|
|
505
|
+
ni2 = lsx_packs_w( ni2, ni3 );
|
|
506
|
+
ni4 = lsx_packs_w( ni4, ni5 );
|
|
507
|
+
ni6 = lsx_packs_w( ni6, ni7 );
|
|
508
|
+
// Convert int16 to int8
|
|
509
|
+
ni0 = lsx_packs_h( ni0, ni2 );
|
|
510
|
+
ni4 = lsx_packs_h( ni4, ni6 );
|
|
511
|
+
|
|
512
|
+
__lsx_vst(ni0, (__m128i *)(y[i].qs + 0), 0);
|
|
513
|
+
__lsx_vst(ni4, (__m128i *)(y[i].qs + 16), 0);
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
#else
|
|
517
|
+
GGML_UNUSED(nb);
|
|
518
|
+
// scalar
|
|
519
|
+
quantize_row_q8_0_ref(x, y, k);
|
|
520
|
+
#endif
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
void quantize_row_q8_1(const float * GGML_RESTRICT x, void * GGML_RESTRICT vy, int64_t k) {
|
|
524
|
+
assert(k % QK8_1 == 0);
|
|
525
|
+
const int nb = k / QK8_1;
|
|
526
|
+
|
|
527
|
+
block_q8_1 * GGML_RESTRICT y = vy;
|
|
528
|
+
|
|
529
|
+
#if defined(__loongarch_asx)
|
|
530
|
+
for (int i = 0; i < nb; i++) {
|
|
531
|
+
__m256 v0 = (__m256)__lasx_xvld( x , 0 );
|
|
532
|
+
__m256 v1 = (__m256)__lasx_xvld( x , 32 );
|
|
533
|
+
__m256 v2 = (__m256)__lasx_xvld( x , 64 );
|
|
534
|
+
__m256 v3 = (__m256)__lasx_xvld( x , 96 );
|
|
535
|
+
x += 32;
|
|
536
|
+
|
|
537
|
+
// Compute max(abs(e)) for the block
|
|
538
|
+
const __m256 sign_bit = __lasx_xvreplfr2vr_s( -0.0f );
|
|
539
|
+
__m256 max_abs = (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v0 );
|
|
540
|
+
max_abs = __lasx_xvfmax_s( max_abs, (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v1 ) );
|
|
541
|
+
max_abs = __lasx_xvfmax_s( max_abs, (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v2 ) );
|
|
542
|
+
max_abs = __lasx_xvfmax_s( max_abs, (__m256)__lasx_xvandn_v( (__m256i)sign_bit, (__m256i)v3 ) );
|
|
543
|
+
|
|
544
|
+
__m128 max4 = __lsx_vfmax_s( lasx_extractf128( max_abs, 1 ), lasx_extractf128( max_abs, 0) );
|
|
545
|
+
max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vpickod_d((__m128i) max4, (__m128i)max4 ) );
|
|
546
|
+
__m128 tmp = max4;
|
|
547
|
+
max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vextrins_w((__m128i)tmp, (__m128i)max4, 0x1 ));
|
|
548
|
+
const float max_scalar = ((v4f32)max4)[0];
|
|
549
|
+
|
|
550
|
+
// Quantize these floats
|
|
551
|
+
const float d = max_scalar / 127.f;
|
|
552
|
+
y[i].d = GGML_CPU_FP32_TO_FP16(d);
|
|
553
|
+
const float id = ( max_scalar != 0.0f ) ? 127.f / max_scalar : 0.0f;
|
|
554
|
+
const __m256 mul = __lasx_xvreplfr2vr_s( id );
|
|
555
|
+
|
|
556
|
+
// Apply the multiplier
|
|
557
|
+
v0 = __lasx_xvfmul_s( v0, mul );
|
|
558
|
+
v1 = __lasx_xvfmul_s( v1, mul );
|
|
559
|
+
v2 = __lasx_xvfmul_s( v2, mul );
|
|
560
|
+
v3 = __lasx_xvfmul_s( v3, mul );
|
|
561
|
+
|
|
562
|
+
// Round to nearest integer
|
|
563
|
+
__m256i i0 = __lasx_xvftintrne_w_s( v0 );
|
|
564
|
+
__m256i i1 = __lasx_xvftintrne_w_s( v1 );
|
|
565
|
+
__m256i i2 = __lasx_xvftintrne_w_s( v2 );
|
|
566
|
+
__m256i i3 = __lasx_xvftintrne_w_s( v3 );
|
|
567
|
+
|
|
568
|
+
__m128i ni0 = lasx_extracti128(i0, 0);
|
|
569
|
+
__m128i ni1 = lasx_extracti128( i0, 1);
|
|
570
|
+
__m128i ni2 = lasx_extracti128( i1, 0);
|
|
571
|
+
__m128i ni3 = lasx_extracti128( i1, 1);
|
|
572
|
+
__m128i ni4 = lasx_extracti128( i2, 0 );
|
|
573
|
+
__m128i ni5 = lasx_extracti128( i2, 1);
|
|
574
|
+
__m128i ni6 = lasx_extracti128( i3, 0);
|
|
575
|
+
__m128i ni7 = lasx_extracti128( i3, 1);
|
|
576
|
+
|
|
577
|
+
// Compute the sum of the quants and set y[i].s
|
|
578
|
+
const __m128i s0 = __lsx_vadd_w(__lsx_vadd_w(ni0, ni1), __lsx_vadd_w(ni2, ni3));
|
|
579
|
+
const __m128i s1 = __lsx_vadd_w(__lsx_vadd_w(ni4, ni5), __lsx_vadd_w(ni6, ni7));
|
|
580
|
+
y[i].s = GGML_CPU_FP32_TO_FP16(d * hsum_i32_4(__lsx_vadd_w(s0, s1)));
|
|
581
|
+
|
|
582
|
+
// Convert int32 to int16
|
|
583
|
+
ni0 = lsx_packs_w( ni0, ni1 );
|
|
584
|
+
ni2 = lsx_packs_w( ni2, ni3 );
|
|
585
|
+
ni4 = lsx_packs_w( ni4, ni5 );
|
|
586
|
+
ni6 = lsx_packs_w( ni6, ni7 );
|
|
587
|
+
// Convert int16 to int8
|
|
588
|
+
ni0 = lsx_packs_h( ni0, ni2 );
|
|
589
|
+
ni4 = lsx_packs_h( ni4, ni6 );
|
|
590
|
+
|
|
591
|
+
__lsx_vst(ni0, (__m128i *)(y[i].qs + 0), 0);
|
|
592
|
+
__lsx_vst(ni4, (__m128i *)(y[i].qs + 16), 0);
|
|
593
|
+
}
|
|
594
|
+
#else
|
|
595
|
+
GGML_UNUSED(nb);
|
|
596
|
+
// scalar
|
|
597
|
+
quantize_row_q8_1_ref(x, y, k);
|
|
598
|
+
#endif
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
//===================================== Dot products =================================
|
|
603
|
+
|
|
604
|
+
//
|
|
605
|
+
// Helper functions
|
|
606
|
+
//
|
|
607
|
+
|
|
608
|
+
#if defined(__loongarch_asx)
|
|
609
|
+
// shuffles to pick the required scales in dot products
|
|
610
|
+
static inline __m256i get_scale_shuffle_q3k(int i) {
|
|
611
|
+
static const uint8_t k_shuffle[128] = {
|
|
612
|
+
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
|
613
|
+
4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,
|
|
614
|
+
8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,
|
|
615
|
+
12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13, 14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,
|
|
616
|
+
};
|
|
617
|
+
return __lasx_xvld((const __m256i*)k_shuffle + i, 0);
|
|
618
|
+
}
|
|
619
|
+
static inline __m256i get_scale_shuffle_k4(int i) {
|
|
620
|
+
static const uint8_t k_shuffle[256] = {
|
|
621
|
+
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
|
622
|
+
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
|
623
|
+
4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5,
|
|
624
|
+
6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,
|
|
625
|
+
8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9,
|
|
626
|
+
10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,
|
|
627
|
+
12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13,
|
|
628
|
+
14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15
|
|
629
|
+
};
|
|
630
|
+
return __lasx_xvld((const __m256i*)k_shuffle + i, 0);
|
|
631
|
+
}
|
|
632
|
+
static inline __m128i get_scale_shuffle(int i) {
|
|
633
|
+
static const uint8_t k_shuffle[128] = {
|
|
634
|
+
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
635
|
+
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
636
|
+
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
|
|
637
|
+
6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
638
|
+
8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,
|
|
639
|
+
10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,
|
|
640
|
+
12,12,12,12,12,12,12,12, 13,13,13,13,13,13,13,13,
|
|
641
|
+
14,14,14,14,14,14,14,14, 15,15,15,15,15,15,15,15
|
|
642
|
+
};
|
|
643
|
+
return __lsx_vld((const __m128i*)k_shuffle + i, 0);
|
|
644
|
+
}
|
|
645
|
+
#endif
|
|
646
|
+
|
|
647
|
+
void ggml_vec_dot_q4_0_q8_0(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
648
|
+
const int qk = QK8_0;
|
|
649
|
+
const int nb = n / qk;
|
|
650
|
+
|
|
651
|
+
assert(n % qk == 0);
|
|
652
|
+
assert(nrc == 1);
|
|
653
|
+
UNUSED(nrc);
|
|
654
|
+
UNUSED(bx);
|
|
655
|
+
UNUSED(by);
|
|
656
|
+
UNUSED(bs);
|
|
657
|
+
|
|
658
|
+
const block_q4_0 * GGML_RESTRICT x = vx;
|
|
659
|
+
const block_q8_0 * GGML_RESTRICT y = vy;
|
|
660
|
+
|
|
661
|
+
int ib = 0;
|
|
662
|
+
float sumf = 0;
|
|
663
|
+
|
|
664
|
+
#if defined(__loongarch_asx)
|
|
665
|
+
// Initialize accumulator with zeros
|
|
666
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
667
|
+
|
|
668
|
+
// Main loop
|
|
669
|
+
for (; ib < nb; ++ib) {
|
|
670
|
+
/* Compute combined scale for the block */
|
|
671
|
+
const __m256 d = __lasx_xvreplfr2vr_s( GGML_CPU_FP16_TO_FP32(x[ib].d) * GGML_CPU_FP16_TO_FP32(y[ib].d) );
|
|
672
|
+
|
|
673
|
+
__m256i qx = bytes_from_nibbles_32(x[ib].qs);
|
|
674
|
+
|
|
675
|
+
// Now we have a vector with bytes in [ 0 .. 15 ] interval. Offset them into [ -8 .. +7 ] interval.
|
|
676
|
+
const __m256i off = __lasx_xvreplgr2vr_b( 8 );
|
|
677
|
+
qx = __lasx_xvsub_b( qx, off );
|
|
678
|
+
|
|
679
|
+
__m256i qy = __lasx_xvld((const __m256i *)y[ib].qs, 0);
|
|
680
|
+
|
|
681
|
+
const __m256 q = mul_sum_i8_pairs_float(qx, qy);
|
|
682
|
+
|
|
683
|
+
/* Multiply q with scale and accumulate */
|
|
684
|
+
acc = __lasx_xvfmadd_s( d, q, acc );
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
sumf = hsum_float_8(acc);
|
|
688
|
+
|
|
689
|
+
#elif defined(__loongarch_sx)
|
|
690
|
+
// set constants
|
|
691
|
+
const __m128i low_mask = __lsx_vreplgr2vr_b(0xF);
|
|
692
|
+
const __m128i off = __lsx_vreplgr2vr_b(8);
|
|
693
|
+
|
|
694
|
+
// Initialize accumulator with zeros
|
|
695
|
+
__m128 acc_0 = (__m128)__lsx_vldi(0);
|
|
696
|
+
__m128 acc_1 = (__m128)__lsx_vldi(0);
|
|
697
|
+
__m128 acc_2 = (__m128)__lsx_vldi(0);
|
|
698
|
+
__m128 acc_3 = (__m128)__lsx_vldi(0);
|
|
699
|
+
|
|
700
|
+
for (; ib + 1 < nb; ib += 2) {
|
|
701
|
+
|
|
702
|
+
// Compute combined scale for the block 0 and 1
|
|
703
|
+
const float ft0 = GGML_CPU_FP16_TO_FP32(x[ib].d) * GGML_CPU_FP16_TO_FP32(y[ib].d);
|
|
704
|
+
const __m128 d_0_1 = (__m128)(v4f32){ft0, ft0, ft0, ft0};
|
|
705
|
+
|
|
706
|
+
const __m128i tmp_0_1 = __lsx_vld((const __m128i *)x[ib].qs, 0);
|
|
707
|
+
|
|
708
|
+
__m128i bx_0 = __lsx_vand_v(low_mask, tmp_0_1);
|
|
709
|
+
__m128i by_0 = __lsx_vld((const __m128i *)y[ib].qs, 0);
|
|
710
|
+
bx_0 = __lsx_vsub_b(bx_0, off);
|
|
711
|
+
const __m128i i32_0 = mul_sum_i8_pairs(bx_0, by_0);
|
|
712
|
+
|
|
713
|
+
__m128i bx_1 = __lsx_vand_v(low_mask, __lsx_vsrli_d(tmp_0_1, 4));
|
|
714
|
+
__m128i by_1 = __lsx_vld((const __m128i *)(y[ib].qs + 16), 0);
|
|
715
|
+
bx_1 = __lsx_vsub_b(bx_1, off);
|
|
716
|
+
const __m128i i32_1 = mul_sum_i8_pairs(bx_1, by_1);
|
|
717
|
+
|
|
718
|
+
// Compute combined scale for the block 2 and 3
|
|
719
|
+
const float ft1 = GGML_CPU_FP16_TO_FP32(x[ib + 1].d) * GGML_CPU_FP16_TO_FP32(y[ib + 1].d);
|
|
720
|
+
const __m128 d_2_3 = (__m128)(v4f32){ft1, ft1, ft1, ft1};
|
|
721
|
+
|
|
722
|
+
const __m128i tmp_2_3 = __lsx_vld((const __m128i *)x[ib + 1].qs, 0);
|
|
723
|
+
|
|
724
|
+
__m128i bx_2 = __lsx_vand_v(low_mask, tmp_2_3);
|
|
725
|
+
__m128i by_2 = __lsx_vld((const __m128i *)y[ib + 1].qs, 0);
|
|
726
|
+
bx_2 = __lsx_vsub_b(bx_2, off);
|
|
727
|
+
const __m128i i32_2 = mul_sum_i8_pairs(bx_2, by_2);
|
|
728
|
+
|
|
729
|
+
__m128i bx_3 = __lsx_vand_v(low_mask, __lsx_vsrli_d(tmp_2_3, 4));
|
|
730
|
+
__m128i by_3 = __lsx_vld((const __m128i *)(y[ib + 1].qs + 16), 0);
|
|
731
|
+
bx_3 = __lsx_vsub_b(bx_3, off);
|
|
732
|
+
const __m128i i32_3 = mul_sum_i8_pairs(bx_3, by_3);
|
|
733
|
+
|
|
734
|
+
// Convert int32_t to float
|
|
735
|
+
__m128 p0 = __lsx_vffint_s_w(i32_0);
|
|
736
|
+
__m128 p1 = __lsx_vffint_s_w(i32_1);
|
|
737
|
+
__m128 p2 = __lsx_vffint_s_w(i32_2);
|
|
738
|
+
__m128 p3 = __lsx_vffint_s_w(i32_3);
|
|
739
|
+
|
|
740
|
+
// Apply the scale
|
|
741
|
+
__m128 p0_d = __lsx_vfmul_s( d_0_1, p0 );
|
|
742
|
+
__m128 p1_d = __lsx_vfmul_s( d_0_1, p1 );
|
|
743
|
+
__m128 p2_d = __lsx_vfmul_s( d_2_3, p2 );
|
|
744
|
+
__m128 p3_d = __lsx_vfmul_s( d_2_3, p3 );
|
|
745
|
+
|
|
746
|
+
// Acummulate
|
|
747
|
+
acc_0 = __lsx_vfadd_s(p0_d, acc_0);
|
|
748
|
+
acc_1 = __lsx_vfadd_s(p1_d, acc_1);
|
|
749
|
+
acc_2 = __lsx_vfadd_s(p2_d, acc_2);
|
|
750
|
+
acc_3 = __lsx_vfadd_s(p3_d, acc_3);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
sumf = hsum_float_4x4(acc_0, acc_1, acc_2, acc_3);
|
|
754
|
+
|
|
755
|
+
#endif
|
|
756
|
+
for (; ib < nb; ++ib) {
|
|
757
|
+
int sumi0 = 0;
|
|
758
|
+
int sumi1 = 0;
|
|
759
|
+
|
|
760
|
+
for (int j = 0; j < qk/2; ++j) {
|
|
761
|
+
const int v0 = (x[ib].qs[j] & 0x0F) - 8;
|
|
762
|
+
const int v1 = (x[ib].qs[j] >> 4) - 8;
|
|
763
|
+
|
|
764
|
+
sumi0 += (v0 * y[ib].qs[j]);
|
|
765
|
+
sumi1 += (v1 * y[ib].qs[j + qk/2]);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
int sumi = sumi0 + sumi1;
|
|
769
|
+
sumf += sumi*GGML_CPU_FP16_TO_FP32(x[ib].d)*GGML_CPU_FP16_TO_FP32(y[ib].d);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
*s = sumf;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
void ggml_vec_dot_q4_1_q8_1(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
776
|
+
const int qk = QK8_1;
|
|
777
|
+
const int nb = n / qk;
|
|
778
|
+
|
|
779
|
+
assert(n % qk == 0);
|
|
780
|
+
assert(nrc == 1);
|
|
781
|
+
UNUSED(nrc);
|
|
782
|
+
UNUSED(bx);
|
|
783
|
+
UNUSED(by);
|
|
784
|
+
UNUSED(bs);
|
|
785
|
+
|
|
786
|
+
const block_q4_1 * GGML_RESTRICT x = vx;
|
|
787
|
+
const block_q8_1 * GGML_RESTRICT y = vy;
|
|
788
|
+
|
|
789
|
+
int ib = 0;
|
|
790
|
+
float sumf = 0;
|
|
791
|
+
|
|
792
|
+
#if defined(__loongarch_asx)
|
|
793
|
+
// Initialize accumulator with zeros
|
|
794
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
795
|
+
|
|
796
|
+
float summs = 0;
|
|
797
|
+
|
|
798
|
+
// Main loop
|
|
799
|
+
for (; ib < nb; ++ib) {
|
|
800
|
+
const float d0 = GGML_CPU_FP16_TO_FP32(x[ib].d);
|
|
801
|
+
const float d1 = GGML_CPU_FP16_TO_FP32(y[ib].d);
|
|
802
|
+
|
|
803
|
+
summs += GGML_CPU_FP16_TO_FP32(x[ib].m) * GGML_CPU_FP16_TO_FP32(y[ib].s);
|
|
804
|
+
|
|
805
|
+
const __m256 d0v = __lasx_xvreplfr2vr_s( d0 );
|
|
806
|
+
const __m256 d1v = __lasx_xvreplfr2vr_s( d1 );
|
|
807
|
+
|
|
808
|
+
// Compute combined scales
|
|
809
|
+
const __m256 d0d1 = __lasx_xvfmul_s( d0v, d1v );
|
|
810
|
+
|
|
811
|
+
// Load 16 bytes, and unpack 4 bit fields into bytes, making 32 bytes
|
|
812
|
+
const __m256i qx = bytes_from_nibbles_32(x[ib].qs);
|
|
813
|
+
const __m256i qy = __lasx_xvld( (const __m256i *)y[ib].qs, 0);
|
|
814
|
+
|
|
815
|
+
const __m256 xy = mul_sum_us8_pairs_float(qx, qy);
|
|
816
|
+
|
|
817
|
+
// Accumulate d0*d1*x*y
|
|
818
|
+
acc = __lasx_xvfmadd_s( d0d1, xy, acc );
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
sumf = hsum_float_8(acc) + summs;
|
|
822
|
+
|
|
823
|
+
*s = sumf;
|
|
824
|
+
#else
|
|
825
|
+
UNUSED(nb);
|
|
826
|
+
UNUSED(x);
|
|
827
|
+
UNUSED(y);
|
|
828
|
+
UNUSED(ib);
|
|
829
|
+
UNUSED(sumf);
|
|
830
|
+
ggml_vec_dot_q4_1_q8_1_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
831
|
+
#endif
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
void ggml_vec_dot_q5_0_q8_0(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
835
|
+
const int qk = QK8_0;
|
|
836
|
+
const int nb = n / qk;
|
|
837
|
+
|
|
838
|
+
int ib = 0;
|
|
839
|
+
float sumf = 0;
|
|
840
|
+
|
|
841
|
+
assert(n % qk == 0);
|
|
842
|
+
assert(qk == QK5_0);
|
|
843
|
+
assert(nrc == 1);
|
|
844
|
+
UNUSED(nrc);
|
|
845
|
+
UNUSED(bx);
|
|
846
|
+
UNUSED(by);
|
|
847
|
+
UNUSED(bs);
|
|
848
|
+
|
|
849
|
+
const block_q5_0 * GGML_RESTRICT x = vx;
|
|
850
|
+
const block_q8_0 * GGML_RESTRICT y = vy;
|
|
851
|
+
|
|
852
|
+
#if defined(__loongarch_asx)
|
|
853
|
+
// Initialize accumulator with zeros
|
|
854
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
855
|
+
|
|
856
|
+
// Main loop
|
|
857
|
+
for (; ib < nb; ++ib) {
|
|
858
|
+
/* Compute combined scale for the block */
|
|
859
|
+
const __m256 d = __lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(x[ib].d) * GGML_CPU_FP16_TO_FP32(y[ib].d)); //FIXME
|
|
860
|
+
|
|
861
|
+
__m256i qx = bytes_from_nibbles_32(x[ib].qs);
|
|
862
|
+
__m256i bxhi = bytes_from_bits_32(x[ib].qh);
|
|
863
|
+
bxhi = __lasx_xvandn_v(bxhi, __lasx_xvreplgr2vr_b((char)0xF0));
|
|
864
|
+
qx = __lasx_xvor_v(qx, bxhi);
|
|
865
|
+
|
|
866
|
+
__m256i qy = __lasx_xvld((const __m256i *)y[ib].qs, 0);
|
|
867
|
+
|
|
868
|
+
const __m256 q = mul_sum_i8_pairs_float(qx, qy);
|
|
869
|
+
|
|
870
|
+
/* Multiply q with scale and accumulate */
|
|
871
|
+
acc = __lasx_xvfmadd_s(d, q, acc);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
sumf = hsum_float_8(acc);
|
|
875
|
+
|
|
876
|
+
*s = sumf;
|
|
877
|
+
#else
|
|
878
|
+
UNUSED(nb);
|
|
879
|
+
UNUSED(ib);
|
|
880
|
+
UNUSED(sumf);
|
|
881
|
+
UNUSED(x);
|
|
882
|
+
UNUSED(y);
|
|
883
|
+
ggml_vec_dot_q5_0_q8_0_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
884
|
+
#endif
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
void ggml_vec_dot_q5_1_q8_1(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
888
|
+
const int qk = QK8_1;
|
|
889
|
+
const int nb = n / qk;
|
|
890
|
+
|
|
891
|
+
int ib = 0;
|
|
892
|
+
float sumf = 0;
|
|
893
|
+
|
|
894
|
+
assert(n % qk == 0);
|
|
895
|
+
assert(qk == QK5_1);
|
|
896
|
+
assert(nrc == 1);
|
|
897
|
+
UNUSED(nrc);
|
|
898
|
+
UNUSED(bx);
|
|
899
|
+
UNUSED(by);
|
|
900
|
+
UNUSED(bs);
|
|
901
|
+
|
|
902
|
+
const block_q5_1 * GGML_RESTRICT x = vx;
|
|
903
|
+
const block_q8_1 * GGML_RESTRICT y = vy;
|
|
904
|
+
|
|
905
|
+
#if defined(__loongarch_asx)
|
|
906
|
+
// Initialize accumulator with zeros
|
|
907
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
908
|
+
|
|
909
|
+
float summs = 0.0f;
|
|
910
|
+
|
|
911
|
+
// Main loop
|
|
912
|
+
for (; ib < nb; ++ib) {
|
|
913
|
+
const __m256 dx = __lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(x[ib].d));
|
|
914
|
+
|
|
915
|
+
summs += GGML_CPU_FP16_TO_FP32(x[ib].m) * GGML_CPU_FP16_TO_FP32(y[ib].s);
|
|
916
|
+
|
|
917
|
+
__m256i qx = bytes_from_nibbles_32(x[ib].qs);
|
|
918
|
+
__m256i bxhi = bytes_from_bits_32(x[ib].qh);
|
|
919
|
+
bxhi = __lasx_xvand_v(bxhi, __lasx_xvreplgr2vr_b(0x10));
|
|
920
|
+
qx = __lasx_xvor_v(qx, bxhi);
|
|
921
|
+
|
|
922
|
+
const __m256 dy = __lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(y[ib].d));
|
|
923
|
+
const __m256i qy = __lasx_xvld((const __m256i *)y[ib].qs, 0);
|
|
924
|
+
|
|
925
|
+
const __m256 q = mul_sum_us8_pairs_float(qx, qy);
|
|
926
|
+
|
|
927
|
+
acc = __lasx_xvfmadd_s(q, __lasx_xvfmul_s(dx, dy), acc);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
sumf = hsum_float_8(acc) + summs;
|
|
931
|
+
|
|
932
|
+
*s = sumf;
|
|
933
|
+
#else
|
|
934
|
+
UNUSED(nb);
|
|
935
|
+
UNUSED(ib);
|
|
936
|
+
UNUSED(sumf);
|
|
937
|
+
UNUSED(x);
|
|
938
|
+
UNUSED(y);
|
|
939
|
+
ggml_vec_dot_q5_1_q8_1_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
940
|
+
#endif
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
void ggml_vec_dot_q8_0_q8_0(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
944
|
+
const int qk = QK8_0;
|
|
945
|
+
const int nb = n / qk;
|
|
946
|
+
|
|
947
|
+
assert(n % qk == 0);
|
|
948
|
+
assert(nrc == 1);
|
|
949
|
+
UNUSED(nrc);
|
|
950
|
+
UNUSED(bx);
|
|
951
|
+
UNUSED(by);
|
|
952
|
+
UNUSED(bs);
|
|
953
|
+
|
|
954
|
+
const block_q8_0 * GGML_RESTRICT x = vx;
|
|
955
|
+
const block_q8_0 * GGML_RESTRICT y = vy;
|
|
956
|
+
|
|
957
|
+
int ib = 0;
|
|
958
|
+
float sumf = 0;
|
|
959
|
+
|
|
960
|
+
#if defined(__loongarch_asx)
|
|
961
|
+
// Initialize accumulator with zeros
|
|
962
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
963
|
+
|
|
964
|
+
// Main loop
|
|
965
|
+
for (; ib < nb; ++ib) {
|
|
966
|
+
// Compute combined scale for the block
|
|
967
|
+
const __m256 d = __lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(x[ib].d) * GGML_CPU_FP16_TO_FP32(y[ib].d));
|
|
968
|
+
__m256i qx = __lasx_xvld((const __m256i *)x[ib].qs, 0);
|
|
969
|
+
__m256i qy = __lasx_xvld((const __m256i *)y[ib].qs, 0);
|
|
970
|
+
|
|
971
|
+
const __m256 q = mul_sum_i8_pairs_float(qx, qy);
|
|
972
|
+
|
|
973
|
+
// Multiply q with scale and accumulate
|
|
974
|
+
acc = __lasx_xvfmadd_s( d, q, acc );
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
sumf = hsum_float_8(acc);
|
|
978
|
+
|
|
979
|
+
*s = sumf;
|
|
980
|
+
#else
|
|
981
|
+
UNUSED(nb);
|
|
982
|
+
UNUSED(ib);
|
|
983
|
+
UNUSED(sumf);
|
|
984
|
+
UNUSED(x);
|
|
985
|
+
UNUSED(y);
|
|
986
|
+
ggml_vec_dot_q8_0_q8_0_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
987
|
+
#endif
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
void ggml_vec_dot_q2_K_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
991
|
+
assert(nrc == 1);
|
|
992
|
+
UNUSED(nrc);
|
|
993
|
+
UNUSED(bx);
|
|
994
|
+
UNUSED(by);
|
|
995
|
+
UNUSED(bs);
|
|
996
|
+
|
|
997
|
+
const block_q2_K * GGML_RESTRICT x = vx;
|
|
998
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
999
|
+
|
|
1000
|
+
const int nb = n / QK_K;
|
|
1001
|
+
|
|
1002
|
+
#if defined __loongarch_asx
|
|
1003
|
+
|
|
1004
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
1005
|
+
|
|
1006
|
+
for (int i = 0; i < nb; ++i) {
|
|
1007
|
+
|
|
1008
|
+
const float d = y[i].d * GGML_CPU_FP16_TO_FP32(x[i].d);
|
|
1009
|
+
const float dmin = -y[i].d * GGML_CPU_FP16_TO_FP32(x[i].dmin);
|
|
1010
|
+
|
|
1011
|
+
const uint8_t * GGML_RESTRICT q2 = x[i].qs;
|
|
1012
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1013
|
+
|
|
1014
|
+
const __m128i mins_and_scales128 = __lsx_vld((const __m128i*)x[i].scales, 0);
|
|
1015
|
+
const __m128i scales128 = __lsx_vandi_b(mins_and_scales128, 0xf);
|
|
1016
|
+
const __m256i mins = lasx_ext8_16(__lsx_vsrli_b(mins_and_scales128, 4));
|
|
1017
|
+
const __m256i prod = lasx_madd_h(mins, __lasx_xvld((const __m256i*)y[i].bsums, 0));
|
|
1018
|
+
|
|
1019
|
+
acc = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(dmin), __lasx_xvffint_s_w(prod), acc);
|
|
1020
|
+
|
|
1021
|
+
const v16i8 shuffle_mask = {0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15};
|
|
1022
|
+
const __m256i scales_shuffled = lasx_ext8_16(__lsx_vshuf_b(scales128, scales128, (__m128i)shuffle_mask));
|
|
1023
|
+
|
|
1024
|
+
__m256i sumi = __lasx_xvldi(0);
|
|
1025
|
+
|
|
1026
|
+
for (int j = 0; j < QK_K/128; ++j) {
|
|
1027
|
+
|
|
1028
|
+
const __m256i q2bits = __lasx_xvld((const __m256i*)q2, 0); q2 += 32;
|
|
1029
|
+
|
|
1030
|
+
const __m256i q8_0 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1031
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1032
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1033
|
+
const __m256i q8_3 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1034
|
+
|
|
1035
|
+
const __m256i q2_0 = __lasx_xvandi_b(q2bits, 3);
|
|
1036
|
+
const __m256i q2_1 = __lasx_xvandi_b(__lasx_xvsrli_b(q2bits, 2), 3);
|
|
1037
|
+
const __m256i q2_2 = __lasx_xvandi_b(__lasx_xvsrli_b(q2bits, 4), 3);
|
|
1038
|
+
const __m256i q2_3 = __lasx_xvsrli_b(q2bits, 6);
|
|
1039
|
+
|
|
1040
|
+
__m256i p0 = lasx_madd_h_b(q2_0, q8_0);
|
|
1041
|
+
__m256i p1 = lasx_madd_h_b(q2_1, q8_1);
|
|
1042
|
+
__m256i p2 = lasx_madd_h_b(q2_2, q8_2);
|
|
1043
|
+
__m256i p3 = lasx_madd_h_b(q2_3, q8_3);
|
|
1044
|
+
|
|
1045
|
+
p0 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 0), p0);
|
|
1046
|
+
p1 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 1), p1);
|
|
1047
|
+
p2 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 2), p2);
|
|
1048
|
+
p3 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 3), p3);
|
|
1049
|
+
|
|
1050
|
+
p0 = __lasx_xvadd_w(p0, p1);
|
|
1051
|
+
p2 = __lasx_xvadd_w(p2, p3);
|
|
1052
|
+
|
|
1053
|
+
sumi = __lasx_xvadd_w(sumi, __lasx_xvadd_w(p0, p2));
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
acc = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(sumi), acc);
|
|
1057
|
+
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
*s = hsum_float_8(acc);
|
|
1061
|
+
|
|
1062
|
+
#else
|
|
1063
|
+
UNUSED(x);
|
|
1064
|
+
UNUSED(y);
|
|
1065
|
+
UNUSED(nb);
|
|
1066
|
+
ggml_vec_dot_q2_K_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1067
|
+
#endif
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
void ggml_vec_dot_q3_K_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1071
|
+
assert(n % QK_K == 0);
|
|
1072
|
+
assert(nrc == 1);
|
|
1073
|
+
UNUSED(nrc);
|
|
1074
|
+
UNUSED(bx);
|
|
1075
|
+
UNUSED(by);
|
|
1076
|
+
UNUSED(bs);
|
|
1077
|
+
|
|
1078
|
+
const uint32_t kmask1 = 0x03030303;
|
|
1079
|
+
const uint32_t kmask2 = 0x0f0f0f0f;
|
|
1080
|
+
|
|
1081
|
+
const block_q3_K * GGML_RESTRICT x = vx;
|
|
1082
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1083
|
+
|
|
1084
|
+
const int nb = n / QK_K;
|
|
1085
|
+
|
|
1086
|
+
#if defined __loongarch_asx
|
|
1087
|
+
|
|
1088
|
+
const __m128i m32 = __lsx_vreplgr2vr_b(32);
|
|
1089
|
+
|
|
1090
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
1091
|
+
|
|
1092
|
+
uint32_t aux[3];
|
|
1093
|
+
|
|
1094
|
+
for (int i = 0; i < nb; ++i) {
|
|
1095
|
+
|
|
1096
|
+
const float d = y[i].d * GGML_CPU_FP16_TO_FP32(x[i].d);
|
|
1097
|
+
const uint8_t * GGML_RESTRICT q3 = x[i].qs;
|
|
1098
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1099
|
+
// Set up scales
|
|
1100
|
+
memcpy(aux, x[i].scales, 12);
|
|
1101
|
+
__m128i scales128 = lsx_set_w(
|
|
1102
|
+
((aux[1] >> 4) & kmask2) | (((aux[2] >> 6) & kmask1) << 4),
|
|
1103
|
+
((aux[0] >> 4) & kmask2) | (((aux[2] >> 4) & kmask1) << 4),
|
|
1104
|
+
(aux[1] & kmask2) | (((aux[2] >> 2) & kmask1) << 4),
|
|
1105
|
+
(aux[0] & kmask2) | (((aux[2] >> 0) & kmask1) << 4));
|
|
1106
|
+
scales128 = __lsx_vsub_b(scales128, m32);
|
|
1107
|
+
|
|
1108
|
+
const v16i8 shuffle_mask = {0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15};
|
|
1109
|
+
const __m256i scales_shuffled = lasx_ext8_16(__lsx_vshuf_b(scales128, scales128, (__m128i)shuffle_mask));
|
|
1110
|
+
|
|
1111
|
+
// high bit
|
|
1112
|
+
const __m256i hbits = __lasx_xvld((const __m256i*)x[i].hmask, 0);
|
|
1113
|
+
|
|
1114
|
+
// integer accumulator
|
|
1115
|
+
__m256i sumi = __lasx_xvldi(0);
|
|
1116
|
+
|
|
1117
|
+
for (int j = 0; j < QK_K/128; ++j) {
|
|
1118
|
+
// load low 2 bits
|
|
1119
|
+
const __m256i q3bits = __lasx_xvld((const __m256i*)q3, 0); q3 += 32;
|
|
1120
|
+
|
|
1121
|
+
// prepare low and high bits
|
|
1122
|
+
const __m256i q3l_0 = __lasx_xvandi_b(q3bits, 3);
|
|
1123
|
+
const __m256i q3l_1 = __lasx_xvandi_b(__lasx_xvsrli_b(q3bits, 2), 3);
|
|
1124
|
+
const __m256i q3l_2 = __lasx_xvandi_b(__lasx_xvsrli_b(q3bits, 4), 3);
|
|
1125
|
+
const __m256i q3l_3 = __lasx_xvsrli_b(q3bits, 6);
|
|
1126
|
+
const __m256i q3h_0 = __lasx_xvslli_b(__lasx_xvseqi_b(lasx_xvandi_b_bit(hbits, 4 * j + 0), 0), 2);
|
|
1127
|
+
const __m256i q3h_1 = __lasx_xvslli_b(__lasx_xvseqi_b(lasx_xvandi_b_bit(hbits, 4 * j + 1), 0), 2);
|
|
1128
|
+
const __m256i q3h_2 = __lasx_xvslli_b(__lasx_xvseqi_b(lasx_xvandi_b_bit(hbits, 4 * j + 2), 0), 2);
|
|
1129
|
+
const __m256i q3h_3 = __lasx_xvslli_b(__lasx_xvseqi_b(lasx_xvandi_b_bit(hbits, 4 * j + 3), 0), 2);
|
|
1130
|
+
const __m256i q3_0 = __lasx_xvor_v(q3h_0, q3l_0);
|
|
1131
|
+
const __m256i q3_1 = __lasx_xvor_v(q3h_1, q3l_1);
|
|
1132
|
+
const __m256i q3_2 = __lasx_xvor_v(q3h_2, q3l_2);
|
|
1133
|
+
const __m256i q3_3 = __lasx_xvor_v(q3h_3, q3l_3);
|
|
1134
|
+
|
|
1135
|
+
// load Q8 quants
|
|
1136
|
+
const __m256i q8_0 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1137
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1138
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1139
|
+
const __m256i q8_3 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1140
|
+
|
|
1141
|
+
__m256i p16_0 = lasx_madd_h_b(q8_0, q3_0);
|
|
1142
|
+
__m256i p16_1 = lasx_madd_h_b(q8_1, q3_1);
|
|
1143
|
+
__m256i p16_2 = lasx_madd_h_b(q8_2, q3_2);
|
|
1144
|
+
__m256i p16_3 = lasx_madd_h_b(q8_3, q3_3);
|
|
1145
|
+
|
|
1146
|
+
// multiply with scales
|
|
1147
|
+
p16_0 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 0), p16_0);
|
|
1148
|
+
p16_1 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 1), p16_1);
|
|
1149
|
+
p16_2 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 2), p16_2);
|
|
1150
|
+
p16_3 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 3), p16_3);
|
|
1151
|
+
|
|
1152
|
+
// accumulate
|
|
1153
|
+
p16_0 = __lasx_xvadd_w(p16_0, p16_1);
|
|
1154
|
+
p16_2 = __lasx_xvadd_w(p16_2, p16_3);
|
|
1155
|
+
sumi = __lasx_xvadd_w(sumi, __lasx_xvadd_w(p16_0, p16_2));
|
|
1156
|
+
}
|
|
1157
|
+
// multiply with block scale and accumulate
|
|
1158
|
+
acc = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(sumi), acc);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
*s = hsum_float_8(acc);
|
|
1162
|
+
|
|
1163
|
+
#else
|
|
1164
|
+
UNUSED(kmask1);
|
|
1165
|
+
UNUSED(kmask2);
|
|
1166
|
+
UNUSED(x);
|
|
1167
|
+
UNUSED(y);
|
|
1168
|
+
UNUSED(nb);
|
|
1169
|
+
ggml_vec_dot_q3_K_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1170
|
+
#endif
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
void ggml_vec_dot_q4_K_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1174
|
+
assert(n % QK_K == 0);
|
|
1175
|
+
assert(nrc == 1);
|
|
1176
|
+
UNUSED(nrc);
|
|
1177
|
+
UNUSED(bx);
|
|
1178
|
+
UNUSED(by);
|
|
1179
|
+
UNUSED(bs);
|
|
1180
|
+
|
|
1181
|
+
const block_q4_K * GGML_RESTRICT x = vx;
|
|
1182
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1183
|
+
|
|
1184
|
+
const int nb = n / QK_K;
|
|
1185
|
+
|
|
1186
|
+
static const uint32_t kmask1 = 0x3f3f3f3f;
|
|
1187
|
+
static const uint32_t kmask2 = 0x0f0f0f0f;
|
|
1188
|
+
static const uint32_t kmask3 = 0x03030303;
|
|
1189
|
+
|
|
1190
|
+
uint32_t utmp[4];
|
|
1191
|
+
|
|
1192
|
+
#if defined __loongarch_asx
|
|
1193
|
+
|
|
1194
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
1195
|
+
__m128 acc_m = (__m128)__lsx_vldi(0);
|
|
1196
|
+
|
|
1197
|
+
for (int i = 0; i < nb; ++i) {
|
|
1198
|
+
|
|
1199
|
+
const float d = y[i].d * GGML_CPU_FP16_TO_FP32(x[i].d);
|
|
1200
|
+
const float dmin = -y[i].d * GGML_CPU_FP16_TO_FP32(x[i].dmin);
|
|
1201
|
+
|
|
1202
|
+
memcpy(utmp, x[i].scales, 12);
|
|
1203
|
+
utmp[3] = ((utmp[2] >> 4) & kmask2) | (((utmp[1] >> 6) & kmask3) << 4);
|
|
1204
|
+
const uint32_t uaux = utmp[1] & kmask1;
|
|
1205
|
+
utmp[1] = (utmp[2] & kmask2) | (((utmp[0] >> 6) & kmask3) << 4);
|
|
1206
|
+
utmp[2] = uaux;
|
|
1207
|
+
utmp[0] &= kmask1;
|
|
1208
|
+
|
|
1209
|
+
const uint8_t * GGML_RESTRICT q4 = x[i].qs;
|
|
1210
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1211
|
+
|
|
1212
|
+
const __m128i mins_and_scales128 = lsx_set_w(utmp[3], utmp[2], utmp[1], utmp[0]);
|
|
1213
|
+
const __m128i mins128 = __lsx_vexth_h_b(mins_and_scales128);
|
|
1214
|
+
const __m128i scales128 = __lsx_vsllwil_h_b(mins_and_scales128, 0);
|
|
1215
|
+
|
|
1216
|
+
const __m256i q8sums = __lasx_xvld((const __m256i*)y[i].bsums, 0);
|
|
1217
|
+
const __m128i q8s = lsx_hadd_h(lasx_extracti128(q8sums, 0), lasx_extracti128(q8sums, 1));
|
|
1218
|
+
const __m128i prod = lsx_madd_h(mins128, q8s);
|
|
1219
|
+
acc_m = __lsx_vfmadd_s(__lsx_vreplfr2vr_s(dmin), __lsx_vffint_s_w(prod), acc_m);
|
|
1220
|
+
|
|
1221
|
+
const __m256i scales = lasx_insertf128(scales128, scales128);
|
|
1222
|
+
|
|
1223
|
+
__m256i sumi = __lasx_xvldi(0);
|
|
1224
|
+
|
|
1225
|
+
for (int j = 0; j < QK_K/64; ++j) {
|
|
1226
|
+
|
|
1227
|
+
const __m256i scale_l = lasx_xvrepl128vei_h(scales, 2 * j + 0);
|
|
1228
|
+
const __m256i scale_h = lasx_xvrepl128vei_h(scales, 2 * j + 1);
|
|
1229
|
+
|
|
1230
|
+
const __m256i q4bits = __lasx_xvld((const __m256i*)q4, 0); q4 += 32;
|
|
1231
|
+
const __m256i q4l = __lasx_xvandi_b(q4bits, 0xf);
|
|
1232
|
+
const __m256i q4h = __lasx_xvsrli_b(q4bits, 4);
|
|
1233
|
+
|
|
1234
|
+
const __m256i q8l = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1235
|
+
__m256i p16l = lasx_madd_h_b(q4l, q8l);
|
|
1236
|
+
p16l = lasx_madd_h(scale_l, p16l);
|
|
1237
|
+
|
|
1238
|
+
const __m256i q8h = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1239
|
+
__m256i p16h = lasx_madd_h_b(q4h, q8h);
|
|
1240
|
+
p16h = lasx_madd_h(scale_h, p16h);
|
|
1241
|
+
const __m256i sumj = __lasx_xvadd_w(p16l, p16h);
|
|
1242
|
+
|
|
1243
|
+
sumi = __lasx_xvadd_w(sumi, sumj);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
__m256 vd = __lasx_xvreplfr2vr_s(d);
|
|
1247
|
+
acc = __lasx_xvfmadd_s(vd, __lasx_xvffint_s_w(sumi), acc);
|
|
1248
|
+
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
acc_m = __lsx_vfadd_s(acc_m, (__m128)__lsx_vpermi_w((__m128i)acc_m, (__m128i)acc_m, 0xee));
|
|
1252
|
+
__m128i tmp1 = __lsx_vinsgr2vr_w(__lsx_vldi(0), __lsx_vpickve2gr_w((__m128i)acc_m, 1), 0);
|
|
1253
|
+
acc_m = __lsx_vfadd_s(acc_m, (__m128)tmp1);
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
*s = hsum_float_8(acc) + ((v4f32)acc_m)[0];
|
|
1257
|
+
|
|
1258
|
+
#else
|
|
1259
|
+
UNUSED(x);
|
|
1260
|
+
UNUSED(y);
|
|
1261
|
+
UNUSED(nb);
|
|
1262
|
+
UNUSED(kmask1);
|
|
1263
|
+
UNUSED(kmask2);
|
|
1264
|
+
UNUSED(kmask3);
|
|
1265
|
+
UNUSED(utmp);
|
|
1266
|
+
ggml_vec_dot_q4_K_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1267
|
+
#endif
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
void ggml_vec_dot_q5_K_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1271
|
+
assert(n % QK_K == 0);
|
|
1272
|
+
assert(nrc == 1);
|
|
1273
|
+
UNUSED(nrc);
|
|
1274
|
+
UNUSED(bx);
|
|
1275
|
+
UNUSED(by);
|
|
1276
|
+
UNUSED(bs);
|
|
1277
|
+
|
|
1278
|
+
const block_q5_K * GGML_RESTRICT x = vx;
|
|
1279
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1280
|
+
|
|
1281
|
+
const int nb = n / QK_K;
|
|
1282
|
+
|
|
1283
|
+
static const uint32_t kmask1 = 0x3f3f3f3f;
|
|
1284
|
+
static const uint32_t kmask2 = 0x0f0f0f0f;
|
|
1285
|
+
static const uint32_t kmask3 = 0x03030303;
|
|
1286
|
+
|
|
1287
|
+
uint32_t utmp[4];
|
|
1288
|
+
|
|
1289
|
+
#if defined __loongarch_asx
|
|
1290
|
+
|
|
1291
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
1292
|
+
__m128 acc_m = (__m128)__lsx_vldi(0);
|
|
1293
|
+
|
|
1294
|
+
for (int i = 0; i < nb; ++i) {
|
|
1295
|
+
|
|
1296
|
+
const uint8_t * GGML_RESTRICT q5 = x[i].qs;
|
|
1297
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1298
|
+
|
|
1299
|
+
const float d = y[i].d * GGML_CPU_FP16_TO_FP32(x[i].d);
|
|
1300
|
+
const float dmin = -y[i].d * GGML_CPU_FP16_TO_FP32(x[i].dmin);
|
|
1301
|
+
|
|
1302
|
+
memcpy(utmp, x[i].scales, 12);
|
|
1303
|
+
utmp[3] = ((utmp[2] >> 4) & kmask2) | (((utmp[1] >> 6) & kmask3) << 4);
|
|
1304
|
+
const uint32_t uaux = utmp[1] & kmask1;
|
|
1305
|
+
utmp[1] = (utmp[2] & kmask2) | (((utmp[0] >> 6) & kmask3) << 4);
|
|
1306
|
+
utmp[2] = uaux;
|
|
1307
|
+
utmp[0] &= kmask1;
|
|
1308
|
+
|
|
1309
|
+
const __m128i mins_and_scales128 = lsx_set_w(utmp[3], utmp[2], utmp[1], utmp[0]);
|
|
1310
|
+
const __m128i mins128 = __lsx_vexth_h_b(mins_and_scales128);
|
|
1311
|
+
const __m128i scales128 = __lsx_vsllwil_h_b(mins_and_scales128, 0);
|
|
1312
|
+
|
|
1313
|
+
const __m256i q8sums = __lasx_xvld((const __m256i*)y[i].bsums, 0);
|
|
1314
|
+
const __m128i q8s = lsx_hadd_h(lasx_extracti128(q8sums, 0), lasx_extracti128(q8sums, 1));
|
|
1315
|
+
const __m128i prod = lsx_madd_h(mins128, q8s);
|
|
1316
|
+
acc_m = __lsx_vfmadd_s(__lsx_vreplfr2vr_s(dmin), __lsx_vffint_s_w(prod), acc_m);
|
|
1317
|
+
|
|
1318
|
+
const __m256i scales = lasx_insertf128(scales128, scales128);
|
|
1319
|
+
|
|
1320
|
+
const __m256i hbits = __lasx_xvld((const __m256i*)x[i].qh, 0);
|
|
1321
|
+
|
|
1322
|
+
__m256i sumi = __lasx_xvldi(0);
|
|
1323
|
+
|
|
1324
|
+
for (int j = 0; j < QK_K/64; ++j) {
|
|
1325
|
+
|
|
1326
|
+
const __m256i scale_0 = lasx_xvrepl128vei_h(scales, 2 * j + 0);
|
|
1327
|
+
const __m256i scale_1 = lasx_xvrepl128vei_h(scales, 2 * j + 1);
|
|
1328
|
+
|
|
1329
|
+
const __m256i q5bits = __lasx_xvld((const __m256i*)q5, 0); q5 += 32;
|
|
1330
|
+
|
|
1331
|
+
const __m256i q5l_0 = __lasx_xvandi_b(q5bits, 0xf);
|
|
1332
|
+
const __m256i q5l_1 = __lasx_xvsrli_b(q5bits, 4);
|
|
1333
|
+
const __m256i q5h_0 = __lasx_xvnori_b(__lasx_xvseqi_b(lasx_xvandi_b_bit(hbits, 2 * j + 0), 0), 0xef);
|
|
1334
|
+
const __m256i q5h_1 = __lasx_xvnori_b(__lasx_xvseqi_b(lasx_xvandi_b_bit(hbits, 2 * j + 1), 0), 0xef);
|
|
1335
|
+
const __m256i q5_0 = __lasx_xvor_v(q5l_0, q5h_0);
|
|
1336
|
+
const __m256i q5_1 = __lasx_xvor_v(q5l_1, q5h_1);
|
|
1337
|
+
|
|
1338
|
+
const __m256i q8_0 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1339
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1340
|
+
|
|
1341
|
+
__m256i p16_0 = lasx_madd_h_b(q5_0, q8_0);
|
|
1342
|
+
__m256i p16_1 = lasx_madd_h_b(q5_1, q8_1);
|
|
1343
|
+
|
|
1344
|
+
p16_0 = lasx_madd_h(scale_0, p16_0);
|
|
1345
|
+
p16_1 = lasx_madd_h(scale_1, p16_1);
|
|
1346
|
+
|
|
1347
|
+
sumi = __lasx_xvadd_w(sumi, __lasx_xvadd_w(p16_0, p16_1));
|
|
1348
|
+
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
__m256 vd = __lasx_xvreplfr2vr_s(d);
|
|
1352
|
+
acc = __lasx_xvfmadd_s(vd, __lasx_xvffint_s_w(sumi), acc);
|
|
1353
|
+
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
acc_m = __lsx_vfadd_s(acc_m, (__m128)__lsx_vbsrl_v(acc_m, 8));
|
|
1357
|
+
acc_m = __lsx_vfadd_s(acc_m, (__m128)__lsx_vbsrl_v(acc_m, 4));
|
|
1358
|
+
|
|
1359
|
+
*s = hsum_float_8(acc) + ((v4f32)acc_m)[0];
|
|
1360
|
+
|
|
1361
|
+
#else
|
|
1362
|
+
UNUSED(x);
|
|
1363
|
+
UNUSED(y);
|
|
1364
|
+
UNUSED(nb);
|
|
1365
|
+
UNUSED(kmask1);
|
|
1366
|
+
UNUSED(kmask2);
|
|
1367
|
+
UNUSED(kmask3);
|
|
1368
|
+
UNUSED(utmp);
|
|
1369
|
+
ggml_vec_dot_q5_K_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1370
|
+
#endif
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
void ggml_vec_dot_q6_K_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1374
|
+
assert(n % QK_K == 0);
|
|
1375
|
+
assert(nrc == 1);
|
|
1376
|
+
UNUSED(nrc);
|
|
1377
|
+
UNUSED(bx);
|
|
1378
|
+
UNUSED(by);
|
|
1379
|
+
UNUSED(bs);
|
|
1380
|
+
|
|
1381
|
+
const block_q6_K * GGML_RESTRICT x = vx;
|
|
1382
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1383
|
+
|
|
1384
|
+
const int nb = n / QK_K;
|
|
1385
|
+
|
|
1386
|
+
#if defined __loongarch_asx
|
|
1387
|
+
|
|
1388
|
+
const __m256i m32s = __lasx_xvreplgr2vr_b(32);
|
|
1389
|
+
|
|
1390
|
+
__m256 acc = (__m256)__lasx_xvldi(0);
|
|
1391
|
+
|
|
1392
|
+
for (int i = 0; i < nb; ++i) {
|
|
1393
|
+
|
|
1394
|
+
const float d = y[i].d * GGML_CPU_FP16_TO_FP32(x[i].d);
|
|
1395
|
+
|
|
1396
|
+
const uint8_t * GGML_RESTRICT q4 = x[i].ql;
|
|
1397
|
+
const uint8_t * GGML_RESTRICT qh = x[i].qh;
|
|
1398
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1399
|
+
|
|
1400
|
+
const __m128i scales128 = __lsx_vld((const __m128i*)x[i].scales, 0);
|
|
1401
|
+
const v16i8 shuffle_mask = {0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15};
|
|
1402
|
+
const __m256i scales_shuffled = lasx_ext8_16(__lsx_vshuf_b(scales128, scales128, (__m128i)shuffle_mask));
|
|
1403
|
+
|
|
1404
|
+
__m256i sumi = __lasx_xvldi(0);
|
|
1405
|
+
|
|
1406
|
+
for (int j = 0; j < QK_K/128; ++j) {
|
|
1407
|
+
|
|
1408
|
+
const __m256i q4bits1 = __lasx_xvld((const __m256i*)q4, 0); q4 += 32;
|
|
1409
|
+
const __m256i q4bits2 = __lasx_xvld((const __m256i*)q4, 0); q4 += 32;
|
|
1410
|
+
const __m256i q4bitsH = __lasx_xvld((const __m256i*)qh, 0); qh += 32;
|
|
1411
|
+
|
|
1412
|
+
const __m256i q4h_0 = __lasx_xvslli_b(__lasx_xvandi_b(q4bitsH, 3), 4);
|
|
1413
|
+
const __m256i q4h_1 = __lasx_xvslli_b(__lasx_xvandi_b(q4bitsH, 3 << 2), 2);
|
|
1414
|
+
const __m256i q4h_2 = __lasx_xvandi_b(q4bitsH, 3 << 4);
|
|
1415
|
+
const __m256i q4h_3 = __lasx_xvsrli_b(__lasx_xvandi_b(q4bitsH, 3 << 6), 2);
|
|
1416
|
+
|
|
1417
|
+
const __m256i q4_0 = __lasx_xvor_v(__lasx_xvandi_b(q4bits1, 0xf), q4h_0);
|
|
1418
|
+
const __m256i q4_1 = __lasx_xvor_v(__lasx_xvandi_b(q4bits2, 0xf), q4h_1);
|
|
1419
|
+
const __m256i q4_2 = __lasx_xvor_v(__lasx_xvsrli_b(q4bits1, 4), q4h_2);
|
|
1420
|
+
const __m256i q4_3 = __lasx_xvor_v(__lasx_xvsrli_b(q4bits2, 4), q4h_3);
|
|
1421
|
+
|
|
1422
|
+
const __m256i q8_0 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1423
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1424
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1425
|
+
const __m256i q8_3 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
1426
|
+
|
|
1427
|
+
__m256i p16_0 = lasx_madd_h_b(__lasx_xvsub_b(q4_0, m32s), q8_0);
|
|
1428
|
+
__m256i p16_1 = lasx_madd_h_b(__lasx_xvsub_b(q4_1, m32s), q8_1);
|
|
1429
|
+
__m256i p16_2 = lasx_madd_h_b(__lasx_xvsub_b(q4_2, m32s), q8_2);
|
|
1430
|
+
__m256i p16_3 = lasx_madd_h_b(__lasx_xvsub_b(q4_3, m32s), q8_3);
|
|
1431
|
+
|
|
1432
|
+
p16_0 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 0), p16_0);
|
|
1433
|
+
p16_1 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 1), p16_1);
|
|
1434
|
+
p16_2 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 2), p16_2);
|
|
1435
|
+
p16_3 = lasx_madd_h(lasx_xvrepl128vei_h(scales_shuffled, 4 * j + 3), p16_3);
|
|
1436
|
+
|
|
1437
|
+
sumi = __lasx_xvadd_w(sumi, __lasx_xvadd_w(p16_0, p16_1));
|
|
1438
|
+
sumi = __lasx_xvadd_w(sumi, __lasx_xvadd_w(p16_2, p16_3));
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
acc = __lasx_xvfmadd_s((__m256)__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(sumi), acc);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
*s = hsum_float_8(acc);
|
|
1445
|
+
|
|
1446
|
+
#else
|
|
1447
|
+
UNUSED(x);
|
|
1448
|
+
UNUSED(y);
|
|
1449
|
+
UNUSED(nb);
|
|
1450
|
+
ggml_vec_dot_q6_K_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1451
|
+
#endif
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
#if defined(__loongarch_asx)
|
|
1455
|
+
static const int8_t keven_signs_q2xs[1024] = {
|
|
1456
|
+
1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1,
|
|
1457
|
+
1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1,
|
|
1458
|
+
1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1,
|
|
1459
|
+
1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1,
|
|
1460
|
+
1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1,
|
|
1461
|
+
1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1,
|
|
1462
|
+
1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1,
|
|
1463
|
+
1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1,
|
|
1464
|
+
1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1,
|
|
1465
|
+
1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1,
|
|
1466
|
+
1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1,
|
|
1467
|
+
1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1,
|
|
1468
|
+
1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1,
|
|
1469
|
+
1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1,
|
|
1470
|
+
1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1,
|
|
1471
|
+
1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1,
|
|
1472
|
+
1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1,
|
|
1473
|
+
1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1,
|
|
1474
|
+
1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1,
|
|
1475
|
+
1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1,
|
|
1476
|
+
1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1,
|
|
1477
|
+
1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1,
|
|
1478
|
+
1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1,
|
|
1479
|
+
1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1,
|
|
1480
|
+
1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1,
|
|
1481
|
+
1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1,
|
|
1482
|
+
1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1,
|
|
1483
|
+
1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1,
|
|
1484
|
+
1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1,
|
|
1485
|
+
1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1,
|
|
1486
|
+
1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1,
|
|
1487
|
+
1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
1488
|
+
};
|
|
1489
|
+
#endif
|
|
1490
|
+
|
|
1491
|
+
void ggml_vec_dot_iq2_xxs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1492
|
+
assert(n % QK_K == 0);
|
|
1493
|
+
assert(nrc == 1);
|
|
1494
|
+
UNUSED(nrc);
|
|
1495
|
+
UNUSED(bx);
|
|
1496
|
+
UNUSED(by);
|
|
1497
|
+
UNUSED(bs);
|
|
1498
|
+
|
|
1499
|
+
const block_iq2_xxs * GGML_RESTRICT x = vx;
|
|
1500
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1501
|
+
|
|
1502
|
+
const int nb = n / QK_K;
|
|
1503
|
+
|
|
1504
|
+
#if defined(__loongarch_asx)
|
|
1505
|
+
|
|
1506
|
+
const uint64_t * signs64 = (const uint64_t *)keven_signs_q2xs;
|
|
1507
|
+
|
|
1508
|
+
uint32_t aux32[4];
|
|
1509
|
+
const uint8_t * aux8 = (const uint8_t *)aux32;
|
|
1510
|
+
|
|
1511
|
+
__m256 accumf = (__m256)__lasx_xvldi(0);
|
|
1512
|
+
for (int i = 0; i < nb; ++i) {
|
|
1513
|
+
const float d = GGML_CPU_FP16_TO_FP32(x[i].d) * y[i].d;
|
|
1514
|
+
const uint16_t * GGML_RESTRICT q2 = x[i].qs;
|
|
1515
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1516
|
+
__m256i sumi1 = __lasx_xvldi(0);
|
|
1517
|
+
__m256i sumi2 = __lasx_xvldi(0);
|
|
1518
|
+
for (int ib32 = 0; ib32 < QK_K/32; ib32 += 2) {
|
|
1519
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1520
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1521
|
+
memcpy(aux32, q2, 4*sizeof(uint32_t)); q2 += 8;
|
|
1522
|
+
|
|
1523
|
+
const __m256i q2_1 = lasx_set_d(iq2xxs_grid[aux8[ 3]], iq2xxs_grid[aux8[ 2]], iq2xxs_grid[aux8[1]], iq2xxs_grid[aux8[0]]);
|
|
1524
|
+
const __m256i q2_2 = lasx_set_d(iq2xxs_grid[aux8[11]], iq2xxs_grid[aux8[10]], iq2xxs_grid[aux8[9]], iq2xxs_grid[aux8[8]]);
|
|
1525
|
+
const __m256i s2_1 = lasx_set_d(signs64[(aux32[1] >> 21) & 127], signs64[(aux32[1] >> 14) & 127],
|
|
1526
|
+
signs64[(aux32[1] >> 7) & 127], signs64[(aux32[1] >> 0) & 127]);
|
|
1527
|
+
const __m256i s2_2 = lasx_set_d(signs64[(aux32[3] >> 21) & 127], signs64[(aux32[3] >> 14) & 127],
|
|
1528
|
+
signs64[(aux32[3] >> 7) & 127], signs64[(aux32[3] >> 0) & 127]);
|
|
1529
|
+
const __m256i q8s_1 = __lasx_xvsigncov_b(s2_1, q8_1);
|
|
1530
|
+
const __m256i q8s_2 = __lasx_xvsigncov_b(s2_2, q8_2);
|
|
1531
|
+
const __m256i dot1 = lasx_maddubs_h(q2_1, q8s_1);
|
|
1532
|
+
const __m256i dot2 = lasx_maddubs_h(q2_2, q8s_2);
|
|
1533
|
+
const uint16_t ls1 = aux32[1] >> 28;
|
|
1534
|
+
const uint16_t ls2 = aux32[3] >> 28;
|
|
1535
|
+
const __m256i p1 = lasx_madd_h(dot1, __lasx_xvreplgr2vr_h(2*ls1+1));
|
|
1536
|
+
const __m256i p2 = lasx_madd_h(dot2, __lasx_xvreplgr2vr_h(2*ls2+1));
|
|
1537
|
+
sumi1 = __lasx_xvadd_w(sumi1, p1);
|
|
1538
|
+
sumi2 = __lasx_xvadd_w(sumi2, p2);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
accumf = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(__lasx_xvadd_w(sumi1, sumi2)), accumf);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
*s = 0.125f * hsum_float_8(accumf);
|
|
1545
|
+
|
|
1546
|
+
#else
|
|
1547
|
+
UNUSED(x);
|
|
1548
|
+
UNUSED(y);
|
|
1549
|
+
UNUSED(nb);
|
|
1550
|
+
ggml_vec_dot_iq2_xxs_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1551
|
+
#endif
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
void ggml_vec_dot_iq2_xs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1555
|
+
assert(n % QK_K == 0);
|
|
1556
|
+
assert(nrc == 1);
|
|
1557
|
+
UNUSED(nrc);
|
|
1558
|
+
UNUSED(bx);
|
|
1559
|
+
UNUSED(by);
|
|
1560
|
+
UNUSED(bs);
|
|
1561
|
+
|
|
1562
|
+
const block_iq2_xs * GGML_RESTRICT x = vx;
|
|
1563
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1564
|
+
|
|
1565
|
+
const int nb = n / QK_K;
|
|
1566
|
+
|
|
1567
|
+
#if defined(__loongarch_asx)
|
|
1568
|
+
|
|
1569
|
+
const __m256i mone = __lasx_xvreplgr2vr_b(1);
|
|
1570
|
+
static const char block_sign_shuffle_mask_1[32] = {
|
|
1571
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
|
1572
|
+
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
|
|
1573
|
+
};
|
|
1574
|
+
static const char block_sign_shuffle_mask_2[32] = {
|
|
1575
|
+
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
|
|
1576
|
+
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
|
|
1577
|
+
};
|
|
1578
|
+
static const uint8_t bit_selector_mask_bytes[32] = {
|
|
1579
|
+
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
|
1580
|
+
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
const __m256i bit_selector_mask = __lasx_xvld((const __m256i*)bit_selector_mask_bytes, 0);
|
|
1584
|
+
const __m256i block_sign_shuffle_1 = __lasx_xvld((const __m256i*)block_sign_shuffle_mask_1, 0);
|
|
1585
|
+
const __m256i block_sign_shuffle_2 = __lasx_xvld((const __m256i*)block_sign_shuffle_mask_2, 0);
|
|
1586
|
+
|
|
1587
|
+
static const uint8_t k_bit_helper[32] = {
|
|
1588
|
+
0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00,
|
|
1589
|
+
0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00,
|
|
1590
|
+
};
|
|
1591
|
+
const __m256i bit_helper = __lasx_xvld((const __m256i*)k_bit_helper, 0);
|
|
1592
|
+
const __m256i m511 = __lasx_xvreplgr2vr_h(511);
|
|
1593
|
+
const __m128i m4 = __lsx_vreplgr2vr_b(0xf);
|
|
1594
|
+
const __m128i m1 = __lsx_vreplgr2vr_b(1);
|
|
1595
|
+
|
|
1596
|
+
uint64_t aux64;
|
|
1597
|
+
|
|
1598
|
+
// somewhat hacky, but gives a significant boost in performance
|
|
1599
|
+
__m256i aux_gindex;
|
|
1600
|
+
const uint16_t * gindex = (const uint16_t *)&aux_gindex;
|
|
1601
|
+
|
|
1602
|
+
__m256 accumf = (__m256)__lasx_xvldi(0);
|
|
1603
|
+
for (int i = 0; i < nb; ++i) {
|
|
1604
|
+
const float d = GGML_CPU_FP16_TO_FP32(x[i].d) * y[i].d;
|
|
1605
|
+
const uint16_t * GGML_RESTRICT q2 = x[i].qs;
|
|
1606
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1607
|
+
|
|
1608
|
+
memcpy(&aux64, x[i].scales, 8);
|
|
1609
|
+
__m128i stmp = __lsx_vreplgr2vr_d(aux64);
|
|
1610
|
+
stmp = __lsx_vilvl_b( __lsx_vand_v(__lsx_vsrli_h(stmp, 4), m4), __lsx_vand_v(stmp, m4));
|
|
1611
|
+
const __m128i scales = __lsx_vadd_b(__lsx_vslli_h(stmp, 1), m1);
|
|
1612
|
+
|
|
1613
|
+
__m256i sumi1 = __lasx_xvldi(0);
|
|
1614
|
+
__m256i sumi2 = __lasx_xvldi(0);
|
|
1615
|
+
for (int ib32 = 0; ib32 < QK_K/32; ib32 += 4) {
|
|
1616
|
+
|
|
1617
|
+
const __m256i q2_data = __lasx_xvld((const __m256i*)q2, 0); q2 += 16;
|
|
1618
|
+
aux_gindex = __lasx_xvand_v(q2_data, m511);
|
|
1619
|
+
|
|
1620
|
+
const __m256i partial_sign_bits = __lasx_xvsrli_h(q2_data, 9);
|
|
1621
|
+
const __m256i partial_sign_bits_upper = __lasx_xvsrli_h(q2_data, 13);
|
|
1622
|
+
const __m256i partial_sign_bits_for_counting = __lasx_xvxor_v(partial_sign_bits, partial_sign_bits_upper);
|
|
1623
|
+
|
|
1624
|
+
const __m256i odd_bits = lasx_shuffle_b(bit_helper, partial_sign_bits_for_counting);
|
|
1625
|
+
const __m256i full_sign_bits = __lasx_xvor_v(partial_sign_bits, odd_bits);
|
|
1626
|
+
|
|
1627
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1628
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1629
|
+
const __m256i q8_3 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1630
|
+
const __m256i q8_4 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1631
|
+
|
|
1632
|
+
const __m256i q2_1 = lasx_set_d(iq2xs_grid[gindex[ 3]], iq2xs_grid[gindex[ 2]],
|
|
1633
|
+
iq2xs_grid[gindex[ 1]], iq2xs_grid[gindex[ 0]]);
|
|
1634
|
+
const __m256i q2_2 = lasx_set_d(iq2xs_grid[gindex[ 7]], iq2xs_grid[gindex[ 6]],
|
|
1635
|
+
iq2xs_grid[gindex[ 5]], iq2xs_grid[gindex[ 4]]);
|
|
1636
|
+
const __m256i q2_3 = lasx_set_d(iq2xs_grid[gindex[11]], iq2xs_grid[gindex[10]],
|
|
1637
|
+
iq2xs_grid[gindex[ 9]], iq2xs_grid[gindex[ 8]]);
|
|
1638
|
+
const __m256i q2_4 = lasx_set_d(iq2xs_grid[gindex[15]], iq2xs_grid[gindex[14]],
|
|
1639
|
+
iq2xs_grid[gindex[13]], iq2xs_grid[gindex[12]]);
|
|
1640
|
+
|
|
1641
|
+
const __m128i full_signs_l = lasx_extracti128(full_sign_bits, 0);
|
|
1642
|
+
const __m128i full_signs_h = lasx_extracti128(full_sign_bits, 1);
|
|
1643
|
+
const __m256i full_signs_1 = lasx_insertf128(full_signs_l, full_signs_l);
|
|
1644
|
+
const __m256i full_signs_2 = lasx_insertf128(full_signs_h, full_signs_h);
|
|
1645
|
+
|
|
1646
|
+
__m256i signs;
|
|
1647
|
+
signs = lasx_shuffle_b(full_signs_1, block_sign_shuffle_1);
|
|
1648
|
+
signs = __lasx_xvseq_b(__lasx_xvand_v(signs, bit_selector_mask), bit_selector_mask);
|
|
1649
|
+
const __m256i q8s_1 = __lasx_xvsigncov_b(__lasx_xvor_v(signs, mone), q8_1);
|
|
1650
|
+
|
|
1651
|
+
signs = lasx_shuffle_b(full_signs_1, block_sign_shuffle_2);
|
|
1652
|
+
signs = __lasx_xvseq_b(__lasx_xvand_v(signs, bit_selector_mask), bit_selector_mask);
|
|
1653
|
+
const __m256i q8s_2 = __lasx_xvsigncov_b(__lasx_xvor_v(signs, mone), q8_2);
|
|
1654
|
+
|
|
1655
|
+
signs = lasx_shuffle_b(full_signs_2, block_sign_shuffle_1);
|
|
1656
|
+
signs = __lasx_xvseq_b(__lasx_xvand_v(signs, bit_selector_mask), bit_selector_mask);
|
|
1657
|
+
const __m256i q8s_3 = __lasx_xvsigncov_b(__lasx_xvor_v(signs, mone), q8_3);
|
|
1658
|
+
|
|
1659
|
+
signs = lasx_shuffle_b(full_signs_2, block_sign_shuffle_2);
|
|
1660
|
+
signs = __lasx_xvseq_b(__lasx_xvand_v(signs, bit_selector_mask), bit_selector_mask);
|
|
1661
|
+
const __m256i q8s_4 = __lasx_xvsigncov_b(__lasx_xvor_v(signs, mone), q8_4);
|
|
1662
|
+
|
|
1663
|
+
const __m256i dot1 = lasx_maddubs_h(q2_1, q8s_1);
|
|
1664
|
+
const __m256i dot2 = lasx_maddubs_h(q2_2, q8s_2);
|
|
1665
|
+
const __m256i dot3 = lasx_maddubs_h(q2_3, q8s_3);
|
|
1666
|
+
const __m256i dot4 = lasx_maddubs_h(q2_4, q8s_4);
|
|
1667
|
+
|
|
1668
|
+
const __m256i sc1 = lasx_ext8_16(lsx_shuffle_b(scales, get_scale_shuffle(ib32+0)));
|
|
1669
|
+
const __m256i sc2 = lasx_ext8_16(lsx_shuffle_b(scales, get_scale_shuffle(ib32+1)));
|
|
1670
|
+
const __m256i sc3 = lasx_ext8_16(lsx_shuffle_b(scales, get_scale_shuffle(ib32+2)));
|
|
1671
|
+
const __m256i sc4 = lasx_ext8_16(lsx_shuffle_b(scales, get_scale_shuffle(ib32+3)));
|
|
1672
|
+
|
|
1673
|
+
sumi1 = __lasx_xvadd_w(sumi1, lasx_madd_h(dot1, sc1));
|
|
1674
|
+
sumi2 = __lasx_xvadd_w(sumi2, lasx_madd_h(dot2, sc2));
|
|
1675
|
+
sumi1 = __lasx_xvadd_w(sumi1, lasx_madd_h(dot3, sc3));
|
|
1676
|
+
sumi2 = __lasx_xvadd_w(sumi2, lasx_madd_h(dot4, sc4));
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
accumf = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(__lasx_xvadd_w(sumi1, sumi2)), accumf);
|
|
1680
|
+
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
*s = 0.125f * hsum_float_8(accumf);
|
|
1684
|
+
|
|
1685
|
+
#else
|
|
1686
|
+
UNUSED(x);
|
|
1687
|
+
UNUSED(y);
|
|
1688
|
+
UNUSED(nb);
|
|
1689
|
+
ggml_vec_dot_iq2_xs_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1690
|
+
#endif
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
void ggml_vec_dot_iq2_s_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1694
|
+
assert(n % QK_K == 0);
|
|
1695
|
+
assert(nrc == 1);
|
|
1696
|
+
UNUSED(nrc);
|
|
1697
|
+
UNUSED(bx);
|
|
1698
|
+
UNUSED(by);
|
|
1699
|
+
UNUSED(bs);
|
|
1700
|
+
|
|
1701
|
+
const block_iq2_s * GGML_RESTRICT x = vx;
|
|
1702
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1703
|
+
|
|
1704
|
+
const int nb = n / QK_K;
|
|
1705
|
+
|
|
1706
|
+
#if defined(__loongarch_asx)
|
|
1707
|
+
|
|
1708
|
+
static const uint8_t k_mask1[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
1709
|
+
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
|
|
1710
|
+
};
|
|
1711
|
+
|
|
1712
|
+
static const uint8_t k_mask2[32] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
|
1713
|
+
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
const __m128i m4 = __lsx_vreplgr2vr_b(0xf);
|
|
1718
|
+
const __m128i m1 = __lsx_vreplgr2vr_b(1);
|
|
1719
|
+
|
|
1720
|
+
const __m256i mask1 = __lasx_xvld((const __m256i*)k_mask1, 0);
|
|
1721
|
+
const __m256i mask2 = __lasx_xvld((const __m256i*)k_mask2, 0);
|
|
1722
|
+
uint64_t aux64;
|
|
1723
|
+
|
|
1724
|
+
__m256 accumf = (__m256)__lasx_xvldi(0);
|
|
1725
|
+
for (int i = 0; i < nb; ++i) {
|
|
1726
|
+
const float d = GGML_CPU_FP16_TO_FP32(x[i].d) * y[i].d;
|
|
1727
|
+
const uint8_t * GGML_RESTRICT qs = x[i].qs;
|
|
1728
|
+
const uint8_t * GGML_RESTRICT qh = x[i].qh;
|
|
1729
|
+
const uint16_t * GGML_RESTRICT signs = (const uint16_t *)(x[i].qs + QK_K/8);
|
|
1730
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1731
|
+
|
|
1732
|
+
__m128i tmp1;
|
|
1733
|
+
memcpy(&aux64, x[i].scales, 8);
|
|
1734
|
+
tmp1 = __lsx_vinsgr2vr_d(tmp1, aux64, 0);
|
|
1735
|
+
tmp1 = __lsx_vinsgr2vr_d(tmp1, aux64 >> 4, 1);
|
|
1736
|
+
const __m128i scales8 = __lsx_vadd_b(__lsx_vslli_h(__lsx_vand_v(tmp1, m4), 1), m1);
|
|
1737
|
+
const __m256i scales16 = lasx_ext8_16(scales8); // 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15
|
|
1738
|
+
|
|
1739
|
+
__m256i sumi1 = __lasx_xvldi(0);
|
|
1740
|
+
__m256i sumi2 = __lasx_xvldi(0);
|
|
1741
|
+
for (int ib32 = 0; ib32 < QK_K/32; ib32 += 2) {
|
|
1742
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1743
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1744
|
+
const __m256i q2_1 = lasx_set_d(iq2s_grid[qs[3] | ((qh[ib32+0] << 2) & 0x300)],
|
|
1745
|
+
iq2s_grid[qs[2] | ((qh[ib32+0] << 4) & 0x300)],
|
|
1746
|
+
iq2s_grid[qs[1] | ((qh[ib32+0] << 6) & 0x300)],
|
|
1747
|
+
iq2s_grid[qs[0] | ((qh[ib32+0] << 8) & 0x300)]);
|
|
1748
|
+
const __m256i q2_2 = lasx_set_d(iq2s_grid[qs[7] | ((qh[ib32+1] << 2) & 0x300)],
|
|
1749
|
+
iq2s_grid[qs[6] | ((qh[ib32+1] << 4) & 0x300)],
|
|
1750
|
+
iq2s_grid[qs[5] | ((qh[ib32+1] << 6) & 0x300)],
|
|
1751
|
+
iq2s_grid[qs[4] | ((qh[ib32+1] << 8) & 0x300)]);
|
|
1752
|
+
qs += 8;
|
|
1753
|
+
|
|
1754
|
+
__m256i aux256 = __lasx_xvreplgr2vr_w(signs[0] | ((uint32_t) signs[1] << 16));
|
|
1755
|
+
aux256 = __lasx_xvand_v(lasx_shuffle_b(aux256,mask1), mask2);
|
|
1756
|
+
const __m256i s2_1 = __lasx_xvseq_b(aux256, mask2);
|
|
1757
|
+
const __m256i q8s_1 = __lasx_xvsub_b(__lasx_xvxor_v(s2_1, q8_1), s2_1);
|
|
1758
|
+
|
|
1759
|
+
aux256 = __lasx_xvreplgr2vr_w(signs[2] | ((uint32_t) signs[3] << 16));
|
|
1760
|
+
aux256 = __lasx_xvand_v(lasx_shuffle_b(aux256,mask1), mask2);
|
|
1761
|
+
const __m256i s2_2 = __lasx_xvseq_b(aux256, mask2);
|
|
1762
|
+
const __m256i q8s_2 = __lasx_xvsub_b(__lasx_xvxor_v(s2_2, q8_2), s2_2);
|
|
1763
|
+
|
|
1764
|
+
signs += 4;
|
|
1765
|
+
|
|
1766
|
+
const __m256i dot1 = lasx_maddubs_h(q2_1, q8s_1); // blocks 2*ib32+0, 2*ib32+1
|
|
1767
|
+
const __m256i dot2 = lasx_maddubs_h(q2_2, q8s_2); // blocks 2*ib32+2, 2*ib32+3
|
|
1768
|
+
|
|
1769
|
+
const __m256i p1 = lasx_madd_h(dot1, lasx_shuffle_b(scales16, get_scale_shuffle_k4(ib32+0)));
|
|
1770
|
+
const __m256i p2 = lasx_madd_h(dot2, lasx_shuffle_b(scales16, get_scale_shuffle_k4(ib32+1)));
|
|
1771
|
+
sumi1 = __lasx_xvadd_w(sumi1, p1);
|
|
1772
|
+
sumi2 = __lasx_xvadd_w(sumi2, p2);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
accumf = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(__lasx_xvadd_w(sumi1, sumi2)), accumf);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
*s = 0.125f * hsum_float_8(accumf);
|
|
1779
|
+
|
|
1780
|
+
#else
|
|
1781
|
+
UNUSED(x);
|
|
1782
|
+
UNUSED(y);
|
|
1783
|
+
UNUSED(nb);
|
|
1784
|
+
ggml_vec_dot_iq2_s_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1785
|
+
#endif
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
void ggml_vec_dot_iq3_xxs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1789
|
+
assert(n % QK_K == 0);
|
|
1790
|
+
assert(nrc == 1);
|
|
1791
|
+
UNUSED(nrc);
|
|
1792
|
+
UNUSED(bx);
|
|
1793
|
+
UNUSED(by);
|
|
1794
|
+
UNUSED(bs);
|
|
1795
|
+
|
|
1796
|
+
const block_iq3_xxs * GGML_RESTRICT x = vx;
|
|
1797
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1798
|
+
|
|
1799
|
+
const int nb = n / QK_K;
|
|
1800
|
+
|
|
1801
|
+
#if defined(__loongarch_asx)
|
|
1802
|
+
|
|
1803
|
+
const uint64_t * signs64 = (const uint64_t *)keven_signs_q2xs;
|
|
1804
|
+
|
|
1805
|
+
uint32_t aux32[2];
|
|
1806
|
+
|
|
1807
|
+
__m256 accumf = (__m256)__lasx_xvldi(0);
|
|
1808
|
+
for (int i = 0; i < nb; ++i) {
|
|
1809
|
+
const float d = GGML_CPU_FP16_TO_FP32(x[i].d) * y[i].d;
|
|
1810
|
+
const uint8_t * GGML_RESTRICT q3 = x[i].qs;
|
|
1811
|
+
const uint8_t * GGML_RESTRICT gas = x[i].qs + QK_K/4;
|
|
1812
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1813
|
+
__m256i sumi1 = __lasx_xvldi(0);
|
|
1814
|
+
__m256i sumi2 = __lasx_xvldi(0);
|
|
1815
|
+
for (int ib32 = 0; ib32 < QK_K/32; ib32 += 2) {
|
|
1816
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1817
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1818
|
+
const __m256i q2_1 = lasx_set_w(iq3xxs_grid[q3[7]], iq3xxs_grid[q3[6]], iq3xxs_grid[q3[5]], iq3xxs_grid[q3[4]],
|
|
1819
|
+
iq3xxs_grid[q3[3]], iq3xxs_grid[q3[2]], iq3xxs_grid[q3[1]], iq3xxs_grid[q3[0]]);
|
|
1820
|
+
q3 += 8;
|
|
1821
|
+
const __m256i q2_2 = lasx_set_w(iq3xxs_grid[q3[7]], iq3xxs_grid[q3[6]], iq3xxs_grid[q3[5]], iq3xxs_grid[q3[4]],
|
|
1822
|
+
iq3xxs_grid[q3[3]], iq3xxs_grid[q3[2]], iq3xxs_grid[q3[1]], iq3xxs_grid[q3[0]]);
|
|
1823
|
+
q3 += 8;
|
|
1824
|
+
memcpy(aux32, gas, 8); gas += 8;
|
|
1825
|
+
|
|
1826
|
+
const __m256i s2_1 = lasx_set_d(signs64[(aux32[0] >> 21) & 127], signs64[(aux32[0] >> 14) & 127],
|
|
1827
|
+
signs64[(aux32[0] >> 7) & 127], signs64[(aux32[0] >> 0) & 127]);
|
|
1828
|
+
const __m256i s2_2 = lasx_set_d(signs64[(aux32[1] >> 21) & 127], signs64[(aux32[1] >> 14) & 127],
|
|
1829
|
+
signs64[(aux32[1] >> 7) & 127], signs64[(aux32[1] >> 0) & 127]);
|
|
1830
|
+
const __m256i q8s_1 = __lasx_xvsigncov_b(s2_1, q8_1);
|
|
1831
|
+
const __m256i q8s_2 = __lasx_xvsigncov_b(s2_2, q8_2);
|
|
1832
|
+
const __m256i dot1 = lasx_maddubs_h(q2_1, q8s_1);
|
|
1833
|
+
const __m256i dot2 = lasx_maddubs_h(q2_2, q8s_2);
|
|
1834
|
+
const uint16_t ls1 = aux32[0] >> 28;
|
|
1835
|
+
const uint16_t ls2 = aux32[1] >> 28;
|
|
1836
|
+
|
|
1837
|
+
const __m256i p1 = lasx_madd_h(dot1, __lasx_xvreplgr2vr_h(2*ls1+1));
|
|
1838
|
+
const __m256i p2 = lasx_madd_h(dot2, __lasx_xvreplgr2vr_h(2*ls2+1));
|
|
1839
|
+
sumi1 = __lasx_xvadd_w(sumi1, p1);
|
|
1840
|
+
sumi2 = __lasx_xvadd_w(sumi2, p2);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
accumf = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(__lasx_xvadd_w(sumi1, sumi2)), accumf);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
*s = 0.25f * hsum_float_8(accumf);
|
|
1847
|
+
|
|
1848
|
+
#else
|
|
1849
|
+
UNUSED(x);
|
|
1850
|
+
UNUSED(y);
|
|
1851
|
+
UNUSED(nb);
|
|
1852
|
+
ggml_vec_dot_iq3_xxs_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1853
|
+
#endif
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
void ggml_vec_dot_iq3_s_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1857
|
+
assert(n % QK_K == 0);
|
|
1858
|
+
assert(nrc == 1);
|
|
1859
|
+
UNUSED(nrc);
|
|
1860
|
+
UNUSED(bx);
|
|
1861
|
+
UNUSED(by);
|
|
1862
|
+
UNUSED(bs);
|
|
1863
|
+
|
|
1864
|
+
const block_iq3_s * GGML_RESTRICT x = vx;
|
|
1865
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1866
|
+
|
|
1867
|
+
const int nb = n / QK_K;
|
|
1868
|
+
|
|
1869
|
+
#if defined(__loongarch_asx)
|
|
1870
|
+
|
|
1871
|
+
static const uint8_t k_mask1[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
1872
|
+
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
static const uint8_t k_mask2[32] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
|
1876
|
+
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1879
|
+
const __m256i mask1 = __lasx_xvld((const __m256i*)k_mask1, 0);
|
|
1880
|
+
const __m256i mask2 = __lasx_xvld((const __m256i*)k_mask2, 0);
|
|
1881
|
+
|
|
1882
|
+
__m256i idx_shift = lasx_set_w(1, 2, 3, 4, 5, 6, 7, 8);
|
|
1883
|
+
const __m256i idx_mask = __lasx_xvreplgr2vr_w(256);
|
|
1884
|
+
|
|
1885
|
+
typedef union {
|
|
1886
|
+
__m256i vec[2];
|
|
1887
|
+
uint32_t index[16];
|
|
1888
|
+
} index_t;
|
|
1889
|
+
|
|
1890
|
+
index_t idx;
|
|
1891
|
+
|
|
1892
|
+
__m256 accumf = (__m256)__lasx_xvldi(0);
|
|
1893
|
+
for (int i = 0; i < nb; ++i) {
|
|
1894
|
+
const float d = GGML_CPU_FP16_TO_FP32(x[i].d) * y[i].d;
|
|
1895
|
+
const uint8_t * GGML_RESTRICT qs = x[i].qs;
|
|
1896
|
+
const uint8_t * GGML_RESTRICT qh = x[i].qh;
|
|
1897
|
+
const uint16_t * GGML_RESTRICT signs = (const uint16_t *)x[i].signs;
|
|
1898
|
+
const int8_t * GGML_RESTRICT q8 = y[i].qs;
|
|
1899
|
+
__m256i sumi1 = __lasx_xvldi(0);
|
|
1900
|
+
__m256i sumi2 = __lasx_xvldi(0);
|
|
1901
|
+
for (int ib32 = 0; ib32 < QK_K/32; ib32 += 2) {
|
|
1902
|
+
const __m256i q8_1 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1903
|
+
const __m256i q8_2 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
1904
|
+
const __m256i idx_l = lasx_extu8_16(__lsx_vld(qs, 0)); qs += 16;
|
|
1905
|
+
idx.vec[0] = __lasx_xvreplgr2vr_w(qh[ib32+0]);
|
|
1906
|
+
idx.vec[1] = __lasx_xvreplgr2vr_w(qh[ib32+1]);
|
|
1907
|
+
idx.vec[0] = __lasx_xvand_v(__lasx_xvsll_w(idx.vec[0], idx_shift), idx_mask);
|
|
1908
|
+
idx.vec[1] = __lasx_xvand_v(__lasx_xvsll_w(idx.vec[1], idx_shift), idx_mask);
|
|
1909
|
+
idx.vec[0] = __lasx_xvor_v(idx.vec[0], lasx_ext16_32(lasx_extracti128(idx_l, 0)));
|
|
1910
|
+
idx.vec[1] = __lasx_xvor_v(idx.vec[1], lasx_ext16_32(lasx_extracti128(idx_l, 1)));
|
|
1911
|
+
|
|
1912
|
+
// At leat on my CPU (Ryzen 7950X), using _mm256_i32gather_epi32 is slower than _mm256_set_epi32. Strange.
|
|
1913
|
+
//const __m256i q2_1 = _mm256_i32gather_epi32((const int *)iq3s_grid, idx.vec[0], 4);
|
|
1914
|
+
//const __m256i q2_2 = _mm256_i32gather_epi32((const int *)iq3s_grid, idx.vec[1], 4);
|
|
1915
|
+
const __m256i q2_1 = lasx_set_w(
|
|
1916
|
+
iq3s_grid[idx.index[7]], iq3s_grid[idx.index[6]], iq3s_grid[idx.index[5]], iq3s_grid[idx.index[4]],
|
|
1917
|
+
iq3s_grid[idx.index[3]], iq3s_grid[idx.index[2]], iq3s_grid[idx.index[1]], iq3s_grid[idx.index[0]]
|
|
1918
|
+
);
|
|
1919
|
+
const __m256i q2_2 = lasx_set_w(
|
|
1920
|
+
iq3s_grid[idx.index[15]], iq3s_grid[idx.index[14]], iq3s_grid[idx.index[13]], iq3s_grid[idx.index[12]],
|
|
1921
|
+
iq3s_grid[idx.index[11]], iq3s_grid[idx.index[10]], iq3s_grid[idx.index[ 9]], iq3s_grid[idx.index[ 8]]
|
|
1922
|
+
);
|
|
1923
|
+
|
|
1924
|
+
__m256i aux256 = __lasx_xvreplgr2vr_w(signs[0] | (signs[1] << 16));
|
|
1925
|
+
aux256 = __lasx_xvand_v(lasx_shuffle_b(aux256,mask1), mask2);
|
|
1926
|
+
const __m256i s2_1 = __lasx_xvseq_b(aux256, mask2);
|
|
1927
|
+
const __m256i q8s_1 = __lasx_xvsub_b(__lasx_xvxor_v(s2_1, q8_1), s2_1);
|
|
1928
|
+
|
|
1929
|
+
aux256 = __lasx_xvreplgr2vr_w(signs[2] | (signs[3] << 16));
|
|
1930
|
+
aux256 = __lasx_xvand_v(lasx_shuffle_b(aux256,mask1), mask2);
|
|
1931
|
+
const __m256i s2_2 = __lasx_xvseq_b(aux256, mask2);
|
|
1932
|
+
const __m256i q8s_2 = __lasx_xvsub_b(__lasx_xvxor_v(s2_2, q8_2), s2_2);
|
|
1933
|
+
|
|
1934
|
+
signs += 4;
|
|
1935
|
+
|
|
1936
|
+
const __m256i dot1 = lasx_maddubs_h(q2_1, q8s_1);
|
|
1937
|
+
const __m256i dot2 = lasx_maddubs_h(q2_2, q8s_2);
|
|
1938
|
+
const uint16_t ls1 = x[i].scales[ib32/2] & 0xf;
|
|
1939
|
+
const uint16_t ls2 = x[i].scales[ib32/2] >> 4;
|
|
1940
|
+
const __m256i p1 = lasx_madd_h(dot1, __lasx_xvreplgr2vr_h(2*ls1+1));
|
|
1941
|
+
const __m256i p2 = lasx_madd_h(dot2, __lasx_xvreplgr2vr_h(2*ls2+1));
|
|
1942
|
+
sumi1 = __lasx_xvadd_w(sumi1, p1);
|
|
1943
|
+
sumi2 = __lasx_xvadd_w(sumi2, p2);
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
accumf = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(__lasx_xvadd_w(sumi1, sumi2)), accumf);
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
*s = hsum_float_8(accumf);
|
|
1950
|
+
|
|
1951
|
+
#else
|
|
1952
|
+
UNUSED(x);
|
|
1953
|
+
UNUSED(y);
|
|
1954
|
+
UNUSED(nb);
|
|
1955
|
+
ggml_vec_dot_iq3_s_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
1956
|
+
#endif
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
#if defined(__loongarch_asx)
|
|
1960
|
+
static inline __m256i mul_add_epi8(const __m256i x, const __m256i y) {
|
|
1961
|
+
const __m256i a = __lasx_xvmulwev_h_b(x, y);
|
|
1962
|
+
const __m256i b = __lasx_xvmulwod_h_b(x, y);
|
|
1963
|
+
return __lasx_xvadd_h(a, b);
|
|
1964
|
+
}
|
|
1965
|
+
#endif
|
|
1966
|
+
|
|
1967
|
+
void ggml_vec_dot_iq1_s_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
1968
|
+
assert(n % QK_K == 0);
|
|
1969
|
+
assert(nrc == 1);
|
|
1970
|
+
UNUSED(nrc);
|
|
1971
|
+
UNUSED(bx);
|
|
1972
|
+
UNUSED(by);
|
|
1973
|
+
UNUSED(bs);
|
|
1974
|
+
|
|
1975
|
+
const block_iq1_s * GGML_RESTRICT x = vx;
|
|
1976
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
1977
|
+
|
|
1978
|
+
const int nb = n / QK_K;
|
|
1979
|
+
|
|
1980
|
+
#if defined(__loongarch_asx)
|
|
1981
|
+
|
|
1982
|
+
__m256 accum = (__m256)__lasx_xvldi(0);
|
|
1983
|
+
float accum1 = 0;
|
|
1984
|
+
for (int i = 0; i < nb; ++i) {
|
|
1985
|
+
|
|
1986
|
+
const int8_t * q8 = y[i].qs;
|
|
1987
|
+
const uint8_t * qs = x[i].qs;
|
|
1988
|
+
const uint16_t * qh = x[i].qh;
|
|
1989
|
+
|
|
1990
|
+
__m256i sumi = __lasx_xvldi(0);
|
|
1991
|
+
int sumi1 = 0;
|
|
1992
|
+
for (int ib = 0; ib < QK_K/32; ib += 2) {
|
|
1993
|
+
__m256i q1b_1 = __lasx_xvinsgr2vr_d(q1b_1, iq1s_grid[qs[0] | ((qh[ib+0] << 8) & 0x700)], 0);
|
|
1994
|
+
q1b_1 = __lasx_xvinsgr2vr_d(q1b_1, iq1s_grid[qs[1] | ((qh[ib+0] << 5) & 0x700)], 1);
|
|
1995
|
+
q1b_1 = __lasx_xvinsgr2vr_d(q1b_1, iq1s_grid[qs[2] | ((qh[ib+0] << 2) & 0x700)], 2);
|
|
1996
|
+
q1b_1 = __lasx_xvinsgr2vr_d(q1b_1, iq1s_grid[qs[3] | ((qh[ib+0] >> 1) & 0x700)], 3);
|
|
1997
|
+
|
|
1998
|
+
__m256i q1b_2 = __lasx_xvinsgr2vr_d(q1b_2, iq1s_grid[qs[4] | ((qh[ib+1] << 8) & 0x700)], 0);
|
|
1999
|
+
q1b_2 = __lasx_xvinsgr2vr_d(q1b_2, iq1s_grid[qs[5] | ((qh[ib+1] << 5) & 0x700)], 1);
|
|
2000
|
+
q1b_2 = __lasx_xvinsgr2vr_d(q1b_2, iq1s_grid[qs[6] | ((qh[ib+1] << 2) & 0x700)], 2);
|
|
2001
|
+
q1b_2 = __lasx_xvinsgr2vr_d(q1b_2, iq1s_grid[qs[7] | ((qh[ib+1] >> 1) & 0x700)], 3);
|
|
2002
|
+
|
|
2003
|
+
qs += 8;
|
|
2004
|
+
const __m256i q8b_1 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
2005
|
+
const __m256i q8b_2 = __lasx_xvld((const __m256i*)q8, 0); q8 += 32;
|
|
2006
|
+
|
|
2007
|
+
const __m256i dot1 = mul_add_epi8(q1b_1, q8b_1);
|
|
2008
|
+
const __m256i dot2 = mul_add_epi8(q1b_2, q8b_2);
|
|
2009
|
+
const int16_t ls1 = 2*((qh[ib+0] >> 12) & 7) + 1;
|
|
2010
|
+
const int16_t ls2 = 2*((qh[ib+1] >> 12) & 7) + 1;
|
|
2011
|
+
|
|
2012
|
+
__m256i tmp1, tmp5, tmp6;
|
|
2013
|
+
tmp1 = __lasx_xvreplgr2vr_h(ls1);
|
|
2014
|
+
tmp5 = __lasx_xvmulwev_w_h(dot1, tmp1);
|
|
2015
|
+
tmp6 = __lasx_xvmulwod_w_h(dot1, tmp1);
|
|
2016
|
+
const __m256i p1 = __lasx_xvadd_w(tmp5, tmp6);
|
|
2017
|
+
|
|
2018
|
+
tmp1 = __lasx_xvreplgr2vr_h(ls2);
|
|
2019
|
+
tmp5 = __lasx_xvmulwev_w_h(dot2, tmp1);
|
|
2020
|
+
tmp6 = __lasx_xvmulwod_w_h(dot2, tmp1);
|
|
2021
|
+
const __m256i p2 = __lasx_xvadd_w(tmp5, tmp6);
|
|
2022
|
+
|
|
2023
|
+
sumi = __lasx_xvadd_w(sumi, __lasx_xvadd_w(p1, p2));
|
|
2024
|
+
sumi1 += (y[i].bsums[2*ib+0] + y[i].bsums[2*ib+1]) * (qh[ib+0] & 0x8000 ? -1 : 1) * ls1
|
|
2025
|
+
+ (y[i].bsums[2*ib+2] + y[i].bsums[2*ib+3]) * (qh[ib+1] & 0x8000 ? -1 : 1) * ls2;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
const float d = y[i].d * GGML_CPU_FP16_TO_FP32(x[i].d);
|
|
2029
|
+
accum = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(d), __lasx_xvffint_s_w(sumi), accum);
|
|
2030
|
+
accum1 += d * sumi1;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
*s = hsum_float_8(accum) + IQ1S_DELTA * accum1;
|
|
2034
|
+
|
|
2035
|
+
#else
|
|
2036
|
+
UNUSED(x);
|
|
2037
|
+
UNUSED(y);
|
|
2038
|
+
UNUSED(nb);
|
|
2039
|
+
ggml_vec_dot_iq1_s_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
2040
|
+
#endif
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
void ggml_vec_dot_iq4_nl_q8_0(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
2044
|
+
assert(nrc == 1);
|
|
2045
|
+
UNUSED(nrc);
|
|
2046
|
+
UNUSED(bx);
|
|
2047
|
+
UNUSED(by);
|
|
2048
|
+
UNUSED(bs);
|
|
2049
|
+
assert(n % QK4_NL == 0);
|
|
2050
|
+
static_assert(QK4_NL == QK8_0, "QK4_NL and QK8_0 must be the same");
|
|
2051
|
+
|
|
2052
|
+
const block_iq4_nl * GGML_RESTRICT x = vx;
|
|
2053
|
+
const block_q8_0 * GGML_RESTRICT y = vy;
|
|
2054
|
+
|
|
2055
|
+
const int nb = n / QK4_NL;
|
|
2056
|
+
|
|
2057
|
+
int ib = 0;
|
|
2058
|
+
float sumf = 0;
|
|
2059
|
+
|
|
2060
|
+
#if defined (__loongarch_asx)
|
|
2061
|
+
|
|
2062
|
+
const __m128i values128 = __lsx_vld((const __m128i*)kvalues_iq4nl, 0);
|
|
2063
|
+
const __m128i m4b = __lsx_vreplgr2vr_b(0x0f);
|
|
2064
|
+
const __m256i mone = __lasx_xvreplgr2vr_h(1);
|
|
2065
|
+
|
|
2066
|
+
__m256 accum1 = (__m256)__lasx_xvldi(0);
|
|
2067
|
+
__m256 accum2 = (__m256)__lasx_xvldi(0);
|
|
2068
|
+
for (; ib + 1 < nb; ib += 2) {
|
|
2069
|
+
const __m128i q4bits_1 = __lsx_vld((const __m128i*)x[ib + 0].qs, 0);
|
|
2070
|
+
const __m128i q4bits_2 = __lsx_vld((const __m128i*)x[ib + 1].qs, 0);
|
|
2071
|
+
const __m256i q8b_1 = __lasx_xvld((const __m256i *)y[ib + 0].qs, 0);
|
|
2072
|
+
const __m256i q8b_2 = __lasx_xvld((const __m256i *)y[ib + 1].qs, 0);
|
|
2073
|
+
const __m256i q4b_1 = lasx_insertf128(lsx_shuffle_b(values128, __lsx_vand_v(__lsx_vsrli_h(q4bits_1, 4), m4b)),
|
|
2074
|
+
lsx_shuffle_b(values128, __lsx_vand_v(q4bits_1, m4b)));
|
|
2075
|
+
const __m256i q4b_2 = lasx_insertf128(lsx_shuffle_b(values128, __lsx_vand_v(__lsx_vsrli_h(q4bits_2, 4), m4b)),
|
|
2076
|
+
lsx_shuffle_b(values128, __lsx_vand_v(q4bits_2, m4b)));
|
|
2077
|
+
const __m256i p16_1 = mul_add_epi8(q4b_1, q8b_1);
|
|
2078
|
+
const __m256i p16_2 = mul_add_epi8(q4b_2, q8b_2);
|
|
2079
|
+
const __m256i p_1 = lasx_madd_h(p16_1, mone);
|
|
2080
|
+
const __m256i p_2 = lasx_madd_h(p16_2, mone);
|
|
2081
|
+
accum1 = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(y[ib + 0].d)*GGML_CPU_FP16_TO_FP32(x[ib + 0].d)),
|
|
2082
|
+
__lasx_xvffint_s_w(p_1), accum1);
|
|
2083
|
+
accum2 = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(y[ib + 1].d)*GGML_CPU_FP16_TO_FP32(x[ib + 1].d)),
|
|
2084
|
+
__lasx_xvffint_s_w(p_2), accum2);
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
sumf = hsum_float_8(__lasx_xvfadd_s(accum1, accum2));
|
|
2088
|
+
|
|
2089
|
+
#endif
|
|
2090
|
+
for (; ib < nb; ++ib) {
|
|
2091
|
+
const float d = GGML_CPU_FP16_TO_FP32(y[ib].d)*GGML_CPU_FP16_TO_FP32(x[ib].d);
|
|
2092
|
+
int sumi1 = 0, sumi2 = 0;
|
|
2093
|
+
for (int j = 0; j < QK4_NL/2; ++j) {
|
|
2094
|
+
sumi1 += y[ib].qs[j+ 0] * kvalues_iq4nl[x[ib].qs[j] & 0xf];
|
|
2095
|
+
sumi2 += y[ib].qs[j+QK4_NL/2] * kvalues_iq4nl[x[ib].qs[j] >> 4];
|
|
2096
|
+
}
|
|
2097
|
+
sumf += d * (sumi1 + sumi2);
|
|
2098
|
+
}
|
|
2099
|
+
*s = sumf;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
void ggml_vec_dot_iq4_xs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const void * GGML_RESTRICT vx, size_t bx, const void * GGML_RESTRICT vy, size_t by, int nrc) {
|
|
2103
|
+
assert(nrc == 1);
|
|
2104
|
+
UNUSED(nrc);
|
|
2105
|
+
UNUSED(bx);
|
|
2106
|
+
UNUSED(by);
|
|
2107
|
+
UNUSED(bs);
|
|
2108
|
+
assert(n % QK_K == 0);
|
|
2109
|
+
|
|
2110
|
+
const block_iq4_xs * GGML_RESTRICT x = vx;
|
|
2111
|
+
const block_q8_K * GGML_RESTRICT y = vy;
|
|
2112
|
+
|
|
2113
|
+
const int nb = n / QK_K;
|
|
2114
|
+
|
|
2115
|
+
#if defined(__loongarch_asx)
|
|
2116
|
+
|
|
2117
|
+
const __m128i values128 = __lsx_vld((const __m128i*)kvalues_iq4nl, 0);
|
|
2118
|
+
|
|
2119
|
+
__m256 accum = (__m256)__lasx_xvldi(0);
|
|
2120
|
+
|
|
2121
|
+
for (int ibl = 0; ibl < nb; ++ibl) {
|
|
2122
|
+
const uint8_t * qs = x[ibl].qs;
|
|
2123
|
+
const int8_t * q8 = y[ibl].qs;
|
|
2124
|
+
uint16_t sh = x[ibl].scales_h;
|
|
2125
|
+
__m256i sumi1 = __lasx_xvldi(0);
|
|
2126
|
+
__m256i sumi2 = __lasx_xvldi(0);
|
|
2127
|
+
for (int ib = 0; ib < QK_K/32; ib += 2) {
|
|
2128
|
+
const __m128i q4bits_1 = __lsx_vld((const __m128i*)qs, 0); qs += 16;
|
|
2129
|
+
const __m128i q4bits_2 = __lsx_vld((const __m128i*)qs, 0); qs += 16;
|
|
2130
|
+
const __m256i q8b_1 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
2131
|
+
const __m256i q8b_2 = __lasx_xvld((const __m256i *)q8, 0); q8 += 32;
|
|
2132
|
+
const __m256i q4b_1 = lasx_insertf128(__lsx_vshuf_b(values128, values128, __lsx_vsrli_b(q4bits_1, 4)),
|
|
2133
|
+
__lsx_vshuf_b(values128, values128, __lsx_vandi_b(q4bits_1, 0xf)));
|
|
2134
|
+
const __m256i q4b_2 = lasx_insertf128(__lsx_vshuf_b(values128, values128, __lsx_vsrli_b(q4bits_2, 4)),
|
|
2135
|
+
__lsx_vshuf_b(values128, values128, __lsx_vandi_b(q4bits_2, 0xf)));
|
|
2136
|
+
const __m256i p16_1 = mul_add_epi8(q4b_1, q8b_1);
|
|
2137
|
+
const __m256i p16_2 = mul_add_epi8(q4b_2, q8b_2);
|
|
2138
|
+
const int16_t ls1 = ((x[ibl].scales_l[ib/2] & 0xf) | ((sh << 4) & 0x30)) - 32;
|
|
2139
|
+
const int16_t ls2 = ((x[ibl].scales_l[ib/2] >> 4) | ((sh << 2) & 0x30)) - 32;
|
|
2140
|
+
sh >>= 4;
|
|
2141
|
+
const __m256i p_1 = lasx_madd_h(p16_1, __lasx_xvreplgr2vr_h(ls1));
|
|
2142
|
+
const __m256i p_2 = lasx_madd_h(p16_2, __lasx_xvreplgr2vr_h(ls2));
|
|
2143
|
+
sumi1 = __lasx_xvadd_w(p_1, sumi1);
|
|
2144
|
+
sumi2 = __lasx_xvadd_w(p_2, sumi2);
|
|
2145
|
+
}
|
|
2146
|
+
accum = __lasx_xvfmadd_s(__lasx_xvreplfr2vr_s(GGML_CPU_FP16_TO_FP32(x[ibl].d)*y[ibl].d),
|
|
2147
|
+
__lasx_xvffint_s_w(__lasx_xvadd_w(sumi1, sumi2)), accum);
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
*s = hsum_float_8(accum);
|
|
2151
|
+
|
|
2152
|
+
#else
|
|
2153
|
+
UNUSED(x);
|
|
2154
|
+
UNUSED(y);
|
|
2155
|
+
UNUSED(nb);
|
|
2156
|
+
ggml_vec_dot_iq4_xs_q8_K_generic(n, s, bs, vx, bx, vy, by, nrc);
|
|
2157
|
+
#endif
|
|
2158
|
+
}
|