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,3231 @@
|
|
|
1
|
+
#ifndef GGML_WEBGPU_SHADER_LIB_HPP
|
|
2
|
+
#define GGML_WEBGPU_SHADER_LIB_HPP
|
|
3
|
+
|
|
4
|
+
#include "ggml-impl.h"
|
|
5
|
+
#include "ggml-wgsl-shaders.hpp"
|
|
6
|
+
#include "ggml.h"
|
|
7
|
+
#include "pre_wgsl.hpp"
|
|
8
|
+
|
|
9
|
+
#include <webgpu/webgpu_cpp.h>
|
|
10
|
+
|
|
11
|
+
#include <algorithm>
|
|
12
|
+
#include <memory>
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <unordered_map>
|
|
15
|
+
#include <vector>
|
|
16
|
+
|
|
17
|
+
#define GGML_WEBGPU_F16_SIZE_BYTES 2
|
|
18
|
+
#define GGML_WEBGPU_F32_SIZE_BYTES 4
|
|
19
|
+
#define GGML_WEBGPU_I32_SIZE_BYTES 4
|
|
20
|
+
#define GGML_WEBGPU_FLASH_ATTN_PREFERRED_KV_SG_TILES 8u
|
|
21
|
+
#define GGML_WEBGPU_FLASH_ATTN_PREFERRED_WG_SIZE 128u
|
|
22
|
+
// Matches GGML_PAD(..., 256) in src/llama-context.cpp for KV cache sizing.
|
|
23
|
+
#define GGML_WEBGPU_KV_SEQ_PAD 256u
|
|
24
|
+
|
|
25
|
+
#define GGML_WEBGPU_ARGSORT_MERGE_MAX_WG_SIZE 512u
|
|
26
|
+
|
|
27
|
+
// Matrix multiplication parameters
|
|
28
|
+
|
|
29
|
+
// Register tiling parameters
|
|
30
|
+
#define WEBGPU_MUL_MAT_TILE_M 4
|
|
31
|
+
#define WEBGPU_MUL_MAT_TILE_N 4
|
|
32
|
+
#define WEBGPU_MUL_MAT_WG_SIZE_M 8
|
|
33
|
+
#define WEBGPU_MUL_MAT_WG_SIZE_N 8
|
|
34
|
+
#define WEBGPU_MUL_MAT_REG_TILE_K_FLOAT 8
|
|
35
|
+
#define WEBGPU_MUL_MAT_REG_TILE_K_QUANT 32
|
|
36
|
+
|
|
37
|
+
// Subgroup matrix parameters
|
|
38
|
+
// The number of subgroups in the M dimension
|
|
39
|
+
#define WEBGPU_MUL_MAT_SUBGROUP_M 2
|
|
40
|
+
// The number of subgroups in the N dimension
|
|
41
|
+
#define WEBGPU_MUL_MAT_SUBGROUP_N 4
|
|
42
|
+
// The number of subgroup matrices each subgroup accumulates over
|
|
43
|
+
#define WEBGPU_MUL_MAT_SUBGROUP_MATRIX_M 4
|
|
44
|
+
#define WEBGPU_MUL_MAT_SUBGROUP_MATRIX_N 2
|
|
45
|
+
#define WEBGPU_MUL_MAT_SUBGROUP_TILE_K_FLOAT 32
|
|
46
|
+
#define WEBGPU_MUL_MAT_SUBGROUP_TILE_K_QUANT 32
|
|
47
|
+
|
|
48
|
+
// Matrix-vector multiplication parameters
|
|
49
|
+
#define WEBGPU_MUL_MAT_VEC_WG_SIZE 256
|
|
50
|
+
|
|
51
|
+
#define WEBGPU_MUL_MAT_VEC_FLOAT_OUTPUTS_PER_WG 4
|
|
52
|
+
#define WEBGPU_MUL_MAT_VEC_LEGACY_Q_OUTPUTS_PER_WG 4
|
|
53
|
+
#define WEBGPU_MUL_MAT_VEC_K_Q_OUTPUTS_PER_WG 4
|
|
54
|
+
|
|
55
|
+
// default size for legacy matrix multiplication
|
|
56
|
+
#define WEBGPU_MUL_MAT_WG_SIZE 256
|
|
57
|
+
|
|
58
|
+
// Same hash combine function as in boost
|
|
59
|
+
template <typename T> inline void ggml_webgpu_hash_combine(size_t & seed, const T & value) {
|
|
60
|
+
seed ^= std::hash<T>{}(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Calculates base address of a tensor ignoring the fake base pointer
|
|
64
|
+
inline uintptr_t ggml_webgpu_tensor_addr(const ggml_tensor * tensor) {
|
|
65
|
+
const ggml_tensor * base_tensor = tensor->view_src ? tensor->view_src : tensor;
|
|
66
|
+
return (uintptr_t) base_tensor->data + tensor->view_offs;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
inline bool ggml_webgpu_tensor_equal(const ggml_tensor * a, const ggml_tensor * b) {
|
|
70
|
+
return a->buffer == b->buffer && ggml_webgpu_tensor_addr(a) == ggml_webgpu_tensor_addr(b);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
inline bool ggml_webgpu_tensor_overlap(const ggml_tensor * a, const ggml_tensor * b) {
|
|
74
|
+
return a->buffer == b->buffer && ggml_webgpu_tensor_addr(a) < ggml_webgpu_tensor_addr(b) + ggml_nbytes(b) &&
|
|
75
|
+
ggml_webgpu_tensor_addr(b) < ggml_webgpu_tensor_addr(a) + ggml_nbytes(a);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
struct ggml_webgpu_shader_lib_context {
|
|
79
|
+
ggml_tensor * src0;
|
|
80
|
+
ggml_tensor * src1;
|
|
81
|
+
ggml_tensor * src2;
|
|
82
|
+
ggml_tensor * src3;
|
|
83
|
+
ggml_tensor * src4;
|
|
84
|
+
ggml_tensor * src5;
|
|
85
|
+
ggml_tensor * dst;
|
|
86
|
+
|
|
87
|
+
uint32_t max_wg_size;
|
|
88
|
+
size_t wg_mem_limit_bytes = 0;
|
|
89
|
+
bool supports_subgroups = false;
|
|
90
|
+
bool supports_subgroup_matrix = false;
|
|
91
|
+
uint32_t sg_mat_m = 0;
|
|
92
|
+
uint32_t sg_mat_n = 0;
|
|
93
|
+
uint32_t sg_mat_k = 0;
|
|
94
|
+
uint32_t min_subgroup_size = 0;
|
|
95
|
+
uint32_t max_subgroup_size = 0;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
struct webgpu_pipeline {
|
|
99
|
+
wgpu::ComputePipeline pipeline;
|
|
100
|
+
std::string name;
|
|
101
|
+
std::shared_ptr<void> context = nullptr;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
struct ggml_webgpu_generic_shader_decisions {
|
|
105
|
+
uint32_t wg_size = 0;
|
|
106
|
+
bool inplace = false;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
struct ggml_webgpu_binary_shader_decisions {
|
|
110
|
+
uint32_t wg_size = 0;
|
|
111
|
+
bool inplace = false;
|
|
112
|
+
bool overlap = false;
|
|
113
|
+
bool src_overlap = false;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
struct ggml_webgpu_processed_shader {
|
|
117
|
+
std::string wgsl;
|
|
118
|
+
std::string variant;
|
|
119
|
+
std::shared_ptr<void> decisions;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
struct ggml_webgpu_ssm_conv_shader_decisions {
|
|
123
|
+
uint32_t block_size;
|
|
124
|
+
uint32_t tokens_per_wg;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
struct ggml_webgpu_ssm_scan_pipeline_key {
|
|
128
|
+
int type;
|
|
129
|
+
int d_state;
|
|
130
|
+
bool xbc_overlap;
|
|
131
|
+
|
|
132
|
+
bool operator==(const ggml_webgpu_ssm_scan_pipeline_key & other) const {
|
|
133
|
+
return type == other.type && d_state == other.d_state && xbc_overlap == other.xbc_overlap;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
struct ggml_webgpu_ssm_scan_pipeline_key_hash {
|
|
138
|
+
size_t operator()(const ggml_webgpu_ssm_scan_pipeline_key & key) const {
|
|
139
|
+
size_t seed = 0;
|
|
140
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
141
|
+
ggml_webgpu_hash_combine(seed, key.d_state);
|
|
142
|
+
ggml_webgpu_hash_combine(seed, key.xbc_overlap);
|
|
143
|
+
return seed;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
struct ggml_webgpu_ssm_scan_shader_decisions {
|
|
148
|
+
uint32_t wg_size;
|
|
149
|
+
uint32_t tokens_per_tile;
|
|
150
|
+
bool xbc_overlap = false;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** Argsort **/
|
|
154
|
+
|
|
155
|
+
struct ggml_webgpu_argsort_shader_lib_context {
|
|
156
|
+
uint32_t max_wg_size;
|
|
157
|
+
size_t wg_mem_limit_bytes;
|
|
158
|
+
int32_t order;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/** Set Rows **/
|
|
162
|
+
|
|
163
|
+
struct ggml_webgpu_set_rows_pipeline_key {
|
|
164
|
+
int dst_type;
|
|
165
|
+
int vec4;
|
|
166
|
+
int i64_idx;
|
|
167
|
+
|
|
168
|
+
bool operator==(const ggml_webgpu_set_rows_pipeline_key & other) const {
|
|
169
|
+
return dst_type == other.dst_type && vec4 == other.vec4 && i64_idx == other.i64_idx;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
struct ggml_webgpu_set_rows_pipeline_key_hash {
|
|
174
|
+
size_t operator()(const ggml_webgpu_set_rows_pipeline_key & key) const {
|
|
175
|
+
size_t seed = 0;
|
|
176
|
+
ggml_webgpu_hash_combine(seed, key.dst_type);
|
|
177
|
+
ggml_webgpu_hash_combine(seed, key.vec4);
|
|
178
|
+
ggml_webgpu_hash_combine(seed, key.i64_idx);
|
|
179
|
+
return seed;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
struct ggml_webgpu_set_rows_shader_decisions {
|
|
184
|
+
bool vec4;
|
|
185
|
+
bool i64_idx;
|
|
186
|
+
uint32_t wg_size;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/** Set **/
|
|
190
|
+
|
|
191
|
+
struct ggml_webgpu_set_pipeline_key {
|
|
192
|
+
ggml_type type;
|
|
193
|
+
bool inplace;
|
|
194
|
+
|
|
195
|
+
bool operator==(const ggml_webgpu_set_pipeline_key & other) const {
|
|
196
|
+
return type == other.type && inplace == other.inplace;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
struct ggml_webgpu_set_pipeline_key_hash {
|
|
201
|
+
size_t operator()(const ggml_webgpu_set_pipeline_key & key) const {
|
|
202
|
+
size_t seed = 0;
|
|
203
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
204
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
205
|
+
return seed;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/** Get Rows **/
|
|
210
|
+
|
|
211
|
+
struct ggml_webgpu_get_rows_pipeline_key {
|
|
212
|
+
ggml_type src_type;
|
|
213
|
+
int vectorized;
|
|
214
|
+
|
|
215
|
+
bool operator==(const ggml_webgpu_get_rows_pipeline_key & other) const {
|
|
216
|
+
return src_type == other.src_type && vectorized == other.vectorized;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
struct ggml_webgpu_get_rows_pipeline_key_hash {
|
|
221
|
+
size_t operator()(const ggml_webgpu_get_rows_pipeline_key & key) const {
|
|
222
|
+
size_t seed = 0;
|
|
223
|
+
ggml_webgpu_hash_combine(seed, key.src_type);
|
|
224
|
+
ggml_webgpu_hash_combine(seed, key.vectorized);
|
|
225
|
+
return seed;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/** Row Norm **/
|
|
230
|
+
|
|
231
|
+
struct ggml_webgpu_row_norm_pipeline_key {
|
|
232
|
+
ggml_op op;
|
|
233
|
+
ggml_type src_type;
|
|
234
|
+
ggml_type dst_type;
|
|
235
|
+
bool inplace;
|
|
236
|
+
|
|
237
|
+
bool operator==(const ggml_webgpu_row_norm_pipeline_key & other) const {
|
|
238
|
+
return op == other.op && src_type == other.src_type && dst_type == other.dst_type && inplace == other.inplace;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
struct ggml_webgpu_row_norm_pipeline_key_hash {
|
|
243
|
+
size_t operator()(const ggml_webgpu_row_norm_pipeline_key & key) const {
|
|
244
|
+
size_t seed = 0;
|
|
245
|
+
ggml_webgpu_hash_combine(seed, key.op);
|
|
246
|
+
ggml_webgpu_hash_combine(seed, key.src_type);
|
|
247
|
+
ggml_webgpu_hash_combine(seed, key.dst_type);
|
|
248
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
249
|
+
return seed;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/** RMS_NORM + MUL **/
|
|
254
|
+
|
|
255
|
+
struct ggml_webgpu_rms_norm_mul_pipeline_key {
|
|
256
|
+
bool inplace; // rn_src == dst
|
|
257
|
+
bool overlap; // mul_src == dst
|
|
258
|
+
bool src_overlap; // rn_src == mul_src
|
|
259
|
+
|
|
260
|
+
bool operator==(const ggml_webgpu_rms_norm_mul_pipeline_key & other) const {
|
|
261
|
+
return inplace == other.inplace && overlap == other.overlap && src_overlap == other.src_overlap;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
struct ggml_webgpu_rms_norm_mul_pipeline_key_hash {
|
|
266
|
+
size_t operator()(const ggml_webgpu_rms_norm_mul_pipeline_key & key) const {
|
|
267
|
+
size_t seed = 0;
|
|
268
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
269
|
+
ggml_webgpu_hash_combine(seed, key.overlap);
|
|
270
|
+
ggml_webgpu_hash_combine(seed, key.src_overlap);
|
|
271
|
+
return seed;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
struct ggml_webgpu_rms_norm_mul_shader_decisions {
|
|
276
|
+
uint32_t wg_size = 0;
|
|
277
|
+
bool inplace = false;
|
|
278
|
+
bool overlap = false;
|
|
279
|
+
bool src_overlap = false;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/** Pad **/
|
|
283
|
+
struct ggml_webgpu_pad_pipeline_key {
|
|
284
|
+
bool circular;
|
|
285
|
+
|
|
286
|
+
bool operator==(const ggml_webgpu_pad_pipeline_key & other) const { return circular == other.circular; }
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
struct ggml_webgpu_pad_pipeline_key_hash {
|
|
290
|
+
size_t operator()(const ggml_webgpu_pad_pipeline_key & key) const {
|
|
291
|
+
size_t seed = 0;
|
|
292
|
+
ggml_webgpu_hash_combine(seed, key.circular);
|
|
293
|
+
return seed;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/** Solve Tri **/
|
|
298
|
+
struct ggml_webgpu_solve_tri_pipeline_key {
|
|
299
|
+
int type;
|
|
300
|
+
int n;
|
|
301
|
+
int k;
|
|
302
|
+
|
|
303
|
+
bool operator==(const ggml_webgpu_solve_tri_pipeline_key & other) const {
|
|
304
|
+
return type == other.type && n == other.n && k == other.k;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
struct ggml_webgpu_solve_tri_pipeline_key_hash {
|
|
309
|
+
size_t operator()(const ggml_webgpu_solve_tri_pipeline_key & key) const {
|
|
310
|
+
size_t seed = 0;
|
|
311
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
312
|
+
ggml_webgpu_hash_combine(seed, key.n);
|
|
313
|
+
ggml_webgpu_hash_combine(seed, key.k);
|
|
314
|
+
return seed;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
/** SSM Conv **/
|
|
319
|
+
struct ggml_webgpu_ssm_conv_pipeline_key {
|
|
320
|
+
int type;
|
|
321
|
+
int vectorized;
|
|
322
|
+
|
|
323
|
+
bool operator==(const ggml_webgpu_ssm_conv_pipeline_key & other) const {
|
|
324
|
+
return type == other.type && vectorized == other.vectorized;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/** CONV 2D */
|
|
329
|
+
struct ggml_webgpu_conv2d_pipeline_key {
|
|
330
|
+
ggml_type weight_type;
|
|
331
|
+
ggml_type input_type;
|
|
332
|
+
ggml_type output_type;
|
|
333
|
+
|
|
334
|
+
bool operator==(const ggml_webgpu_conv2d_pipeline_key & other) const {
|
|
335
|
+
return weight_type == other.weight_type && input_type == other.input_type && output_type == other.output_type;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
struct ggml_webgpu_conv2d_pipeline_key_hash {
|
|
340
|
+
size_t operator()(const ggml_webgpu_conv2d_pipeline_key & key) const {
|
|
341
|
+
size_t seed = 0;
|
|
342
|
+
ggml_webgpu_hash_combine(seed, key.weight_type);
|
|
343
|
+
ggml_webgpu_hash_combine(seed, key.input_type);
|
|
344
|
+
ggml_webgpu_hash_combine(seed, key.output_type);
|
|
345
|
+
return seed;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/** Im2Col **/
|
|
350
|
+
struct ggml_webgpu_im2col_pipeline_key {
|
|
351
|
+
ggml_type input_type;
|
|
352
|
+
ggml_type output_type;
|
|
353
|
+
|
|
354
|
+
bool operator==(const ggml_webgpu_im2col_pipeline_key & other) const {
|
|
355
|
+
return input_type == other.input_type && output_type == other.output_type;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
struct ggml_webgpu_im2col_pipeline_key_hash {
|
|
360
|
+
size_t operator()(const ggml_webgpu_im2col_pipeline_key & key) const {
|
|
361
|
+
size_t seed = 0;
|
|
362
|
+
ggml_webgpu_hash_combine(seed, key.input_type);
|
|
363
|
+
ggml_webgpu_hash_combine(seed, key.output_type);
|
|
364
|
+
return seed;
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/** Gated Delta Net **/
|
|
369
|
+
struct ggml_webgpu_gated_delta_net_pipeline_key {
|
|
370
|
+
int type;
|
|
371
|
+
int s_v;
|
|
372
|
+
int kda;
|
|
373
|
+
|
|
374
|
+
bool operator==(const ggml_webgpu_gated_delta_net_pipeline_key & other) const {
|
|
375
|
+
return type == other.type && s_v == other.s_v && kda == other.kda;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
struct ggml_webgpu_gated_delta_net_pipeline_key_hash {
|
|
380
|
+
size_t operator()(const ggml_webgpu_gated_delta_net_pipeline_key & key) const {
|
|
381
|
+
size_t seed = 0;
|
|
382
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
383
|
+
ggml_webgpu_hash_combine(seed, key.s_v);
|
|
384
|
+
ggml_webgpu_hash_combine(seed, key.kda);
|
|
385
|
+
return seed;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
struct ggml_webgpu_ssm_conv_pipeline_key_hash {
|
|
390
|
+
size_t operator()(const ggml_webgpu_ssm_conv_pipeline_key & key) const {
|
|
391
|
+
size_t seed = 0;
|
|
392
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
393
|
+
ggml_webgpu_hash_combine(seed, key.vectorized);
|
|
394
|
+
return seed;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
/** Scale **/
|
|
399
|
+
|
|
400
|
+
struct ggml_webgpu_scale_pipeline_key {
|
|
401
|
+
int inplace;
|
|
402
|
+
|
|
403
|
+
bool operator==(const ggml_webgpu_scale_pipeline_key & other) const { return inplace == other.inplace; }
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
struct ggml_webgpu_scale_pipeline_key_hash {
|
|
407
|
+
size_t operator()(const ggml_webgpu_scale_pipeline_key & key) const {
|
|
408
|
+
size_t seed = 0;
|
|
409
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
410
|
+
return seed;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
/** Upscale **/
|
|
415
|
+
|
|
416
|
+
struct ggml_webgpu_upscale_pipeline_key {
|
|
417
|
+
ggml_type input_type;
|
|
418
|
+
ggml_type output_type;
|
|
419
|
+
uint32_t base_mode;
|
|
420
|
+
bool antialias;
|
|
421
|
+
|
|
422
|
+
bool operator==(const ggml_webgpu_upscale_pipeline_key & other) const {
|
|
423
|
+
return input_type == other.input_type && output_type == other.output_type && base_mode == other.base_mode &&
|
|
424
|
+
antialias == other.antialias;
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
struct ggml_webgpu_upscale_pipeline_key_hash {
|
|
429
|
+
size_t operator()(const ggml_webgpu_upscale_pipeline_key & key) const {
|
|
430
|
+
size_t seed = 0;
|
|
431
|
+
ggml_webgpu_hash_combine(seed, key.input_type);
|
|
432
|
+
ggml_webgpu_hash_combine(seed, key.output_type);
|
|
433
|
+
ggml_webgpu_hash_combine(seed, key.base_mode);
|
|
434
|
+
ggml_webgpu_hash_combine(seed, key.antialias);
|
|
435
|
+
return seed;
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
/** Concat **/
|
|
440
|
+
|
|
441
|
+
struct ggml_webgpu_concat_pipeline_key {
|
|
442
|
+
int type;
|
|
443
|
+
|
|
444
|
+
bool operator==(const ggml_webgpu_concat_pipeline_key & other) const { return type == other.type; }
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
struct ggml_webgpu_concat_pipeline_key_hash {
|
|
448
|
+
size_t operator()(const ggml_webgpu_concat_pipeline_key & key) const {
|
|
449
|
+
size_t seed = 0;
|
|
450
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
451
|
+
return seed;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
/** Repeat **/
|
|
456
|
+
|
|
457
|
+
struct ggml_webgpu_repeat_pipeline_key {
|
|
458
|
+
int type;
|
|
459
|
+
|
|
460
|
+
bool operator==(const ggml_webgpu_repeat_pipeline_key & other) const { return type == other.type; }
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
struct ggml_webgpu_repeat_pipeline_key_hash {
|
|
464
|
+
size_t operator()(const ggml_webgpu_repeat_pipeline_key & key) const {
|
|
465
|
+
size_t seed = 0;
|
|
466
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
467
|
+
return seed;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/** Binary **/
|
|
472
|
+
|
|
473
|
+
struct ggml_webgpu_binary_pipeline_key {
|
|
474
|
+
int type;
|
|
475
|
+
int op;
|
|
476
|
+
bool inplace;
|
|
477
|
+
bool overlap;
|
|
478
|
+
bool src_overlap;
|
|
479
|
+
|
|
480
|
+
bool operator==(const ggml_webgpu_binary_pipeline_key & other) const {
|
|
481
|
+
return type == other.type && op == other.op && inplace == other.inplace && overlap == other.overlap &&
|
|
482
|
+
src_overlap == other.src_overlap;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
struct ggml_webgpu_binary_pipeline_key_hash {
|
|
487
|
+
size_t operator()(const ggml_webgpu_binary_pipeline_key & key) const {
|
|
488
|
+
size_t seed = 0;
|
|
489
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
490
|
+
ggml_webgpu_hash_combine(seed, key.op);
|
|
491
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
492
|
+
ggml_webgpu_hash_combine(seed, key.overlap);
|
|
493
|
+
ggml_webgpu_hash_combine(seed, key.src_overlap);
|
|
494
|
+
return seed;
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
/* Add_Id */
|
|
499
|
+
|
|
500
|
+
struct ggml_webgpu_add_id_pipeline_key {
|
|
501
|
+
bool inplace;
|
|
502
|
+
|
|
503
|
+
bool operator==(const ggml_webgpu_add_id_pipeline_key & other) const { return inplace == other.inplace; }
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
struct ggml_webgpu_add_id_pipeline_key_hash {
|
|
507
|
+
size_t operator()(const ggml_webgpu_add_id_pipeline_key & key) const {
|
|
508
|
+
size_t seed = 0;
|
|
509
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
510
|
+
return seed;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
/** Unary **/
|
|
515
|
+
|
|
516
|
+
struct ggml_webgpu_unary_pipeline_key {
|
|
517
|
+
int type;
|
|
518
|
+
int op;
|
|
519
|
+
bool is_unary; // many unary operators fall under the GGML_OP_UNARY umbrella
|
|
520
|
+
bool inplace;
|
|
521
|
+
ggml_tri_type ttype; // only used for GGML_OP_TRI
|
|
522
|
+
|
|
523
|
+
bool operator==(const ggml_webgpu_unary_pipeline_key & other) const {
|
|
524
|
+
return type == other.type && op == other.op && is_unary == other.is_unary && inplace == other.inplace &&
|
|
525
|
+
ttype == other.ttype;
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
struct ggml_webgpu_unary_pipeline_key_hash {
|
|
530
|
+
size_t operator()(const ggml_webgpu_unary_pipeline_key & key) const {
|
|
531
|
+
size_t seed = 0;
|
|
532
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
533
|
+
ggml_webgpu_hash_combine(seed, key.op);
|
|
534
|
+
ggml_webgpu_hash_combine(seed, key.is_unary);
|
|
535
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
536
|
+
ggml_webgpu_hash_combine(seed, key.ttype);
|
|
537
|
+
return seed;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
/** FlashAttention */
|
|
542
|
+
|
|
543
|
+
enum ggml_webgpu_flash_attn_path : uint32_t {
|
|
544
|
+
GGML_WEBGPU_FLASH_ATTN_PATH_NONE = 0u,
|
|
545
|
+
GGML_WEBGPU_FLASH_ATTN_PATH_SUBGROUP_MATRIX = 1u,
|
|
546
|
+
GGML_WEBGPU_FLASH_ATTN_PATH_TILE = 2u,
|
|
547
|
+
GGML_WEBGPU_FLASH_ATTN_PATH_VEC = 3u,
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
struct ggml_webgpu_flash_attn_pipeline_key {
|
|
551
|
+
ggml_type q_type;
|
|
552
|
+
ggml_type kv_type;
|
|
553
|
+
ggml_type dst_type;
|
|
554
|
+
uint32_t head_dim_qk;
|
|
555
|
+
uint32_t head_dim_v;
|
|
556
|
+
bool kv_direct;
|
|
557
|
+
bool kv_overlap;
|
|
558
|
+
bool has_mask;
|
|
559
|
+
bool has_sinks;
|
|
560
|
+
bool uses_logit_softcap;
|
|
561
|
+
uint32_t path;
|
|
562
|
+
|
|
563
|
+
bool operator==(const ggml_webgpu_flash_attn_pipeline_key & other) const {
|
|
564
|
+
return q_type == other.q_type && kv_type == other.kv_type && dst_type == other.dst_type &&
|
|
565
|
+
head_dim_qk == other.head_dim_qk && head_dim_v == other.head_dim_v && kv_direct == other.kv_direct &&
|
|
566
|
+
kv_overlap == other.kv_overlap && has_mask == other.has_mask && has_sinks == other.has_sinks &&
|
|
567
|
+
uses_logit_softcap == other.uses_logit_softcap && path == other.path;
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
struct ggml_webgpu_flash_attn_pipeline_key_hash {
|
|
572
|
+
size_t operator()(const ggml_webgpu_flash_attn_pipeline_key & key) const {
|
|
573
|
+
size_t seed = 0;
|
|
574
|
+
ggml_webgpu_hash_combine(seed, key.q_type);
|
|
575
|
+
ggml_webgpu_hash_combine(seed, key.kv_type);
|
|
576
|
+
ggml_webgpu_hash_combine(seed, key.dst_type);
|
|
577
|
+
ggml_webgpu_hash_combine(seed, key.head_dim_qk);
|
|
578
|
+
ggml_webgpu_hash_combine(seed, key.head_dim_v);
|
|
579
|
+
ggml_webgpu_hash_combine(seed, key.kv_direct);
|
|
580
|
+
ggml_webgpu_hash_combine(seed, key.kv_overlap);
|
|
581
|
+
ggml_webgpu_hash_combine(seed, key.has_mask);
|
|
582
|
+
ggml_webgpu_hash_combine(seed, key.has_sinks);
|
|
583
|
+
ggml_webgpu_hash_combine(seed, key.uses_logit_softcap);
|
|
584
|
+
ggml_webgpu_hash_combine(seed, key.path);
|
|
585
|
+
return seed;
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
struct ggml_webgpu_flash_attn_decisions {
|
|
590
|
+
uint32_t path = GGML_WEBGPU_FLASH_ATTN_PATH_NONE;
|
|
591
|
+
uint32_t q_tile = 0;
|
|
592
|
+
uint32_t kv_tile = 0;
|
|
593
|
+
uint32_t wg_size = 0;
|
|
594
|
+
bool kv_direct = false;
|
|
595
|
+
bool kv_overlap = false;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
inline constexpr uint32_t GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH = 4u;
|
|
599
|
+
inline constexpr uint32_t GGML_WEBGPU_FLASH_ATTN_TILE_Q_TILE = 4u;
|
|
600
|
+
|
|
601
|
+
inline uint32_t ggml_webgpu_flash_attn_pick_vec_ne(const ggml_webgpu_flash_attn_pipeline_key & key) {
|
|
602
|
+
if (key.path != GGML_WEBGPU_FLASH_ATTN_PATH_VEC || key.kv_type != GGML_TYPE_F16 ||
|
|
603
|
+
key.head_dim_qk != key.head_dim_v) {
|
|
604
|
+
return 1u;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
switch (key.head_dim_qk) {
|
|
608
|
+
case 64:
|
|
609
|
+
case 192:
|
|
610
|
+
case 576:
|
|
611
|
+
return 2u;
|
|
612
|
+
case 96:
|
|
613
|
+
return 4u;
|
|
614
|
+
default:
|
|
615
|
+
return 1u;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
inline ggml_webgpu_flash_attn_pipeline_key ggml_webgpu_flash_attn_make_pipeline_key(
|
|
620
|
+
const ggml_webgpu_shader_lib_context & context,
|
|
621
|
+
const ggml_webgpu_flash_attn_decisions & decisions) {
|
|
622
|
+
const bool has_mask = context.src3 != nullptr;
|
|
623
|
+
const bool has_sinks = context.src4 != nullptr;
|
|
624
|
+
bool kv_direct = false;
|
|
625
|
+
if (decisions.path != GGML_WEBGPU_FLASH_ATTN_PATH_TILE) {
|
|
626
|
+
uint32_t kv_direct_align = GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH;
|
|
627
|
+
if (decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_SUBGROUP_MATRIX) {
|
|
628
|
+
kv_direct_align = context.sg_mat_k;
|
|
629
|
+
}
|
|
630
|
+
kv_direct = (context.src1->type == GGML_TYPE_F16) &&
|
|
631
|
+
(context.src0->ne[0] % std::max(1u, kv_direct_align) == 0) &&
|
|
632
|
+
(context.src1->ne[1] % GGML_WEBGPU_KV_SEQ_PAD == 0);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
ggml_webgpu_flash_attn_pipeline_key key = {};
|
|
636
|
+
key.q_type = context.src0->type;
|
|
637
|
+
key.kv_type = context.src1->type;
|
|
638
|
+
key.dst_type = context.dst->type;
|
|
639
|
+
key.head_dim_qk = (uint32_t) context.src0->ne[0];
|
|
640
|
+
key.head_dim_v = (uint32_t) context.src2->ne[0];
|
|
641
|
+
key.kv_direct = kv_direct;
|
|
642
|
+
key.kv_overlap = ggml_webgpu_tensor_overlap(context.src1, context.src2);
|
|
643
|
+
key.has_mask = has_mask;
|
|
644
|
+
key.has_sinks = has_sinks;
|
|
645
|
+
key.uses_logit_softcap = ggml_get_op_params_f32(context.dst, 2) != 0.0f;
|
|
646
|
+
key.path = decisions.path;
|
|
647
|
+
return key;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
struct ggml_webgpu_flash_attn_vec_reduce_pipeline_key {
|
|
651
|
+
uint32_t head_dim_v;
|
|
652
|
+
uint32_t wg_size;
|
|
653
|
+
ggml_type dst_type;
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
struct ggml_webgpu_flash_attn_vec_reduce_pipeline_key_hash {
|
|
657
|
+
size_t operator()(const ggml_webgpu_flash_attn_vec_reduce_pipeline_key & key) const {
|
|
658
|
+
size_t seed = 0;
|
|
659
|
+
ggml_webgpu_hash_combine(seed, key.head_dim_v);
|
|
660
|
+
ggml_webgpu_hash_combine(seed, key.wg_size);
|
|
661
|
+
ggml_webgpu_hash_combine(seed, key.dst_type);
|
|
662
|
+
return seed;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
inline bool operator==(const ggml_webgpu_flash_attn_vec_reduce_pipeline_key & lhs,
|
|
667
|
+
const ggml_webgpu_flash_attn_vec_reduce_pipeline_key & rhs) {
|
|
668
|
+
return lhs.head_dim_v == rhs.head_dim_v && lhs.wg_size == rhs.wg_size && lhs.dst_type == rhs.dst_type;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
struct ggml_webgpu_flash_attn_blk_pipeline_key {
|
|
672
|
+
uint32_t kv_tile;
|
|
673
|
+
|
|
674
|
+
bool operator==(const ggml_webgpu_flash_attn_blk_pipeline_key & other) const { return kv_tile == other.kv_tile; }
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
struct ggml_webgpu_flash_attn_blk_pipeline_key_hash {
|
|
678
|
+
size_t operator()(const ggml_webgpu_flash_attn_blk_pipeline_key & key) const {
|
|
679
|
+
size_t seed = 0;
|
|
680
|
+
ggml_webgpu_hash_combine(seed, key.kv_tile);
|
|
681
|
+
return seed;
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// This is exposed because it's necessary in supports_op
|
|
686
|
+
inline size_t ggml_webgpu_flash_attn_wg_mem_bytes(uint32_t q_tile,
|
|
687
|
+
uint32_t kv_tile,
|
|
688
|
+
uint32_t head_dim_qk,
|
|
689
|
+
uint32_t head_dim_v,
|
|
690
|
+
bool has_mask,
|
|
691
|
+
bool kv_direct,
|
|
692
|
+
uint32_t path = GGML_WEBGPU_FLASH_ATTN_PATH_SUBGROUP_MATRIX) {
|
|
693
|
+
const uint32_t max_head_dim = std::max(head_dim_qk, head_dim_v);
|
|
694
|
+
size_t f16_elems = 0;
|
|
695
|
+
size_t f32_elems = 0;
|
|
696
|
+
if (path == GGML_WEBGPU_FLASH_ATTN_PATH_VEC) {
|
|
697
|
+
f32_elems += head_dim_qk; // q_shmem
|
|
698
|
+
if (!kv_direct) {
|
|
699
|
+
f32_elems += kv_tile * max_head_dim; // kv_shmem
|
|
700
|
+
}
|
|
701
|
+
f32_elems += head_dim_v; // o_shmem
|
|
702
|
+
if (has_mask) {
|
|
703
|
+
f32_elems += kv_tile; // mask_shmem
|
|
704
|
+
}
|
|
705
|
+
f32_elems += kv_tile; // inter_shmem
|
|
706
|
+
return f32_elems * GGML_WEBGPU_F32_SIZE_BYTES;
|
|
707
|
+
}
|
|
708
|
+
f32_elems += q_tile * head_dim_qk; // q_shmem
|
|
709
|
+
if (!kv_direct) {
|
|
710
|
+
f32_elems += kv_tile * max_head_dim; // kv_shmem
|
|
711
|
+
}
|
|
712
|
+
f32_elems += q_tile * head_dim_v; // o_shmem
|
|
713
|
+
if (has_mask) {
|
|
714
|
+
f32_elems += q_tile * kv_tile; // mask_shmem
|
|
715
|
+
}
|
|
716
|
+
f32_elems += q_tile * kv_tile; // inter_shmem
|
|
717
|
+
f32_elems += q_tile; // row_max_shmem
|
|
718
|
+
f32_elems += q_tile; // exp_sum_shmem
|
|
719
|
+
return f16_elems * GGML_WEBGPU_F16_SIZE_BYTES + f32_elems * GGML_WEBGPU_F32_SIZE_BYTES;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
inline uint32_t ggml_webgpu_flash_attn_max_kv_tile(const ggml_webgpu_shader_lib_context & context,
|
|
723
|
+
const ggml_webgpu_flash_attn_pipeline_key & key) {
|
|
724
|
+
const size_t limit_bytes = context.wg_mem_limit_bytes;
|
|
725
|
+
uint32_t q_tile = context.sg_mat_m;
|
|
726
|
+
uint32_t kv_granularity = std::max(1u, context.sg_mat_n);
|
|
727
|
+
if (key.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE) {
|
|
728
|
+
q_tile = GGML_WEBGPU_FLASH_ATTN_TILE_Q_TILE;
|
|
729
|
+
kv_granularity = 1u;
|
|
730
|
+
} else if (key.path == GGML_WEBGPU_FLASH_ATTN_PATH_VEC) {
|
|
731
|
+
q_tile = 1u;
|
|
732
|
+
kv_granularity = 8u;
|
|
733
|
+
}
|
|
734
|
+
const size_t base_q_bytes = ggml_webgpu_flash_attn_wg_mem_bytes(q_tile, 0, key.head_dim_qk, key.head_dim_v,
|
|
735
|
+
key.has_mask, key.kv_direct, key.path);
|
|
736
|
+
if (limit_bytes <= base_q_bytes) {
|
|
737
|
+
return 0;
|
|
738
|
+
}
|
|
739
|
+
const size_t one_kv_bytes = ggml_webgpu_flash_attn_wg_mem_bytes(q_tile, 1, key.head_dim_qk, key.head_dim_v,
|
|
740
|
+
key.has_mask, key.kv_direct, key.path);
|
|
741
|
+
const size_t bytes_per_kv = one_kv_bytes - base_q_bytes;
|
|
742
|
+
if (bytes_per_kv == 0) {
|
|
743
|
+
return 0;
|
|
744
|
+
}
|
|
745
|
+
const size_t max_kv_tile = (limit_bytes - base_q_bytes) / bytes_per_kv;
|
|
746
|
+
return (uint32_t) ((max_kv_tile / kv_granularity) * kv_granularity);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
inline ggml_webgpu_flash_attn_decisions ggml_webgpu_flash_attn_get_decisions(
|
|
750
|
+
const ggml_webgpu_shader_lib_context & context,
|
|
751
|
+
size_t storage_offset_alignment) {
|
|
752
|
+
ggml_webgpu_flash_attn_decisions decisions = {};
|
|
753
|
+
const size_t alignment = std::max<size_t>(1u, storage_offset_alignment);
|
|
754
|
+
const auto * K = context.src1;
|
|
755
|
+
const auto * V = context.src2;
|
|
756
|
+
GGML_ASSERT(K != nullptr);
|
|
757
|
+
GGML_ASSERT(V != nullptr);
|
|
758
|
+
|
|
759
|
+
const auto flash_attn_tensor_offset = [](const ggml_tensor * tensor) -> size_t {
|
|
760
|
+
constexpr uintptr_t ptr_base_addr = 0x1000u;
|
|
761
|
+
const ggml_tensor * base = tensor->view_src != nullptr ? tensor->view_src : tensor;
|
|
762
|
+
return reinterpret_cast<uintptr_t>(base->data) - ptr_base_addr + tensor->view_offs;
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
const uint32_t k_offset_elems =
|
|
766
|
+
(uint32_t) ((flash_attn_tensor_offset(K) & (alignment - 1)) / ggml_type_size(K->type));
|
|
767
|
+
const uint32_t v_offset_elems =
|
|
768
|
+
(uint32_t) ((flash_attn_tensor_offset(V) & (alignment - 1)) / ggml_type_size(V->type));
|
|
769
|
+
const bool f16_vec4_aligned = (k_offset_elems % GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH == 0u) &&
|
|
770
|
+
(v_offset_elems % GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH == 0u);
|
|
771
|
+
const bool kv_vec_type_supported =
|
|
772
|
+
K->type == GGML_TYPE_F16 || K->type == GGML_TYPE_Q4_0 || K->type == GGML_TYPE_Q8_0;
|
|
773
|
+
const uint32_t kv_vec_head_align = K->type == GGML_TYPE_F16 ? GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH :
|
|
774
|
+
(uint32_t) ggml_blck_size(K->type);
|
|
775
|
+
const bool kv_vec_head_dims_aligned = context.src0->ne[0] % kv_vec_head_align == 0 &&
|
|
776
|
+
context.src2->ne[0] % kv_vec_head_align == 0;
|
|
777
|
+
// Compile with enough invocations to cover the largest reported subgroup.
|
|
778
|
+
const bool use_vec = context.supports_subgroups && (context.src0->ne[1] < 20) &&
|
|
779
|
+
kv_vec_head_dims_aligned && kv_vec_type_supported &&
|
|
780
|
+
(K->type != GGML_TYPE_F16 || f16_vec4_aligned) &&
|
|
781
|
+
(context.src2->type == K->type);
|
|
782
|
+
const bool tile_can_dispatch_all_q_rows =
|
|
783
|
+
context.max_subgroup_size > 0 &&
|
|
784
|
+
context.max_wg_size >= GGML_WEBGPU_FLASH_ATTN_TILE_Q_TILE * context.max_subgroup_size;
|
|
785
|
+
const bool use_subgroup_matrix =
|
|
786
|
+
context.supports_subgroup_matrix && context.sg_mat_k > 0 && context.sg_mat_n > 0 &&
|
|
787
|
+
context.src0->ne[0] % context.sg_mat_k == 0 && context.src2->ne[0] % context.sg_mat_n == 0;
|
|
788
|
+
const bool use_tile = context.supports_subgroups && !use_subgroup_matrix && K->type == GGML_TYPE_F16 &&
|
|
789
|
+
V->type == GGML_TYPE_F16 && f16_vec4_aligned &&
|
|
790
|
+
(context.src0->ne[0] % GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH == 0) &&
|
|
791
|
+
(context.src2->ne[0] % GGML_WEBGPU_FLASH_ATTN_TILE_KV_VEC_WIDTH == 0) &&
|
|
792
|
+
tile_can_dispatch_all_q_rows && !use_vec;
|
|
793
|
+
|
|
794
|
+
decisions.path = use_vec ? GGML_WEBGPU_FLASH_ATTN_PATH_VEC :
|
|
795
|
+
use_tile ? GGML_WEBGPU_FLASH_ATTN_PATH_TILE :
|
|
796
|
+
use_subgroup_matrix ? GGML_WEBGPU_FLASH_ATTN_PATH_SUBGROUP_MATRIX :
|
|
797
|
+
GGML_WEBGPU_FLASH_ATTN_PATH_NONE;
|
|
798
|
+
|
|
799
|
+
if (decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_NONE) {
|
|
800
|
+
return decisions;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
const ggml_webgpu_flash_attn_pipeline_key key = ggml_webgpu_flash_attn_make_pipeline_key(context, decisions);
|
|
804
|
+
decisions.kv_direct = key.kv_direct;
|
|
805
|
+
const uint32_t max_kv_tile = ggml_webgpu_flash_attn_max_kv_tile(context, key);
|
|
806
|
+
// invalidate if even the smallest kv_tile doesn't fit in shared memory
|
|
807
|
+
if (max_kv_tile == 0) {
|
|
808
|
+
decisions.path = GGML_WEBGPU_FLASH_ATTN_PATH_NONE;
|
|
809
|
+
return decisions;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
if (decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_VEC) {
|
|
813
|
+
decisions.q_tile = 1u;
|
|
814
|
+
decisions.kv_tile = std::max(8u, std::min(32u, max_kv_tile));
|
|
815
|
+
decisions.kv_tile = (decisions.kv_tile / 8u) * 8u;
|
|
816
|
+
decisions.wg_size = context.max_subgroup_size;
|
|
817
|
+
if (decisions.kv_direct) {
|
|
818
|
+
decisions.kv_tile = std::min(decisions.kv_tile, GGML_WEBGPU_KV_SEQ_PAD);
|
|
819
|
+
while (GGML_WEBGPU_KV_SEQ_PAD % decisions.kv_tile != 0) {
|
|
820
|
+
decisions.kv_tile -= 8u;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return decisions;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
decisions.q_tile =
|
|
827
|
+
decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE ? GGML_WEBGPU_FLASH_ATTN_TILE_Q_TILE : context.sg_mat_m;
|
|
828
|
+
decisions.kv_tile = decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE ?
|
|
829
|
+
std::min(64u, max_kv_tile) :
|
|
830
|
+
std::min(max_kv_tile, context.sg_mat_n * GGML_WEBGPU_FLASH_ATTN_PREFERRED_KV_SG_TILES);
|
|
831
|
+
decisions.wg_size = decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE ?
|
|
832
|
+
std::min(std::max(1u, context.max_wg_size),
|
|
833
|
+
std::max(GGML_WEBGPU_FLASH_ATTN_PREFERRED_WG_SIZE,
|
|
834
|
+
GGML_WEBGPU_FLASH_ATTN_TILE_Q_TILE * context.max_subgroup_size)) :
|
|
835
|
+
std::max(context.max_subgroup_size, GGML_WEBGPU_FLASH_ATTN_PREFERRED_WG_SIZE);
|
|
836
|
+
|
|
837
|
+
if (decisions.kv_tile == 0) {
|
|
838
|
+
return decisions;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
if (decisions.kv_direct) {
|
|
842
|
+
GGML_ASSERT(decisions.kv_tile <= GGML_WEBGPU_KV_SEQ_PAD);
|
|
843
|
+
while (GGML_WEBGPU_KV_SEQ_PAD % decisions.kv_tile != 0) {
|
|
844
|
+
decisions.kv_tile -=
|
|
845
|
+
decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE ? context.min_subgroup_size : context.sg_mat_n;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return decisions;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/** Matrix Multiplication **/
|
|
852
|
+
|
|
853
|
+
struct ggml_webgpu_legacy_mul_mat_pipeline_key {
|
|
854
|
+
ggml_type src0_type;
|
|
855
|
+
ggml_type src1_type;
|
|
856
|
+
|
|
857
|
+
bool operator==(const ggml_webgpu_legacy_mul_mat_pipeline_key & other) const {
|
|
858
|
+
return src0_type == other.src0_type && src1_type == other.src1_type;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
struct ggml_webgpu_legacy_mul_mat_pipeline_key_hash {
|
|
863
|
+
size_t operator()(const ggml_webgpu_legacy_mul_mat_pipeline_key & key) const {
|
|
864
|
+
size_t seed = 0;
|
|
865
|
+
ggml_webgpu_hash_combine(seed, key.src0_type);
|
|
866
|
+
ggml_webgpu_hash_combine(seed, key.src1_type);
|
|
867
|
+
return seed;
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
struct ggml_webgpu_mul_mat_vec_pipeline_key {
|
|
872
|
+
ggml_type src0_type;
|
|
873
|
+
ggml_type src1_type;
|
|
874
|
+
int vectorized;
|
|
875
|
+
|
|
876
|
+
bool operator==(const ggml_webgpu_mul_mat_vec_pipeline_key & other) const {
|
|
877
|
+
return src0_type == other.src0_type && src1_type == other.src1_type && vectorized == other.vectorized;
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
struct ggml_webgpu_mul_mat_vec_pipeline_key_hash {
|
|
882
|
+
size_t operator()(const ggml_webgpu_mul_mat_vec_pipeline_key & key) const {
|
|
883
|
+
size_t seed = 0;
|
|
884
|
+
ggml_webgpu_hash_combine(seed, key.src0_type);
|
|
885
|
+
ggml_webgpu_hash_combine(seed, key.src1_type);
|
|
886
|
+
ggml_webgpu_hash_combine(seed, key.vectorized);
|
|
887
|
+
return seed;
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
struct ggml_webgpu_mul_mat_vec_shader_decisions {
|
|
892
|
+
uint32_t wg_size;
|
|
893
|
+
uint32_t outputs_per_wg;
|
|
894
|
+
uint32_t vec_size;
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
struct ggml_webgpu_mul_mat_pipeline_key {
|
|
898
|
+
ggml_type src0_type;
|
|
899
|
+
ggml_type src1_type;
|
|
900
|
+
int vectorized;
|
|
901
|
+
int use_subgroup_matrix;
|
|
902
|
+
|
|
903
|
+
bool operator==(const ggml_webgpu_mul_mat_pipeline_key & other) const {
|
|
904
|
+
return src0_type == other.src0_type && src1_type == other.src1_type && vectorized == other.vectorized &&
|
|
905
|
+
use_subgroup_matrix == other.use_subgroup_matrix;
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
struct ggml_webgpu_mul_mat_pipeline_key_hash {
|
|
910
|
+
size_t operator()(const ggml_webgpu_mul_mat_pipeline_key & key) const {
|
|
911
|
+
size_t seed = 0;
|
|
912
|
+
ggml_webgpu_hash_combine(seed, key.src0_type);
|
|
913
|
+
ggml_webgpu_hash_combine(seed, key.src1_type);
|
|
914
|
+
ggml_webgpu_hash_combine(seed, key.vectorized);
|
|
915
|
+
ggml_webgpu_hash_combine(seed, key.use_subgroup_matrix);
|
|
916
|
+
return seed;
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
struct ggml_webgpu_mul_mat_shader_decisions {
|
|
921
|
+
uint32_t tile_k;
|
|
922
|
+
uint32_t wg_size_m;
|
|
923
|
+
uint32_t wg_size_n;
|
|
924
|
+
uint32_t wg_size;
|
|
925
|
+
uint32_t outputs_per_wg;
|
|
926
|
+
int use_subgroup_matrix;
|
|
927
|
+
|
|
928
|
+
uint32_t tile_m;
|
|
929
|
+
uint32_t tile_n;
|
|
930
|
+
|
|
931
|
+
// Subgroup matrix parameters
|
|
932
|
+
uint32_t subgroup_m;
|
|
933
|
+
uint32_t subgroup_n;
|
|
934
|
+
uint32_t subgroup_matrix_m;
|
|
935
|
+
uint32_t subgroup_matrix_n;
|
|
936
|
+
|
|
937
|
+
uint32_t mul_mat_wg_size;
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
/** MUL_MAT_ID **/
|
|
941
|
+
|
|
942
|
+
struct ggml_webgpu_mul_mat_id_pipeline_key {
|
|
943
|
+
ggml_type src0_type;
|
|
944
|
+
ggml_type src1_type;
|
|
945
|
+
uint32_t n_experts;
|
|
946
|
+
int vectorized;
|
|
947
|
+
|
|
948
|
+
bool operator==(const ggml_webgpu_mul_mat_id_pipeline_key & other) const {
|
|
949
|
+
return src0_type == other.src0_type && src1_type == other.src1_type && n_experts == other.n_experts &&
|
|
950
|
+
vectorized == other.vectorized;
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
struct ggml_webgpu_mul_mat_id_pipeline_key_hash {
|
|
955
|
+
size_t operator()(const ggml_webgpu_mul_mat_id_pipeline_key & key) const {
|
|
956
|
+
size_t seed = 0;
|
|
957
|
+
ggml_webgpu_hash_combine(seed, key.src0_type);
|
|
958
|
+
ggml_webgpu_hash_combine(seed, key.src1_type);
|
|
959
|
+
ggml_webgpu_hash_combine(seed, key.n_experts);
|
|
960
|
+
ggml_webgpu_hash_combine(seed, key.vectorized);
|
|
961
|
+
return seed;
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
/** Cpy **/
|
|
966
|
+
|
|
967
|
+
struct ggml_webgpu_cpy_pipeline_key {
|
|
968
|
+
ggml_type src_type;
|
|
969
|
+
ggml_type dst_type;
|
|
970
|
+
|
|
971
|
+
bool operator==(const ggml_webgpu_cpy_pipeline_key & other) const {
|
|
972
|
+
return src_type == other.src_type && dst_type == other.dst_type;
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
struct ggml_webgpu_cpy_pipeline_key_hash {
|
|
977
|
+
size_t operator()(const ggml_webgpu_cpy_pipeline_key & key) const {
|
|
978
|
+
size_t seed = 0;
|
|
979
|
+
ggml_webgpu_hash_combine(seed, key.src_type);
|
|
980
|
+
ggml_webgpu_hash_combine(seed, key.dst_type);
|
|
981
|
+
return seed;
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
/** Glu **/
|
|
986
|
+
|
|
987
|
+
struct ggml_webgpu_glu_pipeline_key {
|
|
988
|
+
ggml_glu_op glu_op;
|
|
989
|
+
ggml_type type;
|
|
990
|
+
bool split;
|
|
991
|
+
|
|
992
|
+
bool operator==(const ggml_webgpu_glu_pipeline_key & other) const {
|
|
993
|
+
return glu_op == other.glu_op && type == other.type && split == other.split;
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
struct ggml_webgpu_glu_pipeline_key_hash {
|
|
998
|
+
size_t operator()(const ggml_webgpu_glu_pipeline_key & key) const {
|
|
999
|
+
size_t seed = 0;
|
|
1000
|
+
ggml_webgpu_hash_combine(seed, key.glu_op);
|
|
1001
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
1002
|
+
ggml_webgpu_hash_combine(seed, key.split);
|
|
1003
|
+
return seed;
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
/** Rope **/
|
|
1008
|
+
|
|
1009
|
+
struct ggml_webgpu_rope_pipeline_key {
|
|
1010
|
+
ggml_type type;
|
|
1011
|
+
bool inplace;
|
|
1012
|
+
bool has_ff;
|
|
1013
|
+
|
|
1014
|
+
bool operator==(const ggml_webgpu_rope_pipeline_key & other) const {
|
|
1015
|
+
return type == other.type && inplace == other.inplace && has_ff == other.has_ff;
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
struct ggml_webgpu_rope_pipeline_key_hash {
|
|
1020
|
+
size_t operator()(const ggml_webgpu_rope_pipeline_key & key) const {
|
|
1021
|
+
size_t seed = 0;
|
|
1022
|
+
ggml_webgpu_hash_combine(seed, key.type);
|
|
1023
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
1024
|
+
ggml_webgpu_hash_combine(seed, key.has_ff);
|
|
1025
|
+
return seed;
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
/** SoftMax **/
|
|
1030
|
+
|
|
1031
|
+
struct ggml_webgpu_soft_max_pipeline_key {
|
|
1032
|
+
ggml_type mask_type;
|
|
1033
|
+
bool has_mask;
|
|
1034
|
+
bool has_sink;
|
|
1035
|
+
bool inplace;
|
|
1036
|
+
|
|
1037
|
+
bool operator==(const ggml_webgpu_soft_max_pipeline_key & other) const {
|
|
1038
|
+
return mask_type == other.mask_type && has_mask == other.has_mask && has_sink == other.has_sink &&
|
|
1039
|
+
inplace == other.inplace;
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
struct ggml_webgpu_soft_max_pipeline_key_hash {
|
|
1044
|
+
size_t operator()(const ggml_webgpu_soft_max_pipeline_key & key) const {
|
|
1045
|
+
size_t seed = 0;
|
|
1046
|
+
ggml_webgpu_hash_combine(seed, key.mask_type);
|
|
1047
|
+
ggml_webgpu_hash_combine(seed, key.has_mask);
|
|
1048
|
+
ggml_webgpu_hash_combine(seed, key.has_sink);
|
|
1049
|
+
ggml_webgpu_hash_combine(seed, key.inplace);
|
|
1050
|
+
return seed;
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
class ggml_webgpu_shader_lib {
|
|
1055
|
+
wgpu::Device device;
|
|
1056
|
+
pre_wgsl::Preprocessor preprocessor;
|
|
1057
|
+
|
|
1058
|
+
std::unordered_map<int, webgpu_pipeline> sum_rows_pipelines; // key is fixed, no variants yet
|
|
1059
|
+
std::unordered_map<int, webgpu_pipeline> argmax_pipelines; // key is vec4
|
|
1060
|
+
std::unordered_map<int, webgpu_pipeline> argsort_pipelines; // key is order
|
|
1061
|
+
std::unordered_map<int, webgpu_pipeline> argsort_merge_pipelines; // key is order
|
|
1062
|
+
std::unordered_map<int, webgpu_pipeline> cumsum_pipelines; // key is fixed, no variants yet
|
|
1063
|
+
std::unordered_map<ggml_webgpu_row_norm_pipeline_key, webgpu_pipeline, ggml_webgpu_row_norm_pipeline_key_hash>
|
|
1064
|
+
row_norm_pipelines; // op/inplace
|
|
1065
|
+
|
|
1066
|
+
std::unordered_map<ggml_webgpu_get_rows_pipeline_key, webgpu_pipeline, ggml_webgpu_get_rows_pipeline_key_hash>
|
|
1067
|
+
get_rows_pipelines; // src_type, vectorized
|
|
1068
|
+
std::unordered_map<ggml_webgpu_unary_pipeline_key, webgpu_pipeline, ggml_webgpu_unary_pipeline_key_hash>
|
|
1069
|
+
unary_pipelines; // type/op/inplace
|
|
1070
|
+
std::unordered_map<ggml_webgpu_scale_pipeline_key, webgpu_pipeline, ggml_webgpu_scale_pipeline_key_hash>
|
|
1071
|
+
scale_pipelines; // inplace
|
|
1072
|
+
std::unordered_map<ggml_webgpu_solve_tri_pipeline_key, webgpu_pipeline, ggml_webgpu_solve_tri_pipeline_key_hash>
|
|
1073
|
+
solve_tri_pipelines; // type
|
|
1074
|
+
std::unordered_map<ggml_webgpu_ssm_conv_pipeline_key, webgpu_pipeline, ggml_webgpu_ssm_conv_pipeline_key_hash>
|
|
1075
|
+
ssm_conv_pipelines; // type/vectorized
|
|
1076
|
+
std::unordered_map<ggml_webgpu_ssm_scan_pipeline_key, webgpu_pipeline, ggml_webgpu_ssm_scan_pipeline_key_hash>
|
|
1077
|
+
ssm_scan_pipelines; // type/d_state
|
|
1078
|
+
std::unordered_map<ggml_webgpu_gated_delta_net_pipeline_key,
|
|
1079
|
+
webgpu_pipeline,
|
|
1080
|
+
ggml_webgpu_gated_delta_net_pipeline_key_hash>
|
|
1081
|
+
gated_delta_net_pipelines; // type/S_v/kda
|
|
1082
|
+
std::unordered_map<ggml_webgpu_pad_pipeline_key, webgpu_pipeline, ggml_webgpu_pad_pipeline_key_hash>
|
|
1083
|
+
pad_pipelines; // circular/non-circular
|
|
1084
|
+
std::unordered_map<ggml_webgpu_binary_pipeline_key, webgpu_pipeline, ggml_webgpu_binary_pipeline_key_hash>
|
|
1085
|
+
binary_pipelines; // type/op/inplace/overlap/src_overlap
|
|
1086
|
+
std::unordered_map<ggml_webgpu_add_id_pipeline_key, webgpu_pipeline, ggml_webgpu_add_id_pipeline_key_hash>
|
|
1087
|
+
add_id_pipelines; // inplace
|
|
1088
|
+
std::unordered_map<ggml_webgpu_concat_pipeline_key, webgpu_pipeline, ggml_webgpu_concat_pipeline_key_hash>
|
|
1089
|
+
concat_pipelines; // type
|
|
1090
|
+
std::unordered_map<ggml_webgpu_repeat_pipeline_key, webgpu_pipeline, ggml_webgpu_repeat_pipeline_key_hash>
|
|
1091
|
+
repeat_pipelines; // type
|
|
1092
|
+
std::unordered_map<ggml_webgpu_flash_attn_pipeline_key, webgpu_pipeline, ggml_webgpu_flash_attn_pipeline_key_hash>
|
|
1093
|
+
flash_attn_pipelines;
|
|
1094
|
+
std::unordered_map<ggml_webgpu_flash_attn_vec_reduce_pipeline_key,
|
|
1095
|
+
webgpu_pipeline,
|
|
1096
|
+
ggml_webgpu_flash_attn_vec_reduce_pipeline_key_hash>
|
|
1097
|
+
flash_attn_vec_reduce_pipelines;
|
|
1098
|
+
std::unordered_map<ggml_webgpu_flash_attn_blk_pipeline_key,
|
|
1099
|
+
webgpu_pipeline,
|
|
1100
|
+
ggml_webgpu_flash_attn_blk_pipeline_key_hash>
|
|
1101
|
+
flash_attn_blk_pipelines;
|
|
1102
|
+
std::unordered_map<ggml_webgpu_legacy_mul_mat_pipeline_key,
|
|
1103
|
+
webgpu_pipeline,
|
|
1104
|
+
ggml_webgpu_legacy_mul_mat_pipeline_key_hash>
|
|
1105
|
+
mul_mat_legacy_pipelines; // legacy mul_mat (non-subgroup/non-regtile/non-vec)
|
|
1106
|
+
std::unordered_map<ggml_webgpu_mul_mat_vec_pipeline_key, webgpu_pipeline, ggml_webgpu_mul_mat_vec_pipeline_key_hash>
|
|
1107
|
+
mul_mat_vec_pipelines; // fast mat-vec (n==1)
|
|
1108
|
+
std::unordered_map<ggml_webgpu_mul_mat_pipeline_key, webgpu_pipeline, ggml_webgpu_mul_mat_pipeline_key_hash>
|
|
1109
|
+
mul_mat_fast_pipelines; // fast mat-mat (reg-tile or subgroup)
|
|
1110
|
+
std::unordered_map<int, webgpu_pipeline> mul_mat_id_gather_pipelines; // key is fixed
|
|
1111
|
+
std::unordered_map<ggml_webgpu_mul_mat_id_pipeline_key, webgpu_pipeline, ggml_webgpu_mul_mat_id_pipeline_key_hash>
|
|
1112
|
+
mul_mat_id_pipelines; // src0_type/src1_type
|
|
1113
|
+
std::unordered_map<ggml_webgpu_mul_mat_id_pipeline_key, webgpu_pipeline, ggml_webgpu_mul_mat_id_pipeline_key_hash>
|
|
1114
|
+
mul_mat_id_vec_pipelines; // src0_type/src1_type
|
|
1115
|
+
|
|
1116
|
+
std::unordered_map<ggml_webgpu_set_rows_pipeline_key, webgpu_pipeline, ggml_webgpu_set_rows_pipeline_key_hash>
|
|
1117
|
+
set_rows_pipelines;
|
|
1118
|
+
std::unordered_map<ggml_webgpu_set_pipeline_key, webgpu_pipeline, ggml_webgpu_set_pipeline_key_hash> set_pipelines;
|
|
1119
|
+
std::unordered_map<ggml_webgpu_cpy_pipeline_key, webgpu_pipeline, ggml_webgpu_cpy_pipeline_key_hash> cpy_pipelines;
|
|
1120
|
+
std::unordered_map<ggml_webgpu_glu_pipeline_key, webgpu_pipeline, ggml_webgpu_glu_pipeline_key_hash> glu_pipelines;
|
|
1121
|
+
std::unordered_map<ggml_webgpu_rope_pipeline_key, webgpu_pipeline, ggml_webgpu_rope_pipeline_key_hash>
|
|
1122
|
+
rope_pipelines;
|
|
1123
|
+
std::unordered_map<ggml_webgpu_soft_max_pipeline_key, webgpu_pipeline, ggml_webgpu_soft_max_pipeline_key_hash>
|
|
1124
|
+
soft_max_pipelines;
|
|
1125
|
+
std::unordered_map<ggml_webgpu_conv2d_pipeline_key, webgpu_pipeline, ggml_webgpu_conv2d_pipeline_key_hash>
|
|
1126
|
+
conv2d_pipelines;
|
|
1127
|
+
std::unordered_map<ggml_webgpu_im2col_pipeline_key, webgpu_pipeline, ggml_webgpu_im2col_pipeline_key_hash>
|
|
1128
|
+
im2col_pipelines;
|
|
1129
|
+
|
|
1130
|
+
std::unordered_map<ggml_webgpu_rms_norm_mul_pipeline_key,
|
|
1131
|
+
webgpu_pipeline,
|
|
1132
|
+
ggml_webgpu_rms_norm_mul_pipeline_key_hash>
|
|
1133
|
+
rms_norm_mul_pipelines;
|
|
1134
|
+
std::unordered_map<ggml_webgpu_upscale_pipeline_key, webgpu_pipeline, ggml_webgpu_upscale_pipeline_key_hash>
|
|
1135
|
+
upscale_pipelines;
|
|
1136
|
+
|
|
1137
|
+
public:
|
|
1138
|
+
ggml_webgpu_shader_lib(wgpu::Device device) { this->device = device; }
|
|
1139
|
+
|
|
1140
|
+
webgpu_pipeline get_sum_rows_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1141
|
+
auto it = sum_rows_pipelines.find(1);
|
|
1142
|
+
if (it != sum_rows_pipelines.end()) {
|
|
1143
|
+
return it->second;
|
|
1144
|
+
}
|
|
1145
|
+
std::vector<std::string> defines;
|
|
1146
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1147
|
+
|
|
1148
|
+
auto processed = preprocessor.preprocess(wgsl_sum_rows, defines);
|
|
1149
|
+
sum_rows_pipelines[1] = ggml_webgpu_create_pipeline(device, processed, "sum_rows");
|
|
1150
|
+
return sum_rows_pipelines[1];
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
webgpu_pipeline get_row_norm_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1154
|
+
ggml_webgpu_row_norm_pipeline_key key = {};
|
|
1155
|
+
key.op = context.dst->op;
|
|
1156
|
+
key.src_type = context.src0->type;
|
|
1157
|
+
key.dst_type = context.dst->type;
|
|
1158
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
1159
|
+
|
|
1160
|
+
auto it = row_norm_pipelines.find(key);
|
|
1161
|
+
if (it != row_norm_pipelines.end()) {
|
|
1162
|
+
return it->second;
|
|
1163
|
+
}
|
|
1164
|
+
std::vector<std::string> defines;
|
|
1165
|
+
std::string variant;
|
|
1166
|
+
|
|
1167
|
+
switch (key.op) {
|
|
1168
|
+
case GGML_OP_RMS_NORM:
|
|
1169
|
+
defines.push_back("RMS_NORM");
|
|
1170
|
+
variant = "rms_norm";
|
|
1171
|
+
break;
|
|
1172
|
+
case GGML_OP_NORM:
|
|
1173
|
+
defines.push_back("NORM");
|
|
1174
|
+
variant = "norm";
|
|
1175
|
+
break;
|
|
1176
|
+
case GGML_OP_L2_NORM:
|
|
1177
|
+
defines.push_back("L2_NORM");
|
|
1178
|
+
variant = "l2_norm";
|
|
1179
|
+
break;
|
|
1180
|
+
default:
|
|
1181
|
+
GGML_ABORT("Unsupported op for row_norm shader");
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
if (key.inplace) {
|
|
1185
|
+
defines.push_back("INPLACE");
|
|
1186
|
+
variant += "_inplace";
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
if (key.src_type == GGML_TYPE_F32) {
|
|
1190
|
+
defines.push_back("SRC_F32");
|
|
1191
|
+
variant += "_src_f32";
|
|
1192
|
+
} else if (key.src_type == GGML_TYPE_F16) {
|
|
1193
|
+
defines.push_back("SRC_F16");
|
|
1194
|
+
variant += "_src_f16";
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
if (key.dst_type == GGML_TYPE_F32) {
|
|
1198
|
+
defines.push_back("DST_F32");
|
|
1199
|
+
variant += "_dst_f32";
|
|
1200
|
+
} else if (key.dst_type == GGML_TYPE_F16) {
|
|
1201
|
+
defines.push_back("DST_F16");
|
|
1202
|
+
variant += "_dst_f16";
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
const uint32_t row_norm_wg_size = 128u;
|
|
1206
|
+
uint32_t wg_size = std::min(context.max_wg_size, row_norm_wg_size);
|
|
1207
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
1208
|
+
auto processed = preprocessor.preprocess(wgsl_row_norm, defines);
|
|
1209
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1210
|
+
decisions->wg_size = wg_size;
|
|
1211
|
+
decisions->inplace = key.inplace;
|
|
1212
|
+
row_norm_pipelines[key] = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1213
|
+
row_norm_pipelines[key].context = decisions;
|
|
1214
|
+
return row_norm_pipelines[key];
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
webgpu_pipeline get_argmax_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1218
|
+
bool vec4 = context.src0->ne[0] % 4 == 0;
|
|
1219
|
+
|
|
1220
|
+
auto it = argmax_pipelines.find(vec4);
|
|
1221
|
+
if (it != argmax_pipelines.end()) {
|
|
1222
|
+
return it->second;
|
|
1223
|
+
}
|
|
1224
|
+
std::string variant = "argmax";
|
|
1225
|
+
std::vector<std::string> defines;
|
|
1226
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1227
|
+
if (vec4) {
|
|
1228
|
+
defines.push_back("VEC4");
|
|
1229
|
+
variant += "_vec4";
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
auto processed = preprocessor.preprocess(wgsl_argmax, defines);
|
|
1233
|
+
argmax_pipelines[vec4] = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1234
|
+
return argmax_pipelines.at(vec4);
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
webgpu_pipeline get_set_rows_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1238
|
+
ggml_webgpu_set_rows_pipeline_key key = {};
|
|
1239
|
+
key.dst_type = context.dst->type;
|
|
1240
|
+
key.vec4 = context.src0->ne[0] % 4 == 0;
|
|
1241
|
+
key.i64_idx = context.src1->type == GGML_TYPE_I64;
|
|
1242
|
+
|
|
1243
|
+
auto it = set_rows_pipelines.find(key);
|
|
1244
|
+
if (it != set_rows_pipelines.end()) {
|
|
1245
|
+
return it->second;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
std::vector<std::string> defines;
|
|
1249
|
+
std::string variant = "set_rows";
|
|
1250
|
+
|
|
1251
|
+
switch (context.dst->type) {
|
|
1252
|
+
case GGML_TYPE_F32:
|
|
1253
|
+
defines.push_back("DST_F32");
|
|
1254
|
+
variant += "_dstf32";
|
|
1255
|
+
break;
|
|
1256
|
+
case GGML_TYPE_F16:
|
|
1257
|
+
defines.push_back("DST_F16");
|
|
1258
|
+
variant += "_dstf16";
|
|
1259
|
+
break;
|
|
1260
|
+
default:
|
|
1261
|
+
GGML_ABORT("Unsupported dst type for set_rows shader");
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
if (key.vec4) {
|
|
1265
|
+
defines.push_back("VEC4");
|
|
1266
|
+
variant += "_vec4";
|
|
1267
|
+
}
|
|
1268
|
+
if (key.i64_idx) {
|
|
1269
|
+
defines.push_back("I64_IDX");
|
|
1270
|
+
variant += "_i64idx";
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1274
|
+
|
|
1275
|
+
auto processed = preprocessor.preprocess(wgsl_set_rows, defines);
|
|
1276
|
+
auto decisions = std::make_shared<ggml_webgpu_set_rows_shader_decisions>();
|
|
1277
|
+
decisions->vec4 = key.vec4;
|
|
1278
|
+
decisions->i64_idx = key.i64_idx;
|
|
1279
|
+
decisions->wg_size = context.max_wg_size;
|
|
1280
|
+
set_rows_pipelines[key] = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1281
|
+
set_rows_pipelines[key].context = decisions;
|
|
1282
|
+
return set_rows_pipelines[key];
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
webgpu_pipeline get_set_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1286
|
+
ggml_webgpu_set_pipeline_key key = {};
|
|
1287
|
+
key.type = context.dst->type;
|
|
1288
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
1289
|
+
|
|
1290
|
+
auto it = set_pipelines.find(key);
|
|
1291
|
+
if (it != set_pipelines.end()) {
|
|
1292
|
+
return it->second;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
std::vector<std::string> defines;
|
|
1296
|
+
std::string variant = "set";
|
|
1297
|
+
|
|
1298
|
+
switch (key.type) {
|
|
1299
|
+
case GGML_TYPE_F32:
|
|
1300
|
+
defines.push_back("TYPE_F32");
|
|
1301
|
+
variant += "_f32";
|
|
1302
|
+
break;
|
|
1303
|
+
case GGML_TYPE_I32:
|
|
1304
|
+
defines.push_back("TYPE_I32");
|
|
1305
|
+
variant += "_i32";
|
|
1306
|
+
break;
|
|
1307
|
+
default:
|
|
1308
|
+
GGML_ABORT("Unsupported type for set shader");
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
if (key.inplace) {
|
|
1312
|
+
defines.push_back("INPLACE");
|
|
1313
|
+
variant += "_inplace";
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1317
|
+
|
|
1318
|
+
auto processed = preprocessor.preprocess(wgsl_set, defines);
|
|
1319
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1320
|
+
decisions->wg_size = context.max_wg_size;
|
|
1321
|
+
decisions->inplace = key.inplace;
|
|
1322
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1323
|
+
pipeline.context = decisions;
|
|
1324
|
+
set_pipelines[key] = pipeline;
|
|
1325
|
+
return set_pipelines[key];
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
webgpu_pipeline get_cumsum_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1329
|
+
auto it = cumsum_pipelines.find(1);
|
|
1330
|
+
if (it != cumsum_pipelines.end()) {
|
|
1331
|
+
return it->second;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
std::vector<std::string> defines;
|
|
1335
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1336
|
+
|
|
1337
|
+
auto processed = preprocessor.preprocess(wgsl_cumsum, defines);
|
|
1338
|
+
cumsum_pipelines[1] = ggml_webgpu_create_pipeline(device, processed, "cumsum");
|
|
1339
|
+
return cumsum_pipelines[1];
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
webgpu_pipeline get_argsort_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1343
|
+
bool is_top_k = context.dst->op == GGML_OP_TOP_K;
|
|
1344
|
+
// ascending order is 0, descending order is 1
|
|
1345
|
+
const int32_t order =
|
|
1346
|
+
is_top_k ? (int32_t) GGML_SORT_ORDER_DESC : (int32_t) ggml_get_op_params_i32(context.dst, 0);
|
|
1347
|
+
|
|
1348
|
+
auto it = argsort_pipelines.find(order);
|
|
1349
|
+
if (it != argsort_pipelines.end()) {
|
|
1350
|
+
return it->second;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
std::vector<std::string> defines;
|
|
1354
|
+
std::string variant = "argsort";
|
|
1355
|
+
defines.push_back(std::string("ORDER=") + std::to_string(order));
|
|
1356
|
+
variant += std::string("_order") + std::to_string(order);
|
|
1357
|
+
uint32_t wg_size = 1;
|
|
1358
|
+
while (wg_size * 2 <= context.max_wg_size &&
|
|
1359
|
+
wg_size * GGML_WEBGPU_I32_SIZE_BYTES <= context.wg_mem_limit_bytes / 2) {
|
|
1360
|
+
wg_size *= 2;
|
|
1361
|
+
}
|
|
1362
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
1363
|
+
auto processed = preprocessor.preprocess(wgsl_argsort, defines);
|
|
1364
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1365
|
+
decisions->wg_size = wg_size;
|
|
1366
|
+
argsort_pipelines[order] = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1367
|
+
argsort_pipelines[order].context = decisions;
|
|
1368
|
+
return argsort_pipelines[order];
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
webgpu_pipeline get_argsort_merge_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1372
|
+
bool is_top_k = context.dst->op == GGML_OP_TOP_K;
|
|
1373
|
+
// ascending order is 0, descending order is 1
|
|
1374
|
+
const int32_t order =
|
|
1375
|
+
is_top_k ? (int32_t) GGML_SORT_ORDER_DESC : (int32_t) ggml_get_op_params_i32(context.dst, 0);
|
|
1376
|
+
|
|
1377
|
+
auto it = argsort_merge_pipelines.find(order);
|
|
1378
|
+
if (it != argsort_merge_pipelines.end()) {
|
|
1379
|
+
return it->second;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
std::vector<std::string> defines;
|
|
1383
|
+
std::string variant = "argsort_merge";
|
|
1384
|
+
defines.push_back(std::string("ORDER=") + std::to_string(order));
|
|
1385
|
+
variant += std::string("_order") + std::to_string(order);
|
|
1386
|
+
uint32_t wg_size = std::min(GGML_WEBGPU_ARGSORT_MERGE_MAX_WG_SIZE, context.max_wg_size);
|
|
1387
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
1388
|
+
|
|
1389
|
+
auto processed = preprocessor.preprocess(wgsl_argsort_merge, defines);
|
|
1390
|
+
argsort_merge_pipelines[order] = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1391
|
+
return argsort_merge_pipelines[order];
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
webgpu_pipeline get_get_rows_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1395
|
+
const bool vectorized = context.src0->type == GGML_TYPE_F32 && context.dst->ne[0] % 4 == 0;
|
|
1396
|
+
ggml_webgpu_get_rows_pipeline_key key = {};
|
|
1397
|
+
key.src_type = context.src0->type;
|
|
1398
|
+
key.vectorized = (int) vectorized;
|
|
1399
|
+
|
|
1400
|
+
auto it = get_rows_pipelines.find(key);
|
|
1401
|
+
if (it != get_rows_pipelines.end()) {
|
|
1402
|
+
return it->second;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
std::vector<std::string> defines;
|
|
1406
|
+
std::string variant = "get_rows";
|
|
1407
|
+
|
|
1408
|
+
const struct ggml_type_traits * type_traits = ggml_get_type_traits(key.src_type);
|
|
1409
|
+
const char * type_str = type_traits->type_name;
|
|
1410
|
+
|
|
1411
|
+
switch (key.src_type) {
|
|
1412
|
+
case GGML_TYPE_F32:
|
|
1413
|
+
defines.push_back("FLOAT_PARALLEL");
|
|
1414
|
+
if (key.vectorized) {
|
|
1415
|
+
defines.push_back("F32_VEC");
|
|
1416
|
+
defines.push_back("SRC_TYPE=vec4<f32>");
|
|
1417
|
+
defines.push_back("DST_TYPE=vec4<f32>");
|
|
1418
|
+
defines.push_back("BLOCK_SIZE=4u");
|
|
1419
|
+
} else {
|
|
1420
|
+
defines.push_back("F32");
|
|
1421
|
+
defines.push_back("SRC_TYPE=f32");
|
|
1422
|
+
defines.push_back("DST_TYPE=f32");
|
|
1423
|
+
defines.push_back("BLOCK_SIZE=1u");
|
|
1424
|
+
}
|
|
1425
|
+
variant += "_f32";
|
|
1426
|
+
break;
|
|
1427
|
+
case GGML_TYPE_F16:
|
|
1428
|
+
defines.push_back("FLOAT_PARALLEL");
|
|
1429
|
+
defines.push_back("F16");
|
|
1430
|
+
defines.push_back("SRC_TYPE=f16");
|
|
1431
|
+
defines.push_back("DST_TYPE=f32");
|
|
1432
|
+
defines.push_back("BLOCK_SIZE=1u");
|
|
1433
|
+
variant += "_f16";
|
|
1434
|
+
break;
|
|
1435
|
+
case GGML_TYPE_I32:
|
|
1436
|
+
defines.push_back("FLOAT_PARALLEL");
|
|
1437
|
+
defines.push_back("I32");
|
|
1438
|
+
defines.push_back("SRC_TYPE=i32");
|
|
1439
|
+
defines.push_back("DST_TYPE=i32");
|
|
1440
|
+
defines.push_back("BLOCK_SIZE=1u");
|
|
1441
|
+
variant += "_i32";
|
|
1442
|
+
break;
|
|
1443
|
+
default:
|
|
1444
|
+
{
|
|
1445
|
+
std::string type_upper = type_str;
|
|
1446
|
+
std::transform(type_upper.begin(), type_upper.end(), type_upper.begin(), ::toupper);
|
|
1447
|
+
|
|
1448
|
+
switch (key.src_type) {
|
|
1449
|
+
case GGML_TYPE_Q1_0:
|
|
1450
|
+
case GGML_TYPE_Q4_0:
|
|
1451
|
+
case GGML_TYPE_Q5_0:
|
|
1452
|
+
case GGML_TYPE_Q8_0:
|
|
1453
|
+
case GGML_TYPE_Q3_K:
|
|
1454
|
+
case GGML_TYPE_Q6_K:
|
|
1455
|
+
case GGML_TYPE_IQ2_XXS:
|
|
1456
|
+
case GGML_TYPE_IQ2_XS:
|
|
1457
|
+
case GGML_TYPE_IQ2_S:
|
|
1458
|
+
case GGML_TYPE_IQ3_XXS:
|
|
1459
|
+
case GGML_TYPE_IQ3_S:
|
|
1460
|
+
case GGML_TYPE_IQ1_S:
|
|
1461
|
+
case GGML_TYPE_IQ4_NL:
|
|
1462
|
+
case GGML_TYPE_MXFP4:
|
|
1463
|
+
{
|
|
1464
|
+
// Quantized types using u32 buffers for portability.
|
|
1465
|
+
defines.push_back("SRC_TYPE=u32");
|
|
1466
|
+
defines.push_back("U32_DEQUANT_HELPERS");
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
default:
|
|
1470
|
+
{
|
|
1471
|
+
defines.push_back(std::string("SRC_TYPE=") + type_str);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
defines.push_back("BYTE_HELPERS");
|
|
1476
|
+
defines.push_back(type_upper + "_T");
|
|
1477
|
+
defines.push_back(type_upper);
|
|
1478
|
+
defines.push_back(type_upper + "_SCALE_MIN");
|
|
1479
|
+
defines.push_back(type_upper + "_TABLES");
|
|
1480
|
+
defines.push_back(type_upper + "_GRID");
|
|
1481
|
+
defines.push_back(type_upper + "_LUT");
|
|
1482
|
+
|
|
1483
|
+
variant += "_";
|
|
1484
|
+
variant += type_str;
|
|
1485
|
+
|
|
1486
|
+
defines.push_back("DST_TYPE=f32");
|
|
1487
|
+
|
|
1488
|
+
if (key.src_type == GGML_TYPE_Q1_0) {
|
|
1489
|
+
defines.push_back("BLOCK_SIZE=128u");
|
|
1490
|
+
} else if ((key.src_type >= GGML_TYPE_Q4_0 && key.src_type <= GGML_TYPE_Q8_1) ||
|
|
1491
|
+
key.src_type == GGML_TYPE_IQ4_NL || key.src_type == GGML_TYPE_MXFP4) {
|
|
1492
|
+
defines.push_back("BLOCK_SIZE=32u");
|
|
1493
|
+
} else if (key.src_type >= GGML_TYPE_Q2_K) {
|
|
1494
|
+
defines.push_back("BLOCK_SIZE=256u");
|
|
1495
|
+
} else {
|
|
1496
|
+
defines.push_back("BLOCK_SIZE=1u");
|
|
1497
|
+
}
|
|
1498
|
+
break;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
if (key.vectorized) {
|
|
1503
|
+
variant += "_vec";
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
defines.push_back("WG_SIZE=" + std::to_string(context.max_wg_size));
|
|
1507
|
+
|
|
1508
|
+
auto processed = preprocessor.preprocess(wgsl_get_rows, defines);
|
|
1509
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1510
|
+
decisions->wg_size = context.max_wg_size;
|
|
1511
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1512
|
+
pipeline.context = decisions;
|
|
1513
|
+
get_rows_pipelines[key] = pipeline;
|
|
1514
|
+
return get_rows_pipelines[key];
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
webgpu_pipeline get_scale_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1518
|
+
ggml_webgpu_scale_pipeline_key key = {};
|
|
1519
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
1520
|
+
|
|
1521
|
+
auto it = scale_pipelines.find(key);
|
|
1522
|
+
if (it != scale_pipelines.end()) {
|
|
1523
|
+
return it->second;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
std::vector<std::string> defines;
|
|
1527
|
+
std::string variant = "scale";
|
|
1528
|
+
|
|
1529
|
+
if (key.inplace) {
|
|
1530
|
+
defines.push_back("INPLACE");
|
|
1531
|
+
variant += "_inplace";
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1535
|
+
|
|
1536
|
+
auto processed = preprocessor.preprocess(wgsl_scale, defines);
|
|
1537
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1538
|
+
decisions->wg_size = context.max_wg_size;
|
|
1539
|
+
decisions->inplace = key.inplace;
|
|
1540
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1541
|
+
pipeline.context = decisions;
|
|
1542
|
+
scale_pipelines[key] = pipeline;
|
|
1543
|
+
return scale_pipelines[key];
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
webgpu_pipeline get_solve_tri_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1547
|
+
ggml_webgpu_solve_tri_pipeline_key key = {};
|
|
1548
|
+
key.type = context.dst->type;
|
|
1549
|
+
key.n = (int) context.src0->ne[0];
|
|
1550
|
+
key.k = (int) context.src1->ne[0];
|
|
1551
|
+
|
|
1552
|
+
auto it = solve_tri_pipelines.find(key);
|
|
1553
|
+
if (it != solve_tri_pipelines.end()) {
|
|
1554
|
+
return it->second;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
std::vector<std::string> defines;
|
|
1558
|
+
std::string variant = "solve_tri";
|
|
1559
|
+
|
|
1560
|
+
switch (key.type) {
|
|
1561
|
+
case GGML_TYPE_F32:
|
|
1562
|
+
variant += "_f32";
|
|
1563
|
+
break;
|
|
1564
|
+
default:
|
|
1565
|
+
GGML_ABORT("Unsupported type for solve_tri shader");
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
const uint32_t wg_size = std::min((uint32_t) key.n, context.max_wg_size);
|
|
1569
|
+
const uint32_t k_tile = wg_size;
|
|
1570
|
+
const uint32_t bytes_per_row = ((uint32_t) key.n + wg_size) * GGML_WEBGPU_F32_SIZE_BYTES;
|
|
1571
|
+
const uint32_t batch_n = (uint32_t) (context.wg_mem_limit_bytes / bytes_per_row);
|
|
1572
|
+
|
|
1573
|
+
defines.push_back(std::string("N=") + std::to_string(key.n));
|
|
1574
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
1575
|
+
defines.push_back(std::string("K_TILE=") + std::to_string(k_tile));
|
|
1576
|
+
defines.push_back(std::string("BATCH_N=") + std::to_string(batch_n));
|
|
1577
|
+
|
|
1578
|
+
auto processed = preprocessor.preprocess(wgsl_solve_tri, defines);
|
|
1579
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1580
|
+
decisions->wg_size = wg_size;
|
|
1581
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1582
|
+
pipeline.context = decisions;
|
|
1583
|
+
solve_tri_pipelines[key] = pipeline;
|
|
1584
|
+
return solve_tri_pipelines[key];
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
webgpu_pipeline get_ssm_conv_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1588
|
+
ggml_webgpu_ssm_conv_pipeline_key key = {};
|
|
1589
|
+
key.type = context.dst->type;
|
|
1590
|
+
key.vectorized = context.src1->ne[0] == 4;
|
|
1591
|
+
|
|
1592
|
+
auto it = ssm_conv_pipelines.find(key);
|
|
1593
|
+
if (it != ssm_conv_pipelines.end()) {
|
|
1594
|
+
return it->second;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
std::vector<std::string> defines;
|
|
1598
|
+
std::string variant = "ssm_conv";
|
|
1599
|
+
|
|
1600
|
+
switch (key.type) {
|
|
1601
|
+
case GGML_TYPE_F32:
|
|
1602
|
+
variant += "_f32";
|
|
1603
|
+
break;
|
|
1604
|
+
default:
|
|
1605
|
+
GGML_ABORT("Unsupported type for ssm_conv shader");
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
if (key.vectorized) {
|
|
1609
|
+
defines.push_back("VECTORIZED");
|
|
1610
|
+
variant += "_vec4";
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
constexpr uint32_t block_size = 32u;
|
|
1614
|
+
constexpr uint32_t tokens_per_wg = 8u;
|
|
1615
|
+
|
|
1616
|
+
defines.push_back("BLOCK_SIZE=" + std::to_string(block_size) + "u");
|
|
1617
|
+
defines.push_back("TOKENS_PER_WG=" + std::to_string(tokens_per_wg) + "u");
|
|
1618
|
+
|
|
1619
|
+
auto processed = preprocessor.preprocess(wgsl_ssm_conv, defines);
|
|
1620
|
+
auto decisions = std::make_shared<ggml_webgpu_ssm_conv_shader_decisions>();
|
|
1621
|
+
decisions->block_size = block_size;
|
|
1622
|
+
decisions->tokens_per_wg = tokens_per_wg;
|
|
1623
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1624
|
+
pipeline.context = decisions;
|
|
1625
|
+
ssm_conv_pipelines[key] = pipeline;
|
|
1626
|
+
return ssm_conv_pipelines[key];
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
webgpu_pipeline get_ssm_scan_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1630
|
+
ggml_webgpu_ssm_scan_pipeline_key key = {};
|
|
1631
|
+
key.type = context.dst->type;
|
|
1632
|
+
key.d_state = (int) context.src0->ne[0];
|
|
1633
|
+
key.xbc_overlap = ggml_webgpu_tensor_overlap(context.src1, context.src4) &&
|
|
1634
|
+
ggml_webgpu_tensor_overlap(context.src1, context.src5);
|
|
1635
|
+
|
|
1636
|
+
auto it = ssm_scan_pipelines.find(key);
|
|
1637
|
+
if (it != ssm_scan_pipelines.end()) {
|
|
1638
|
+
return it->second;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
std::vector<std::string> defines;
|
|
1642
|
+
std::string variant = "ssm_scan";
|
|
1643
|
+
|
|
1644
|
+
switch (key.type) {
|
|
1645
|
+
case GGML_TYPE_F32:
|
|
1646
|
+
variant += "_f32";
|
|
1647
|
+
break;
|
|
1648
|
+
default:
|
|
1649
|
+
GGML_ABORT("Unsupported type for ssm_scan shader");
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
const uint32_t wg_size = (uint32_t) key.d_state;
|
|
1653
|
+
|
|
1654
|
+
constexpr uint32_t tokens_per_tile = 4u;
|
|
1655
|
+
|
|
1656
|
+
defines.push_back("WG_SIZE=" + std::to_string(wg_size) + "u");
|
|
1657
|
+
defines.push_back("TOKENS_PER_TILE=" + std::to_string(tokens_per_tile) + "u");
|
|
1658
|
+
|
|
1659
|
+
if (context.supports_subgroups) {
|
|
1660
|
+
defines.push_back("USE_SUBGROUP_REDUCTION");
|
|
1661
|
+
variant += "_sg_reduce";
|
|
1662
|
+
} else {
|
|
1663
|
+
variant += "_wg_reduce";
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
if (key.xbc_overlap) {
|
|
1667
|
+
defines.push_back("XBC_OVERLAP");
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
variant += "_d" + std::to_string(key.d_state);
|
|
1671
|
+
|
|
1672
|
+
auto processed = preprocessor.preprocess(wgsl_ssm_scan, defines);
|
|
1673
|
+
auto decisions = std::make_shared<ggml_webgpu_ssm_scan_shader_decisions>();
|
|
1674
|
+
decisions->wg_size = wg_size;
|
|
1675
|
+
decisions->tokens_per_tile = tokens_per_tile;
|
|
1676
|
+
decisions->xbc_overlap = key.xbc_overlap;
|
|
1677
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1678
|
+
pipeline.context = decisions;
|
|
1679
|
+
ssm_scan_pipelines[key] = pipeline;
|
|
1680
|
+
return ssm_scan_pipelines[key];
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
webgpu_pipeline get_gated_delta_net_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1684
|
+
ggml_webgpu_gated_delta_net_pipeline_key key = {};
|
|
1685
|
+
key.type = context.dst->type;
|
|
1686
|
+
key.s_v = (int) context.src2->ne[0];
|
|
1687
|
+
key.kda = context.src3->ne[0] == context.src2->ne[0];
|
|
1688
|
+
|
|
1689
|
+
auto it = gated_delta_net_pipelines.find(key);
|
|
1690
|
+
if (it != gated_delta_net_pipelines.end()) {
|
|
1691
|
+
return it->second;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
std::vector<std::string> defines;
|
|
1695
|
+
std::string variant = "gated_delta_net";
|
|
1696
|
+
|
|
1697
|
+
switch (key.type) {
|
|
1698
|
+
case GGML_TYPE_F32:
|
|
1699
|
+
variant += "_f32";
|
|
1700
|
+
break;
|
|
1701
|
+
default:
|
|
1702
|
+
GGML_ABORT("Unsupported type for gated_delta_net shader");
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
if (key.kda) {
|
|
1706
|
+
defines.push_back("KDA");
|
|
1707
|
+
variant += "_kda";
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
defines.push_back("S_V=" + std::to_string(key.s_v) + "u");
|
|
1711
|
+
defines.push_back("WG_SIZE=" + std::to_string(key.s_v) + "u");
|
|
1712
|
+
|
|
1713
|
+
auto processed = preprocessor.preprocess(wgsl_gated_delta_net, defines);
|
|
1714
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1715
|
+
gated_delta_net_pipelines[key] = pipeline;
|
|
1716
|
+
return gated_delta_net_pipelines[key];
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
webgpu_pipeline get_pad_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1720
|
+
ggml_webgpu_pad_pipeline_key key = {};
|
|
1721
|
+
key.circular = ggml_get_op_params_i32(context.dst, 8) != 0;
|
|
1722
|
+
|
|
1723
|
+
auto it = pad_pipelines.find(key);
|
|
1724
|
+
if (it != pad_pipelines.end()) {
|
|
1725
|
+
return it->second;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
std::vector<std::string> defines;
|
|
1729
|
+
std::string variant = "pad";
|
|
1730
|
+
|
|
1731
|
+
if (key.circular) {
|
|
1732
|
+
defines.push_back("CIRCULAR");
|
|
1733
|
+
variant += "_circular";
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
1737
|
+
|
|
1738
|
+
auto processed = preprocessor.preprocess(wgsl_pad, defines);
|
|
1739
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
1740
|
+
decisions->wg_size = context.max_wg_size;
|
|
1741
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1742
|
+
pipeline.context = decisions;
|
|
1743
|
+
pad_pipelines[key] = pipeline;
|
|
1744
|
+
return pad_pipelines[key];
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
webgpu_pipeline get_mul_mat_vec_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1748
|
+
ggml_webgpu_mul_mat_vec_pipeline_key key = {};
|
|
1749
|
+
key.src0_type = context.src0->type;
|
|
1750
|
+
key.src1_type = context.src1->type;
|
|
1751
|
+
key.vectorized = (context.src0->ne[0] % 4 == 0 &&
|
|
1752
|
+
(context.src0->type == GGML_TYPE_F32 || context.src0->type == GGML_TYPE_F16)) ?
|
|
1753
|
+
1 :
|
|
1754
|
+
0;
|
|
1755
|
+
|
|
1756
|
+
auto it = mul_mat_vec_pipelines.find(key);
|
|
1757
|
+
if (it != mul_mat_vec_pipelines.end()) {
|
|
1758
|
+
return it->second;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
std::vector<std::string> defines;
|
|
1762
|
+
std::string variant = "mul_mat_vec";
|
|
1763
|
+
const char * shader_src = wgsl_mul_mat_vec;
|
|
1764
|
+
|
|
1765
|
+
// src0 type (matrix row)
|
|
1766
|
+
switch (context.src0->type) {
|
|
1767
|
+
case GGML_TYPE_F32:
|
|
1768
|
+
defines.push_back("SRC0_INNER_TYPE=f32");
|
|
1769
|
+
defines.push_back("MUL_ACC_FLOAT");
|
|
1770
|
+
variant += "_f32";
|
|
1771
|
+
break;
|
|
1772
|
+
case GGML_TYPE_F16:
|
|
1773
|
+
defines.push_back("SRC0_INNER_TYPE=f16");
|
|
1774
|
+
defines.push_back("MUL_ACC_FLOAT");
|
|
1775
|
+
variant += "_f16";
|
|
1776
|
+
break;
|
|
1777
|
+
default:
|
|
1778
|
+
{
|
|
1779
|
+
// Quantized types: use helpers but accumulate in f16
|
|
1780
|
+
const struct ggml_type_traits * src0_traits = ggml_get_type_traits(context.src0->type);
|
|
1781
|
+
std::string src0_name = src0_traits->type_name;
|
|
1782
|
+
std::string type_upper = src0_name;
|
|
1783
|
+
variant += "_" + src0_name;
|
|
1784
|
+
std::transform(type_upper.begin(), type_upper.end(), type_upper.begin(), ::toupper);
|
|
1785
|
+
|
|
1786
|
+
defines.push_back("BYTE_HELPERS");
|
|
1787
|
+
defines.push_back("MUL_ACC_" + type_upper);
|
|
1788
|
+
defines.push_back("U32_DEQUANT_HELPERS");
|
|
1789
|
+
defines.push_back("SRC0_INNER_TYPE=u32");
|
|
1790
|
+
switch (context.src0->type) {
|
|
1791
|
+
case GGML_TYPE_IQ1_S:
|
|
1792
|
+
case GGML_TYPE_IQ1_M:
|
|
1793
|
+
case GGML_TYPE_IQ2_S:
|
|
1794
|
+
case GGML_TYPE_IQ3_S:
|
|
1795
|
+
case GGML_TYPE_IQ4_NL:
|
|
1796
|
+
case GGML_TYPE_IQ4_XS:
|
|
1797
|
+
defines.push_back(type_upper + "_GRID");
|
|
1798
|
+
break;
|
|
1799
|
+
case GGML_TYPE_IQ2_XXS:
|
|
1800
|
+
case GGML_TYPE_IQ2_XS:
|
|
1801
|
+
case GGML_TYPE_IQ3_XXS:
|
|
1802
|
+
defines.push_back(type_upper + "_GRID");
|
|
1803
|
+
defines.push_back(type_upper + "_TABLES");
|
|
1804
|
+
break;
|
|
1805
|
+
case GGML_TYPE_MXFP4:
|
|
1806
|
+
defines.push_back(type_upper + "_LUT");
|
|
1807
|
+
break;
|
|
1808
|
+
default:
|
|
1809
|
+
break;
|
|
1810
|
+
}
|
|
1811
|
+
break;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
// src1 type (vector)
|
|
1816
|
+
switch (context.src1->type) {
|
|
1817
|
+
case GGML_TYPE_F32:
|
|
1818
|
+
defines.push_back("SRC1_INNER_TYPE=f32");
|
|
1819
|
+
variant += "_f32";
|
|
1820
|
+
break;
|
|
1821
|
+
case GGML_TYPE_F16:
|
|
1822
|
+
defines.push_back("SRC1_INNER_TYPE=f16");
|
|
1823
|
+
variant += "_f16";
|
|
1824
|
+
break;
|
|
1825
|
+
default:
|
|
1826
|
+
GGML_ABORT("Unsupported src1 type for mul_mat_vec shader");
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
// VEC/SCALAR controls
|
|
1830
|
+
defines.push_back(key.vectorized ? "VEC" : "SCALAR");
|
|
1831
|
+
|
|
1832
|
+
uint32_t wg_size = WEBGPU_MUL_MAT_VEC_WG_SIZE;
|
|
1833
|
+
uint32_t outputs_per_wg = WEBGPU_MUL_MAT_VEC_FLOAT_OUTPUTS_PER_WG;
|
|
1834
|
+
|
|
1835
|
+
if (key.src0_type == GGML_TYPE_Q1_0) {
|
|
1836
|
+
outputs_per_wg = WEBGPU_MUL_MAT_VEC_LEGACY_Q_OUTPUTS_PER_WG;
|
|
1837
|
+
} else if (key.src0_type >= GGML_TYPE_Q2_K) {
|
|
1838
|
+
outputs_per_wg = WEBGPU_MUL_MAT_VEC_K_Q_OUTPUTS_PER_WG;
|
|
1839
|
+
} else if (key.src0_type >= GGML_TYPE_Q4_0) {
|
|
1840
|
+
outputs_per_wg = WEBGPU_MUL_MAT_VEC_LEGACY_Q_OUTPUTS_PER_WG;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
1844
|
+
defines.push_back(std::string("OUTPUTS_PER_WG=") + std::to_string(outputs_per_wg));
|
|
1845
|
+
defines.push_back(context.supports_subgroups ? "USE_SUBGROUP_REDUCTION" : "USE_WORKGROUP_REDUCTION");
|
|
1846
|
+
variant += context.supports_subgroups ? "_sg_reduce" : "_wg_reduce";
|
|
1847
|
+
if (key.vectorized) {
|
|
1848
|
+
variant += "_vectorized";
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
auto processed = preprocessor.preprocess(shader_src, defines);
|
|
1852
|
+
auto decisions = std::make_shared<ggml_webgpu_mul_mat_vec_shader_decisions>();
|
|
1853
|
+
decisions->wg_size = wg_size;
|
|
1854
|
+
decisions->outputs_per_wg = outputs_per_wg;
|
|
1855
|
+
decisions->vec_size = key.vectorized ? 4 : 1;
|
|
1856
|
+
|
|
1857
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
1858
|
+
pipeline.context = decisions;
|
|
1859
|
+
mul_mat_vec_pipelines[key] = pipeline;
|
|
1860
|
+
return mul_mat_vec_pipelines[key];
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
webgpu_pipeline get_mul_mat_fast_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
1864
|
+
ggml_webgpu_mul_mat_pipeline_key key = {};
|
|
1865
|
+
key.src0_type = context.src0->type;
|
|
1866
|
+
key.src1_type = context.src1->type;
|
|
1867
|
+
key.vectorized = (context.src0->ne[0] % 4 == 0 && context.dst->ne[0] % 4 == 0 &&
|
|
1868
|
+
(context.src0->type == GGML_TYPE_F32 || context.src0->type == GGML_TYPE_F16)) ?
|
|
1869
|
+
1 :
|
|
1870
|
+
0;
|
|
1871
|
+
key.use_subgroup_matrix = context.supports_subgroup_matrix;
|
|
1872
|
+
|
|
1873
|
+
auto it = mul_mat_fast_pipelines.find(key);
|
|
1874
|
+
if (it != mul_mat_fast_pipelines.end()) {
|
|
1875
|
+
return it->second;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
const char * shader_src = key.use_subgroup_matrix ? wgsl_mul_mat_subgroup_matrix : wgsl_mul_mat_reg_tile;
|
|
1879
|
+
std::vector<std::string> defines;
|
|
1880
|
+
std::string variant = key.use_subgroup_matrix ? "mul_mat_subgroup_matrix" : "mul_mat_reg_tile";
|
|
1881
|
+
|
|
1882
|
+
// src1 type
|
|
1883
|
+
switch (context.src1->type) {
|
|
1884
|
+
case GGML_TYPE_F32:
|
|
1885
|
+
defines.push_back("SRC1_INNER_TYPE=f32");
|
|
1886
|
+
break;
|
|
1887
|
+
case GGML_TYPE_F16:
|
|
1888
|
+
defines.push_back("SRC1_INNER_TYPE=f16");
|
|
1889
|
+
break;
|
|
1890
|
+
default:
|
|
1891
|
+
GGML_ABORT("Unsupported src1 type for mul_mat fast shader");
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
// src0 type
|
|
1895
|
+
const struct ggml_type_traits * src0_traits = ggml_get_type_traits(context.src0->type);
|
|
1896
|
+
const char * src0_name = src0_traits->type_name;
|
|
1897
|
+
|
|
1898
|
+
switch (context.src0->type) {
|
|
1899
|
+
case GGML_TYPE_F32:
|
|
1900
|
+
defines.push_back("SRC0_INNER_TYPE=f32");
|
|
1901
|
+
defines.push_back("FLOAT");
|
|
1902
|
+
defines.push_back("MUL_ACC_FLOAT");
|
|
1903
|
+
defines.push_back("INIT_SRC0_SHMEM_FLOAT");
|
|
1904
|
+
defines.push_back("INIT_SRC1_SHMEM_FLOAT");
|
|
1905
|
+
variant += "_f32";
|
|
1906
|
+
break;
|
|
1907
|
+
case GGML_TYPE_F16:
|
|
1908
|
+
defines.push_back("SRC0_INNER_TYPE=f16");
|
|
1909
|
+
defines.push_back("FLOAT");
|
|
1910
|
+
defines.push_back("MUL_ACC_FLOAT");
|
|
1911
|
+
defines.push_back("INIT_SRC0_SHMEM_FLOAT");
|
|
1912
|
+
defines.push_back("INIT_SRC1_SHMEM_FLOAT");
|
|
1913
|
+
variant += "_f16";
|
|
1914
|
+
break;
|
|
1915
|
+
default:
|
|
1916
|
+
{
|
|
1917
|
+
std::string type_upper = src0_name;
|
|
1918
|
+
std::transform(type_upper.begin(), type_upper.end(), type_upper.begin(), ::toupper);
|
|
1919
|
+
|
|
1920
|
+
defines.push_back("BYTE_HELPERS");
|
|
1921
|
+
defines.push_back("MUL_ACC_" + type_upper);
|
|
1922
|
+
defines.push_back("INIT_SRC0_SHMEM_" + type_upper);
|
|
1923
|
+
defines.push_back("INIT_SRC1_SHMEM_FLOAT");
|
|
1924
|
+
defines.push_back("U32_DEQUANT_HELPERS");
|
|
1925
|
+
defines.push_back("SRC0_INNER_TYPE=u32");
|
|
1926
|
+
|
|
1927
|
+
switch (context.src0->type) {
|
|
1928
|
+
case GGML_TYPE_IQ1_S:
|
|
1929
|
+
case GGML_TYPE_IQ1_M:
|
|
1930
|
+
case GGML_TYPE_IQ4_NL:
|
|
1931
|
+
case GGML_TYPE_IQ4_XS:
|
|
1932
|
+
defines.push_back(type_upper + "_GRID");
|
|
1933
|
+
break;
|
|
1934
|
+
case GGML_TYPE_IQ2_XXS:
|
|
1935
|
+
case GGML_TYPE_IQ2_XS:
|
|
1936
|
+
case GGML_TYPE_IQ2_S:
|
|
1937
|
+
case GGML_TYPE_IQ3_XXS:
|
|
1938
|
+
case GGML_TYPE_IQ3_S:
|
|
1939
|
+
defines.push_back(type_upper + "_GRID");
|
|
1940
|
+
defines.push_back(type_upper + "_TABLES");
|
|
1941
|
+
break;
|
|
1942
|
+
case GGML_TYPE_MXFP4:
|
|
1943
|
+
defines.push_back(type_upper + "_LUT");
|
|
1944
|
+
break;
|
|
1945
|
+
default:
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
variant += std::string("_") + src0_name;
|
|
1950
|
+
break;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// VEC/SCALAR controls
|
|
1955
|
+
defines.push_back(key.vectorized ? "VEC" : "SCALAR");
|
|
1956
|
+
|
|
1957
|
+
const bool is_quant = ggml_is_quantized(context.src0->type);
|
|
1958
|
+
|
|
1959
|
+
uint32_t tile_k;
|
|
1960
|
+
if (key.use_subgroup_matrix) {
|
|
1961
|
+
tile_k = is_quant ? WEBGPU_MUL_MAT_SUBGROUP_TILE_K_QUANT : WEBGPU_MUL_MAT_SUBGROUP_TILE_K_FLOAT;
|
|
1962
|
+
} else {
|
|
1963
|
+
tile_k = is_quant ? WEBGPU_MUL_MAT_REG_TILE_K_QUANT : WEBGPU_MUL_MAT_REG_TILE_K_FLOAT;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
// Tiles
|
|
1967
|
+
defines.push_back("TILE_M=" + std::to_string(WEBGPU_MUL_MAT_TILE_M) + "u");
|
|
1968
|
+
defines.push_back("TILE_N=" + std::to_string(WEBGPU_MUL_MAT_TILE_N) + "u");
|
|
1969
|
+
|
|
1970
|
+
// Subgroup matrix specifics
|
|
1971
|
+
if (key.use_subgroup_matrix) {
|
|
1972
|
+
defines.push_back("TILE_K=" + std::to_string(tile_k) + "u");
|
|
1973
|
+
defines.push_back("MAX_SUBGROUP_SIZE=" + std::to_string(context.max_subgroup_size) + "u");
|
|
1974
|
+
defines.push_back("SUBGROUP_M=" + std::to_string(WEBGPU_MUL_MAT_SUBGROUP_M) + "u");
|
|
1975
|
+
defines.push_back("SUBGROUP_N=" + std::to_string(WEBGPU_MUL_MAT_SUBGROUP_N) + "u");
|
|
1976
|
+
defines.push_back("SUBGROUP_MATRIX_M=" + std::to_string(WEBGPU_MUL_MAT_SUBGROUP_MATRIX_M) + "u");
|
|
1977
|
+
defines.push_back("SUBGROUP_MATRIX_N=" + std::to_string(WEBGPU_MUL_MAT_SUBGROUP_MATRIX_N) + "u");
|
|
1978
|
+
defines.push_back("SUBGROUP_MATRIX_M_SIZE=" + std::to_string(context.sg_mat_m) + "u");
|
|
1979
|
+
defines.push_back("SUBGROUP_MATRIX_N_SIZE=" + std::to_string(context.sg_mat_n) + "u");
|
|
1980
|
+
defines.push_back("SUBGROUP_MATRIX_K_SIZE=" + std::to_string(context.sg_mat_k) + "u");
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
// variant suffix for src1 type
|
|
1984
|
+
variant += std::string("_") + (context.src1->type == GGML_TYPE_F32 ? "f32" : "f16");
|
|
1985
|
+
if (key.vectorized) {
|
|
1986
|
+
variant += "_vectorized";
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
if (!key.use_subgroup_matrix) {
|
|
1990
|
+
defines.push_back("WORKGROUP_SIZE_M=" + std::to_string(WEBGPU_MUL_MAT_WG_SIZE_M) + "u");
|
|
1991
|
+
defines.push_back("WORKGROUP_SIZE_N=" + std::to_string(WEBGPU_MUL_MAT_WG_SIZE_N) + "u");
|
|
1992
|
+
defines.push_back("TILE_K=" + std::to_string(tile_k) + "u");
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
auto processed = preprocessor.preprocess(shader_src, defines);
|
|
1996
|
+
|
|
1997
|
+
auto decisions = std::make_shared<ggml_webgpu_mul_mat_shader_decisions>();
|
|
1998
|
+
decisions->tile_k = tile_k;
|
|
1999
|
+
decisions->tile_m = WEBGPU_MUL_MAT_TILE_M;
|
|
2000
|
+
decisions->tile_n = WEBGPU_MUL_MAT_TILE_N;
|
|
2001
|
+
decisions->use_subgroup_matrix = key.use_subgroup_matrix;
|
|
2002
|
+
if (key.use_subgroup_matrix) {
|
|
2003
|
+
decisions->subgroup_m = WEBGPU_MUL_MAT_SUBGROUP_M;
|
|
2004
|
+
decisions->subgroup_n = WEBGPU_MUL_MAT_SUBGROUP_N;
|
|
2005
|
+
decisions->subgroup_matrix_m = WEBGPU_MUL_MAT_SUBGROUP_MATRIX_M;
|
|
2006
|
+
decisions->subgroup_matrix_n = WEBGPU_MUL_MAT_SUBGROUP_MATRIX_N;
|
|
2007
|
+
decisions->wg_size = context.max_subgroup_size;
|
|
2008
|
+
} else {
|
|
2009
|
+
decisions->wg_size_m = WEBGPU_MUL_MAT_WG_SIZE_M;
|
|
2010
|
+
decisions->wg_size_n = WEBGPU_MUL_MAT_WG_SIZE_N;
|
|
2011
|
+
decisions->wg_size = WEBGPU_MUL_MAT_WG_SIZE_M * WEBGPU_MUL_MAT_WG_SIZE_N;
|
|
2012
|
+
decisions->mul_mat_wg_size = WEBGPU_MUL_MAT_WG_SIZE;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2016
|
+
pipeline.context = decisions;
|
|
2017
|
+
mul_mat_fast_pipelines[key] = pipeline;
|
|
2018
|
+
return mul_mat_fast_pipelines[key];
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
webgpu_pipeline get_mul_mat_legacy_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2022
|
+
ggml_webgpu_legacy_mul_mat_pipeline_key key = {};
|
|
2023
|
+
key.src0_type = context.src0->type;
|
|
2024
|
+
key.src1_type = context.src1->type;
|
|
2025
|
+
|
|
2026
|
+
auto it = mul_mat_legacy_pipelines.find(key);
|
|
2027
|
+
if (it != mul_mat_legacy_pipelines.end()) {
|
|
2028
|
+
return it->second;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
std::vector<std::string> defines;
|
|
2032
|
+
std::string variant = "mul_mat";
|
|
2033
|
+
|
|
2034
|
+
switch (context.src1->type) {
|
|
2035
|
+
case GGML_TYPE_F32:
|
|
2036
|
+
defines.push_back("SRC1_TYPE=f32");
|
|
2037
|
+
variant += "_f32";
|
|
2038
|
+
break;
|
|
2039
|
+
case GGML_TYPE_F16:
|
|
2040
|
+
defines.push_back("SRC1_TYPE=f16");
|
|
2041
|
+
variant += "_f16";
|
|
2042
|
+
break;
|
|
2043
|
+
default:
|
|
2044
|
+
GGML_ABORT("Unsupported src1 type for mul_mat legacy shader");
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
const struct ggml_type_traits * src0_traits = ggml_get_type_traits(context.src0->type);
|
|
2048
|
+
const char * src0_name = src0_traits->type_name;
|
|
2049
|
+
|
|
2050
|
+
switch (context.src0->type) {
|
|
2051
|
+
case GGML_TYPE_F32:
|
|
2052
|
+
defines.push_back("SRC0_TYPE=f32");
|
|
2053
|
+
defines.push_back("FLOAT");
|
|
2054
|
+
variant += "_f32";
|
|
2055
|
+
break;
|
|
2056
|
+
case GGML_TYPE_F16:
|
|
2057
|
+
defines.push_back("SRC0_TYPE=f16");
|
|
2058
|
+
defines.push_back("FLOAT");
|
|
2059
|
+
variant += "_f16";
|
|
2060
|
+
break;
|
|
2061
|
+
default:
|
|
2062
|
+
{
|
|
2063
|
+
std::string type_upper = src0_name;
|
|
2064
|
+
std::transform(type_upper.begin(), type_upper.end(), type_upper.begin(), ::toupper);
|
|
2065
|
+
|
|
2066
|
+
switch (context.src0->type) {
|
|
2067
|
+
case GGML_TYPE_Q4_0:
|
|
2068
|
+
case GGML_TYPE_Q5_0:
|
|
2069
|
+
case GGML_TYPE_Q8_0:
|
|
2070
|
+
case GGML_TYPE_Q3_K:
|
|
2071
|
+
case GGML_TYPE_Q6_K:
|
|
2072
|
+
case GGML_TYPE_IQ2_XXS:
|
|
2073
|
+
case GGML_TYPE_IQ2_XS:
|
|
2074
|
+
case GGML_TYPE_IQ2_S:
|
|
2075
|
+
case GGML_TYPE_IQ3_XXS:
|
|
2076
|
+
case GGML_TYPE_IQ3_S:
|
|
2077
|
+
case GGML_TYPE_IQ1_S:
|
|
2078
|
+
case GGML_TYPE_IQ4_NL:
|
|
2079
|
+
case GGML_TYPE_MXFP4:
|
|
2080
|
+
{
|
|
2081
|
+
// Quantized types using u32 buffers for portability.
|
|
2082
|
+
defines.push_back("SRC0_TYPE=u32");
|
|
2083
|
+
defines.push_back("U32_DEQUANT_HELPERS");
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
2086
|
+
default:
|
|
2087
|
+
{
|
|
2088
|
+
defines.push_back(std::string("SRC0_TYPE=") + src0_name);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
defines.push_back("BYTE_HELPERS");
|
|
2093
|
+
defines.push_back(type_upper + "_T");
|
|
2094
|
+
defines.push_back(type_upper);
|
|
2095
|
+
defines.push_back(type_upper + "_SCALE_MIN");
|
|
2096
|
+
defines.push_back(type_upper + "_TABLES");
|
|
2097
|
+
defines.push_back(type_upper + "_GRID");
|
|
2098
|
+
|
|
2099
|
+
variant += std::string("_") + src0_name;
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
auto processed = preprocessor.preprocess(wgsl_mul_mat, defines);
|
|
2105
|
+
|
|
2106
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2107
|
+
decisions->wg_size = WEBGPU_MUL_MAT_WG_SIZE;
|
|
2108
|
+
|
|
2109
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2110
|
+
pipeline.context = decisions;
|
|
2111
|
+
mul_mat_legacy_pipelines[key] = pipeline;
|
|
2112
|
+
return mul_mat_legacy_pipelines[key];
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
webgpu_pipeline get_mul_mat_id_gather_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2116
|
+
auto it = mul_mat_id_gather_pipelines.find(1);
|
|
2117
|
+
if (it != mul_mat_id_gather_pipelines.end()) {
|
|
2118
|
+
return it->second;
|
|
2119
|
+
}
|
|
2120
|
+
std::vector<std::string> defines;
|
|
2121
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2122
|
+
|
|
2123
|
+
auto processed = preprocessor.preprocess(wgsl_mul_mat_id_gather, defines);
|
|
2124
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2125
|
+
decisions->wg_size = context.max_wg_size;
|
|
2126
|
+
|
|
2127
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, "mul_mat_id_gather");
|
|
2128
|
+
pipeline.context = decisions;
|
|
2129
|
+
mul_mat_id_gather_pipelines[1] = pipeline;
|
|
2130
|
+
return pipeline;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
webgpu_pipeline get_mul_mat_id_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2134
|
+
ggml_webgpu_mul_mat_id_pipeline_key key = {};
|
|
2135
|
+
key.src0_type = context.src0->type;
|
|
2136
|
+
key.src1_type = context.src1->type;
|
|
2137
|
+
key.n_experts = context.src0->ne[2];
|
|
2138
|
+
key.vectorized = (context.src0->ne[0] % 4 == 0 && context.src0->ne[1] % 4 == 0 &&
|
|
2139
|
+
(context.src0->type == GGML_TYPE_F32 || context.src0->type == GGML_TYPE_F16)) ?
|
|
2140
|
+
1 :
|
|
2141
|
+
0;
|
|
2142
|
+
|
|
2143
|
+
auto it = mul_mat_id_pipelines.find(key);
|
|
2144
|
+
if (it != mul_mat_id_pipelines.end()) {
|
|
2145
|
+
return it->second;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
std::vector<std::string> defines;
|
|
2149
|
+
std::string variant = "mul_mat_id";
|
|
2150
|
+
defines.push_back("MUL_MAT_ID");
|
|
2151
|
+
|
|
2152
|
+
// src1 type
|
|
2153
|
+
switch (context.src1->type) {
|
|
2154
|
+
case GGML_TYPE_F32:
|
|
2155
|
+
defines.push_back("SRC1_INNER_TYPE=f32");
|
|
2156
|
+
break;
|
|
2157
|
+
case GGML_TYPE_F16:
|
|
2158
|
+
defines.push_back("SRC1_INNER_TYPE=f16");
|
|
2159
|
+
break;
|
|
2160
|
+
default:
|
|
2161
|
+
GGML_ABORT("Unsupported src1 type for mul_mat fast shader");
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
// src0 type
|
|
2165
|
+
const struct ggml_type_traits * src0_traits = ggml_get_type_traits(context.src0->type);
|
|
2166
|
+
const char * src0_name = src0_traits->type_name;
|
|
2167
|
+
|
|
2168
|
+
switch (context.src0->type) {
|
|
2169
|
+
case GGML_TYPE_F32:
|
|
2170
|
+
defines.push_back("SRC0_INNER_TYPE=f32");
|
|
2171
|
+
defines.push_back("INIT_SRC0_SHMEM_FLOAT");
|
|
2172
|
+
defines.push_back("INIT_SRC1_SHMEM_FLOAT");
|
|
2173
|
+
variant += "_f32";
|
|
2174
|
+
break;
|
|
2175
|
+
case GGML_TYPE_F16:
|
|
2176
|
+
defines.push_back("SRC0_INNER_TYPE=f16");
|
|
2177
|
+
defines.push_back("INIT_SRC0_SHMEM_FLOAT");
|
|
2178
|
+
defines.push_back("INIT_SRC1_SHMEM_FLOAT");
|
|
2179
|
+
variant += "_f16";
|
|
2180
|
+
break;
|
|
2181
|
+
default:
|
|
2182
|
+
{
|
|
2183
|
+
std::string type_upper = src0_name;
|
|
2184
|
+
std::transform(type_upper.begin(), type_upper.end(), type_upper.begin(), ::toupper);
|
|
2185
|
+
|
|
2186
|
+
defines.push_back("BYTE_HELPERS");
|
|
2187
|
+
defines.push_back("INIT_SRC0_SHMEM_" + type_upper);
|
|
2188
|
+
defines.push_back("INIT_SRC1_SHMEM_FLOAT");
|
|
2189
|
+
defines.push_back("U32_DEQUANT_HELPERS");
|
|
2190
|
+
defines.push_back("SRC0_INNER_TYPE=u32");
|
|
2191
|
+
|
|
2192
|
+
switch (context.src0->type) {
|
|
2193
|
+
case GGML_TYPE_IQ1_S:
|
|
2194
|
+
case GGML_TYPE_IQ1_M:
|
|
2195
|
+
case GGML_TYPE_IQ4_NL:
|
|
2196
|
+
case GGML_TYPE_IQ4_XS:
|
|
2197
|
+
defines.push_back(type_upper + "_GRID");
|
|
2198
|
+
break;
|
|
2199
|
+
case GGML_TYPE_IQ2_XXS:
|
|
2200
|
+
case GGML_TYPE_IQ2_XS:
|
|
2201
|
+
case GGML_TYPE_IQ2_S:
|
|
2202
|
+
case GGML_TYPE_IQ3_XXS:
|
|
2203
|
+
case GGML_TYPE_IQ3_S:
|
|
2204
|
+
defines.push_back(type_upper + "_GRID");
|
|
2205
|
+
defines.push_back(type_upper + "_TABLES");
|
|
2206
|
+
break;
|
|
2207
|
+
case GGML_TYPE_MXFP4:
|
|
2208
|
+
defines.push_back(type_upper + "_LUT");
|
|
2209
|
+
break;
|
|
2210
|
+
default:
|
|
2211
|
+
break;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
variant += std::string("_") + src0_name;
|
|
2215
|
+
break;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
// VEC/SCALAR controls
|
|
2220
|
+
defines.push_back(key.vectorized ? "VEC" : "SCALAR");
|
|
2221
|
+
|
|
2222
|
+
// mul_mat_id is register-tile only.
|
|
2223
|
+
const uint32_t tile_k =
|
|
2224
|
+
ggml_is_quantized(context.src0->type) ? WEBGPU_MUL_MAT_REG_TILE_K_QUANT : WEBGPU_MUL_MAT_REG_TILE_K_FLOAT;
|
|
2225
|
+
|
|
2226
|
+
// Tiles
|
|
2227
|
+
defines.push_back("TILE_M=" + std::to_string(WEBGPU_MUL_MAT_TILE_M) + "u");
|
|
2228
|
+
defines.push_back("TILE_N=" + std::to_string(WEBGPU_MUL_MAT_TILE_N) + "u");
|
|
2229
|
+
defines.push_back("TILE_K=" + std::to_string(tile_k) + "u");
|
|
2230
|
+
|
|
2231
|
+
defines.push_back("WORKGROUP_SIZE_M=" + std::to_string(WEBGPU_MUL_MAT_WG_SIZE_M) + "u");
|
|
2232
|
+
defines.push_back("WORKGROUP_SIZE_N=" + std::to_string(WEBGPU_MUL_MAT_WG_SIZE_N) + "u");
|
|
2233
|
+
|
|
2234
|
+
// variant suffix for src1 type
|
|
2235
|
+
variant += std::string("_") + (context.src1->type == GGML_TYPE_F32 ? "f32" : "f16");
|
|
2236
|
+
if (key.vectorized) {
|
|
2237
|
+
variant += "_vectorized";
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
auto processed = preprocessor.preprocess(wgsl_mul_mat_id, defines);
|
|
2241
|
+
|
|
2242
|
+
auto decisions = std::make_shared<ggml_webgpu_mul_mat_shader_decisions>();
|
|
2243
|
+
decisions->tile_k = tile_k;
|
|
2244
|
+
decisions->tile_m = WEBGPU_MUL_MAT_TILE_M;
|
|
2245
|
+
decisions->tile_n = WEBGPU_MUL_MAT_TILE_N;
|
|
2246
|
+
decisions->wg_size_m = WEBGPU_MUL_MAT_WG_SIZE_M;
|
|
2247
|
+
decisions->wg_size_n = WEBGPU_MUL_MAT_WG_SIZE_N;
|
|
2248
|
+
decisions->wg_size = WEBGPU_MUL_MAT_WG_SIZE_M * WEBGPU_MUL_MAT_WG_SIZE_N;
|
|
2249
|
+
|
|
2250
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2251
|
+
pipeline.context = decisions;
|
|
2252
|
+
mul_mat_id_pipelines[key] = pipeline;
|
|
2253
|
+
return mul_mat_id_pipelines[key];
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
webgpu_pipeline get_mul_mat_id_vec_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2257
|
+
ggml_webgpu_mul_mat_id_pipeline_key key = {};
|
|
2258
|
+
key.src0_type = context.src0->type;
|
|
2259
|
+
key.src1_type = context.src1->type;
|
|
2260
|
+
key.n_experts = context.src0->ne[2];
|
|
2261
|
+
key.vectorized = (context.src0->ne[0] % 4 == 0 &&
|
|
2262
|
+
(context.src0->type == GGML_TYPE_F32 || context.src0->type == GGML_TYPE_F16)) ?
|
|
2263
|
+
1 :
|
|
2264
|
+
0;
|
|
2265
|
+
|
|
2266
|
+
auto it = mul_mat_id_vec_pipelines.find(key);
|
|
2267
|
+
if (it != mul_mat_id_vec_pipelines.end()) {
|
|
2268
|
+
return it->second;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
std::vector<std::string> defines;
|
|
2272
|
+
std::string variant = "mul_mat_id_vec";
|
|
2273
|
+
const char * shader_src = wgsl_mul_mat_id_vec;
|
|
2274
|
+
|
|
2275
|
+
// src1 type
|
|
2276
|
+
switch (context.src1->type) {
|
|
2277
|
+
case GGML_TYPE_F32:
|
|
2278
|
+
defines.push_back("SRC1_INNER_TYPE=f32");
|
|
2279
|
+
break;
|
|
2280
|
+
case GGML_TYPE_F16:
|
|
2281
|
+
defines.push_back("SRC1_INNER_TYPE=f16");
|
|
2282
|
+
break;
|
|
2283
|
+
default:
|
|
2284
|
+
GGML_ABORT("Unsupported src1 type for mul_mat fast shader");
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
// src0 type
|
|
2288
|
+
switch (context.src0->type) {
|
|
2289
|
+
case GGML_TYPE_F32:
|
|
2290
|
+
defines.push_back("SRC0_INNER_TYPE=f32");
|
|
2291
|
+
defines.push_back("MUL_ACC_FLOAT");
|
|
2292
|
+
variant += "_f32";
|
|
2293
|
+
break;
|
|
2294
|
+
case GGML_TYPE_F16:
|
|
2295
|
+
defines.push_back("SRC0_INNER_TYPE=f16");
|
|
2296
|
+
defines.push_back("MUL_ACC_FLOAT");
|
|
2297
|
+
variant += "_f16";
|
|
2298
|
+
break;
|
|
2299
|
+
default:
|
|
2300
|
+
{
|
|
2301
|
+
// Quantized types: use helpers but accumulate in f16
|
|
2302
|
+
const struct ggml_type_traits * src0_traits = ggml_get_type_traits(context.src0->type);
|
|
2303
|
+
std::string src0_name = src0_traits->type_name;
|
|
2304
|
+
std::string type_upper = src0_name;
|
|
2305
|
+
variant += "_" + src0_name;
|
|
2306
|
+
std::transform(type_upper.begin(), type_upper.end(), type_upper.begin(), ::toupper);
|
|
2307
|
+
|
|
2308
|
+
defines.push_back("BYTE_HELPERS");
|
|
2309
|
+
defines.push_back("MUL_ACC_" + type_upper);
|
|
2310
|
+
defines.push_back("U32_DEQUANT_HELPERS");
|
|
2311
|
+
defines.push_back("SRC0_INNER_TYPE=u32");
|
|
2312
|
+
switch (context.src0->type) {
|
|
2313
|
+
case GGML_TYPE_IQ1_S:
|
|
2314
|
+
case GGML_TYPE_IQ1_M:
|
|
2315
|
+
case GGML_TYPE_IQ2_S:
|
|
2316
|
+
case GGML_TYPE_IQ3_S:
|
|
2317
|
+
case GGML_TYPE_IQ4_NL:
|
|
2318
|
+
case GGML_TYPE_IQ4_XS:
|
|
2319
|
+
defines.push_back(type_upper + "_GRID");
|
|
2320
|
+
break;
|
|
2321
|
+
case GGML_TYPE_IQ2_XXS:
|
|
2322
|
+
case GGML_TYPE_IQ2_XS:
|
|
2323
|
+
case GGML_TYPE_IQ3_XXS:
|
|
2324
|
+
defines.push_back(type_upper + "_GRID");
|
|
2325
|
+
defines.push_back(type_upper + "_TABLES");
|
|
2326
|
+
break;
|
|
2327
|
+
case GGML_TYPE_MXFP4:
|
|
2328
|
+
defines.push_back(type_upper + "_LUT");
|
|
2329
|
+
break;
|
|
2330
|
+
default:
|
|
2331
|
+
break;
|
|
2332
|
+
}
|
|
2333
|
+
break;
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
// VEC/SCALAR controls
|
|
2338
|
+
defines.push_back(key.vectorized ? "VEC" : "SCALAR");
|
|
2339
|
+
|
|
2340
|
+
uint32_t wg_size = WEBGPU_MUL_MAT_VEC_WG_SIZE;
|
|
2341
|
+
uint32_t outputs_per_wg = WEBGPU_MUL_MAT_VEC_FLOAT_OUTPUTS_PER_WG;
|
|
2342
|
+
|
|
2343
|
+
if (key.src0_type == GGML_TYPE_Q1_0) {
|
|
2344
|
+
outputs_per_wg = WEBGPU_MUL_MAT_VEC_LEGACY_Q_OUTPUTS_PER_WG;
|
|
2345
|
+
} else if (key.src0_type >= GGML_TYPE_Q2_K) {
|
|
2346
|
+
outputs_per_wg = WEBGPU_MUL_MAT_VEC_K_Q_OUTPUTS_PER_WG;
|
|
2347
|
+
} else if (key.src0_type >= GGML_TYPE_Q4_0) {
|
|
2348
|
+
outputs_per_wg = WEBGPU_MUL_MAT_VEC_LEGACY_Q_OUTPUTS_PER_WG;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
// variant suffix for src1 type
|
|
2352
|
+
variant += std::string("_") + (context.src1->type == GGML_TYPE_F32 ? "f32" : "f16");
|
|
2353
|
+
|
|
2354
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
2355
|
+
defines.push_back(std::string("OUTPUTS_PER_WG=") + std::to_string(outputs_per_wg));
|
|
2356
|
+
defines.push_back(context.supports_subgroups ? "USE_SUBGROUP_REDUCTION" : "USE_WORKGROUP_REDUCTION");
|
|
2357
|
+
variant += context.supports_subgroups ? "_sg_reduce" : "_wg_reduce";
|
|
2358
|
+
if (key.vectorized) {
|
|
2359
|
+
variant += "_vectorized";
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
defines.push_back(std::string("N_EXPERTS=") + std::to_string(key.n_experts));
|
|
2363
|
+
|
|
2364
|
+
auto processed = preprocessor.preprocess(shader_src, defines);
|
|
2365
|
+
|
|
2366
|
+
auto decisions = std::make_shared<ggml_webgpu_mul_mat_vec_shader_decisions>();
|
|
2367
|
+
decisions->wg_size = wg_size;
|
|
2368
|
+
decisions->outputs_per_wg = outputs_per_wg;
|
|
2369
|
+
|
|
2370
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2371
|
+
pipeline.context = decisions;
|
|
2372
|
+
mul_mat_id_vec_pipelines[key] = pipeline;
|
|
2373
|
+
return mul_mat_id_vec_pipelines[key];
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
webgpu_pipeline get_unary_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2377
|
+
const bool is_unary = context.dst->op == GGML_OP_UNARY;
|
|
2378
|
+
const int op = is_unary ? (int) ggml_get_unary_op(context.dst) : context.dst->op;
|
|
2379
|
+
ggml_webgpu_unary_pipeline_key key = {};
|
|
2380
|
+
key.type = context.dst->type;
|
|
2381
|
+
key.op = op;
|
|
2382
|
+
key.is_unary = is_unary;
|
|
2383
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst) || context.dst->op == GGML_OP_FILL;
|
|
2384
|
+
key.ttype = (ggml_tri_type) ggml_get_op_params_i32(context.dst, 0);
|
|
2385
|
+
|
|
2386
|
+
auto it = unary_pipelines.find(key);
|
|
2387
|
+
if (it != unary_pipelines.end()) {
|
|
2388
|
+
return it->second;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
std::vector<std::string> defines;
|
|
2392
|
+
std::string variant =
|
|
2393
|
+
key.is_unary ? ggml_unary_op_name((ggml_unary_op) key.op) : ggml_op_name((ggml_op) key.op);
|
|
2394
|
+
defines.push_back(variant);
|
|
2395
|
+
|
|
2396
|
+
switch (key.type) {
|
|
2397
|
+
case GGML_TYPE_F32:
|
|
2398
|
+
defines.push_back("TYPE_F32");
|
|
2399
|
+
variant += "_f32";
|
|
2400
|
+
break;
|
|
2401
|
+
case GGML_TYPE_F16:
|
|
2402
|
+
defines.push_back("TYPE_F16");
|
|
2403
|
+
variant += "_f16";
|
|
2404
|
+
break;
|
|
2405
|
+
default:
|
|
2406
|
+
GGML_ABORT("Unsupported type for unary shader");
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
if (key.inplace) {
|
|
2410
|
+
defines.push_back("INPLACE");
|
|
2411
|
+
variant += "_inplace";
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
if (op == GGML_OP_TRI) {
|
|
2415
|
+
switch (key.ttype) {
|
|
2416
|
+
case GGML_TRI_TYPE_LOWER:
|
|
2417
|
+
defines.push_back("TRI_TYPE_LOWER");
|
|
2418
|
+
variant += "_tri_type_lower";
|
|
2419
|
+
break;
|
|
2420
|
+
case GGML_TRI_TYPE_LOWER_DIAG:
|
|
2421
|
+
defines.push_back("TRI_TYPE_LOWER_DIAG");
|
|
2422
|
+
variant += "_tri_type_lower_diag";
|
|
2423
|
+
break;
|
|
2424
|
+
case GGML_TRI_TYPE_UPPER:
|
|
2425
|
+
defines.push_back("TRI_TYPE_UPPER");
|
|
2426
|
+
variant += "_tri_type_upper";
|
|
2427
|
+
break;
|
|
2428
|
+
case GGML_TRI_TYPE_UPPER_DIAG:
|
|
2429
|
+
defines.push_back("TRI_TYPE_UPPER_DIAG");
|
|
2430
|
+
variant += "_tri_upper_diag";
|
|
2431
|
+
break;
|
|
2432
|
+
default:
|
|
2433
|
+
GGML_ABORT("Unsupported ggml_tri_type for unary shader");
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2438
|
+
|
|
2439
|
+
auto processed = preprocessor.preprocess(wgsl_unary, defines);
|
|
2440
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2441
|
+
decisions->wg_size = context.max_wg_size;
|
|
2442
|
+
decisions->inplace = key.inplace;
|
|
2443
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2444
|
+
pipeline.context = decisions;
|
|
2445
|
+
unary_pipelines[key] = pipeline;
|
|
2446
|
+
return unary_pipelines[key];
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
webgpu_pipeline get_rms_norm_mul_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2450
|
+
ggml_webgpu_rms_norm_mul_pipeline_key key = {};
|
|
2451
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
2452
|
+
key.overlap = ggml_webgpu_tensor_equal(context.src1, context.dst);
|
|
2453
|
+
key.src_overlap = ggml_webgpu_tensor_overlap(context.src0, context.src1);
|
|
2454
|
+
|
|
2455
|
+
auto it = rms_norm_mul_pipelines.find(key);
|
|
2456
|
+
if (it != rms_norm_mul_pipelines.end()) {
|
|
2457
|
+
return it->second;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
std::vector<std::string> defines;
|
|
2461
|
+
std::string op_name = "RMS_NORM_MUL";
|
|
2462
|
+
std::string variant = op_name;
|
|
2463
|
+
|
|
2464
|
+
if (key.inplace) {
|
|
2465
|
+
defines.push_back("INPLACE");
|
|
2466
|
+
variant += "_inplace";
|
|
2467
|
+
} else if (key.overlap) {
|
|
2468
|
+
defines.push_back("OVERLAP");
|
|
2469
|
+
variant += "_overlap";
|
|
2470
|
+
} else if (key.src_overlap) {
|
|
2471
|
+
defines.push_back("SRC_OVERLAP");
|
|
2472
|
+
variant += "_src_overlap";
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2476
|
+
|
|
2477
|
+
auto processed = preprocessor.preprocess(wgsl_rms_norm_mul, defines);
|
|
2478
|
+
auto pipeline_decisions = std::make_shared<ggml_webgpu_rms_norm_mul_shader_decisions>();
|
|
2479
|
+
pipeline_decisions->wg_size = context.max_wg_size;
|
|
2480
|
+
pipeline_decisions->inplace = key.inplace;
|
|
2481
|
+
pipeline_decisions->overlap = key.overlap;
|
|
2482
|
+
pipeline_decisions->src_overlap = key.src_overlap;
|
|
2483
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2484
|
+
pipeline.context = pipeline_decisions;
|
|
2485
|
+
rms_norm_mul_pipelines[key] = pipeline;
|
|
2486
|
+
return rms_norm_mul_pipelines[key];
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
webgpu_pipeline get_binary_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2490
|
+
ggml_webgpu_binary_pipeline_key key = {};
|
|
2491
|
+
key.type = context.dst->type;
|
|
2492
|
+
key.op = context.dst->op;
|
|
2493
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
2494
|
+
key.overlap = ggml_webgpu_tensor_equal(context.src1, context.dst);
|
|
2495
|
+
key.src_overlap = ggml_webgpu_tensor_overlap(context.src0, context.src1);
|
|
2496
|
+
|
|
2497
|
+
auto it = binary_pipelines.find(key);
|
|
2498
|
+
if (it != binary_pipelines.end()) {
|
|
2499
|
+
return it->second;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
std::vector<std::string> defines;
|
|
2503
|
+
std::string op_name = ggml_op_name((ggml_op) key.op);
|
|
2504
|
+
std::string variant = op_name;
|
|
2505
|
+
|
|
2506
|
+
defines.push_back(std::string("OP_") + op_name);
|
|
2507
|
+
|
|
2508
|
+
switch (key.type) {
|
|
2509
|
+
case GGML_TYPE_F32:
|
|
2510
|
+
defines.push_back("TYPE_F32");
|
|
2511
|
+
variant += "_f32";
|
|
2512
|
+
break;
|
|
2513
|
+
case GGML_TYPE_F16:
|
|
2514
|
+
defines.push_back("TYPE_F16");
|
|
2515
|
+
variant += "_f16";
|
|
2516
|
+
break;
|
|
2517
|
+
default:
|
|
2518
|
+
GGML_ABORT("Unsupported type for binary shader");
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
if (key.inplace) {
|
|
2522
|
+
defines.push_back("INPLACE");
|
|
2523
|
+
variant += "_inplace";
|
|
2524
|
+
} else if (key.overlap) {
|
|
2525
|
+
defines.push_back("OVERLAP");
|
|
2526
|
+
variant += "_overlap";
|
|
2527
|
+
} else if (key.src_overlap) {
|
|
2528
|
+
defines.push_back("SRC_OVERLAP");
|
|
2529
|
+
variant += "_src_overlap";
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2533
|
+
|
|
2534
|
+
auto processed = preprocessor.preprocess(wgsl_binary, defines);
|
|
2535
|
+
auto pipeline_decisions = std::make_shared<ggml_webgpu_binary_shader_decisions>();
|
|
2536
|
+
pipeline_decisions->wg_size = context.max_wg_size;
|
|
2537
|
+
pipeline_decisions->inplace = key.inplace;
|
|
2538
|
+
pipeline_decisions->overlap = key.overlap;
|
|
2539
|
+
pipeline_decisions->src_overlap = key.src_overlap;
|
|
2540
|
+
|
|
2541
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2542
|
+
pipeline.context = pipeline_decisions;
|
|
2543
|
+
binary_pipelines[key] = pipeline;
|
|
2544
|
+
return binary_pipelines[key];
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
webgpu_pipeline get_add_id_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2548
|
+
ggml_webgpu_add_id_pipeline_key key = {};
|
|
2549
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
2550
|
+
|
|
2551
|
+
auto it = add_id_pipelines.find(key);
|
|
2552
|
+
if (it != add_id_pipelines.end()) {
|
|
2553
|
+
return it->second;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
std::vector<std::string> defines;
|
|
2557
|
+
std::string variant = "add_id";
|
|
2558
|
+
const char * shader_src = wgsl_add_id;
|
|
2559
|
+
|
|
2560
|
+
if (key.inplace) {
|
|
2561
|
+
defines.push_back("INPLACE");
|
|
2562
|
+
variant += "_inplace";
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2566
|
+
|
|
2567
|
+
auto processed = preprocessor.preprocess(shader_src, defines);
|
|
2568
|
+
auto pipeline_decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2569
|
+
pipeline_decisions->wg_size = context.max_wg_size;
|
|
2570
|
+
pipeline_decisions->inplace = key.inplace;
|
|
2571
|
+
|
|
2572
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2573
|
+
pipeline.context = pipeline_decisions;
|
|
2574
|
+
add_id_pipelines[key] = pipeline;
|
|
2575
|
+
return pipeline;
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
webgpu_pipeline get_concat_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2579
|
+
ggml_webgpu_concat_pipeline_key key = {};
|
|
2580
|
+
key.type = context.dst->type;
|
|
2581
|
+
|
|
2582
|
+
auto it = concat_pipelines.find(key);
|
|
2583
|
+
if (it != concat_pipelines.end()) {
|
|
2584
|
+
return it->second;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
std::vector<std::string> defines;
|
|
2588
|
+
std::string variant = "concat";
|
|
2589
|
+
|
|
2590
|
+
switch (key.type) {
|
|
2591
|
+
case GGML_TYPE_F32:
|
|
2592
|
+
defines.push_back("TYPE_F32");
|
|
2593
|
+
variant += "_f32";
|
|
2594
|
+
break;
|
|
2595
|
+
case GGML_TYPE_I32:
|
|
2596
|
+
defines.push_back("TYPE_I32");
|
|
2597
|
+
variant += "_i32";
|
|
2598
|
+
break;
|
|
2599
|
+
default:
|
|
2600
|
+
GGML_ABORT("Unsupported type for concat shader");
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2604
|
+
|
|
2605
|
+
auto processed = preprocessor.preprocess(wgsl_concat, defines);
|
|
2606
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2607
|
+
decisions->wg_size = context.max_wg_size;
|
|
2608
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2609
|
+
pipeline.context = decisions;
|
|
2610
|
+
concat_pipelines[key] = pipeline;
|
|
2611
|
+
return concat_pipelines[key];
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
webgpu_pipeline get_repeat_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2615
|
+
ggml_webgpu_repeat_pipeline_key key = {};
|
|
2616
|
+
key.type = context.dst->type;
|
|
2617
|
+
|
|
2618
|
+
auto it = repeat_pipelines.find(key);
|
|
2619
|
+
if (it != repeat_pipelines.end()) {
|
|
2620
|
+
return it->second;
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
std::vector<std::string> defines;
|
|
2624
|
+
std::string variant = "repeat";
|
|
2625
|
+
|
|
2626
|
+
switch (key.type) {
|
|
2627
|
+
case GGML_TYPE_F32:
|
|
2628
|
+
defines.push_back("TYPE_F32");
|
|
2629
|
+
variant += "_f32";
|
|
2630
|
+
break;
|
|
2631
|
+
case GGML_TYPE_I32:
|
|
2632
|
+
defines.push_back("TYPE_I32");
|
|
2633
|
+
variant += "_i32";
|
|
2634
|
+
break;
|
|
2635
|
+
case GGML_TYPE_I16:
|
|
2636
|
+
defines.push_back("TYPE_I16");
|
|
2637
|
+
variant += "_i16";
|
|
2638
|
+
break;
|
|
2639
|
+
default:
|
|
2640
|
+
GGML_ABORT("Unsupported type for repeat shader");
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2644
|
+
|
|
2645
|
+
auto processed = preprocessor.preprocess(wgsl_repeat, defines);
|
|
2646
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2647
|
+
decisions->wg_size = context.max_wg_size;
|
|
2648
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2649
|
+
pipeline.context = decisions;
|
|
2650
|
+
repeat_pipelines[key] = pipeline;
|
|
2651
|
+
return repeat_pipelines[key];
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
webgpu_pipeline get_flash_attn_pipeline(const ggml_webgpu_shader_lib_context & context,
|
|
2655
|
+
size_t storage_offset_alignment) {
|
|
2656
|
+
const ggml_webgpu_flash_attn_decisions decisions =
|
|
2657
|
+
ggml_webgpu_flash_attn_get_decisions(context, storage_offset_alignment);
|
|
2658
|
+
GGML_ASSERT(decisions.path != GGML_WEBGPU_FLASH_ATTN_PATH_NONE);
|
|
2659
|
+
ggml_webgpu_flash_attn_pipeline_key key = ggml_webgpu_flash_attn_make_pipeline_key(context, decisions);
|
|
2660
|
+
auto it = flash_attn_pipelines.find(key);
|
|
2661
|
+
if (it != flash_attn_pipelines.end()) {
|
|
2662
|
+
return it->second;
|
|
2663
|
+
}
|
|
2664
|
+
std::vector<std::string> defines;
|
|
2665
|
+
std::string variant = decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_VEC ? "flash_attn_vec" :
|
|
2666
|
+
decisions.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE ? "flash_attn_tile" :
|
|
2667
|
+
"flash_attn";
|
|
2668
|
+
|
|
2669
|
+
switch (key.kv_type) {
|
|
2670
|
+
case GGML_TYPE_F32:
|
|
2671
|
+
defines.push_back("KV_F32");
|
|
2672
|
+
break;
|
|
2673
|
+
case GGML_TYPE_F16:
|
|
2674
|
+
defines.push_back("KV_F16");
|
|
2675
|
+
break;
|
|
2676
|
+
case GGML_TYPE_Q4_0:
|
|
2677
|
+
defines.push_back("KV_Q4_0");
|
|
2678
|
+
break;
|
|
2679
|
+
case GGML_TYPE_Q8_0:
|
|
2680
|
+
defines.push_back("KV_Q8_0");
|
|
2681
|
+
break;
|
|
2682
|
+
default:
|
|
2683
|
+
GGML_ABORT("Unsupported KV type for flash attention shader");
|
|
2684
|
+
}
|
|
2685
|
+
variant += std::string("_") + ggml_type_name(key.kv_type);
|
|
2686
|
+
|
|
2687
|
+
switch (key.q_type) {
|
|
2688
|
+
case GGML_TYPE_F32:
|
|
2689
|
+
defines.push_back("Q_F32");
|
|
2690
|
+
break;
|
|
2691
|
+
case GGML_TYPE_F16:
|
|
2692
|
+
defines.push_back("Q_F16");
|
|
2693
|
+
break;
|
|
2694
|
+
default:
|
|
2695
|
+
GGML_ABORT("Unsupported Q type for flash attention shader");
|
|
2696
|
+
}
|
|
2697
|
+
variant += std::string("_q") + ggml_type_name(key.q_type);
|
|
2698
|
+
|
|
2699
|
+
switch (key.dst_type) {
|
|
2700
|
+
case GGML_TYPE_F32:
|
|
2701
|
+
defines.push_back("DST_F32");
|
|
2702
|
+
break;
|
|
2703
|
+
case GGML_TYPE_F16:
|
|
2704
|
+
defines.push_back("DST_F16");
|
|
2705
|
+
break;
|
|
2706
|
+
default:
|
|
2707
|
+
GGML_ABORT("Unsupported dst type for flash attention shader");
|
|
2708
|
+
}
|
|
2709
|
+
variant += std::string("_dst") + ggml_type_name(key.dst_type);
|
|
2710
|
+
|
|
2711
|
+
if (key.has_mask) {
|
|
2712
|
+
defines.push_back("MASK");
|
|
2713
|
+
if (key.path == GGML_WEBGPU_FLASH_ATTN_PATH_VEC) {
|
|
2714
|
+
defines.push_back("BLK");
|
|
2715
|
+
variant += "_mask_blk";
|
|
2716
|
+
} else {
|
|
2717
|
+
variant += "_mask";
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
if (key.has_sinks) {
|
|
2721
|
+
defines.push_back("SINKS");
|
|
2722
|
+
variant += "_sinks";
|
|
2723
|
+
}
|
|
2724
|
+
if (key.uses_logit_softcap) {
|
|
2725
|
+
defines.push_back("LOGIT_SOFTCAP");
|
|
2726
|
+
variant += "_lgsc";
|
|
2727
|
+
}
|
|
2728
|
+
if (key.kv_direct) {
|
|
2729
|
+
defines.push_back("KV_DIRECT");
|
|
2730
|
+
variant += "_kvdirect";
|
|
2731
|
+
}
|
|
2732
|
+
if (key.kv_overlap) {
|
|
2733
|
+
defines.push_back("KV_OVERLAP");
|
|
2734
|
+
variant += "_kv_overlap";
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
defines.push_back(std::string("HEAD_DIM_QK=") + std::to_string(key.head_dim_qk));
|
|
2738
|
+
variant += std::string("_hsqk") + std::to_string(key.head_dim_qk);
|
|
2739
|
+
|
|
2740
|
+
defines.push_back(std::string("HEAD_DIM_V=") + std::to_string(key.head_dim_v));
|
|
2741
|
+
variant += std::string("_hsv") + std::to_string(key.head_dim_v);
|
|
2742
|
+
|
|
2743
|
+
const char * shader_src = wgsl_flash_attn;
|
|
2744
|
+
if (key.path == GGML_WEBGPU_FLASH_ATTN_PATH_VEC) {
|
|
2745
|
+
defines.push_back("KV_GRANULARITY=8");
|
|
2746
|
+
defines.push_back(std::string("VEC_NE=") + std::to_string(ggml_webgpu_flash_attn_pick_vec_ne(key)) + "u");
|
|
2747
|
+
shader_src = wgsl_flash_attn_vec_split;
|
|
2748
|
+
} else if (key.path == GGML_WEBGPU_FLASH_ATTN_PATH_TILE) {
|
|
2749
|
+
shader_src = wgsl_flash_attn_tile;
|
|
2750
|
+
defines.push_back("MIN_SUBGROUP_SIZE=" + std::to_string(context.min_subgroup_size) + "u");
|
|
2751
|
+
defines.push_back("MAX_SUBGROUP_SIZE=" + std::to_string(context.max_subgroup_size) + "u");
|
|
2752
|
+
defines.push_back("KV_STAGE_STRIDE=" + std::to_string(std::max(key.head_dim_qk, key.head_dim_v)));
|
|
2753
|
+
variant += "_tile_sg" + std::to_string(context.min_subgroup_size) + "_" +
|
|
2754
|
+
std::to_string(context.max_subgroup_size);
|
|
2755
|
+
} else {
|
|
2756
|
+
defines.push_back(std::string("SG_MAT_M=") + std::to_string(context.sg_mat_m));
|
|
2757
|
+
defines.push_back(std::string("SG_MAT_N=") + std::to_string(context.sg_mat_n));
|
|
2758
|
+
defines.push_back(std::string("SG_MAT_K=") + std::to_string(context.sg_mat_k));
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
auto pipeline_decisions = std::make_shared<ggml_webgpu_flash_attn_decisions>(decisions);
|
|
2762
|
+
pipeline_decisions->kv_overlap = key.kv_overlap;
|
|
2763
|
+
defines.push_back(std::string("Q_TILE=") + std::to_string(decisions.q_tile));
|
|
2764
|
+
defines.push_back(std::string("KV_TILE=") + std::to_string(decisions.kv_tile));
|
|
2765
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(decisions.wg_size));
|
|
2766
|
+
|
|
2767
|
+
webgpu_pipeline pipeline =
|
|
2768
|
+
ggml_webgpu_create_pipeline(device, preprocessor.preprocess(shader_src, defines), variant);
|
|
2769
|
+
pipeline.context = pipeline_decisions;
|
|
2770
|
+
flash_attn_pipelines[key] = pipeline;
|
|
2771
|
+
return flash_attn_pipelines[key];
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
webgpu_pipeline get_flash_attn_blk_pipeline(const ggml_webgpu_shader_lib_context & context, uint32_t kv_tile) {
|
|
2775
|
+
ggml_webgpu_flash_attn_blk_pipeline_key key = {};
|
|
2776
|
+
key.kv_tile = kv_tile;
|
|
2777
|
+
auto it = flash_attn_blk_pipelines.find(key);
|
|
2778
|
+
if (it != flash_attn_blk_pipelines.end()) {
|
|
2779
|
+
return it->second;
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
std::vector<std::string> defines;
|
|
2783
|
+
std::string variant = "flash_attn_vec_blk";
|
|
2784
|
+
|
|
2785
|
+
defines.push_back(std::string("KV_TILE=") + std::to_string(key.kv_tile));
|
|
2786
|
+
variant += std::string("_kvt") + std::to_string(key.kv_tile);
|
|
2787
|
+
|
|
2788
|
+
uint32_t wg_size = 1;
|
|
2789
|
+
while ((wg_size << 1) <= context.max_wg_size) {
|
|
2790
|
+
wg_size <<= 1;
|
|
2791
|
+
}
|
|
2792
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size));
|
|
2793
|
+
variant += std::string("_wg") + std::to_string(wg_size);
|
|
2794
|
+
|
|
2795
|
+
webgpu_pipeline pipeline =
|
|
2796
|
+
ggml_webgpu_create_pipeline(device, preprocessor.preprocess(wgsl_flash_attn_vec_blk, defines), variant);
|
|
2797
|
+
flash_attn_blk_pipelines[key] = pipeline;
|
|
2798
|
+
return flash_attn_blk_pipelines[key];
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
webgpu_pipeline get_flash_attn_vec_reduce_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2802
|
+
ggml_webgpu_flash_attn_vec_reduce_pipeline_key key = {};
|
|
2803
|
+
key.head_dim_v = (uint32_t) context.src2->ne[0];
|
|
2804
|
+
key.dst_type = context.dst->type;
|
|
2805
|
+
key.wg_size = context.max_wg_size;
|
|
2806
|
+
auto it = flash_attn_vec_reduce_pipelines.find(key);
|
|
2807
|
+
if (it != flash_attn_vec_reduce_pipelines.end()) {
|
|
2808
|
+
return it->second;
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
std::vector<std::string> defines;
|
|
2812
|
+
std::string variant = "flash_attn_vec_reduce";
|
|
2813
|
+
|
|
2814
|
+
switch (key.dst_type) {
|
|
2815
|
+
case GGML_TYPE_F32:
|
|
2816
|
+
defines.push_back("DST_F32");
|
|
2817
|
+
break;
|
|
2818
|
+
case GGML_TYPE_F16:
|
|
2819
|
+
defines.push_back("DST_F16");
|
|
2820
|
+
break;
|
|
2821
|
+
default:
|
|
2822
|
+
GGML_ABORT("Unsupported dst type for flash attention vec reduce shader");
|
|
2823
|
+
}
|
|
2824
|
+
variant += std::string("_dst") + ggml_type_name(key.dst_type);
|
|
2825
|
+
|
|
2826
|
+
defines.push_back(std::string("HEAD_DIM_V=") + std::to_string(key.head_dim_v));
|
|
2827
|
+
variant += std::string("_hsv") + std::to_string(key.head_dim_v);
|
|
2828
|
+
|
|
2829
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2830
|
+
variant += std::string("_wg") + std::to_string(context.max_wg_size);
|
|
2831
|
+
|
|
2832
|
+
webgpu_pipeline pipeline =
|
|
2833
|
+
ggml_webgpu_create_pipeline(device, preprocessor.preprocess(wgsl_flash_attn_vec_reduce, defines), variant);
|
|
2834
|
+
flash_attn_vec_reduce_pipelines[key] = pipeline;
|
|
2835
|
+
return flash_attn_vec_reduce_pipelines[key];
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
webgpu_pipeline get_cpy_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2839
|
+
ggml_webgpu_cpy_pipeline_key key = {};
|
|
2840
|
+
key.src_type = context.src0->type;
|
|
2841
|
+
key.dst_type = context.dst->type;
|
|
2842
|
+
|
|
2843
|
+
auto it = cpy_pipelines.find(key);
|
|
2844
|
+
if (it != cpy_pipelines.end()) {
|
|
2845
|
+
return it->second;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
std::vector<std::string> defines;
|
|
2849
|
+
std::string variant = "cpy";
|
|
2850
|
+
|
|
2851
|
+
switch (key.src_type) {
|
|
2852
|
+
case GGML_TYPE_F32:
|
|
2853
|
+
defines.push_back("SRC_F32");
|
|
2854
|
+
variant += "_f32";
|
|
2855
|
+
break;
|
|
2856
|
+
case GGML_TYPE_F16:
|
|
2857
|
+
defines.push_back("SRC_F16");
|
|
2858
|
+
variant += "_f16";
|
|
2859
|
+
break;
|
|
2860
|
+
default:
|
|
2861
|
+
GGML_ABORT("Unsupported src type for cpy shader");
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
switch (key.dst_type) {
|
|
2865
|
+
case GGML_TYPE_F32:
|
|
2866
|
+
defines.push_back("DST_F32");
|
|
2867
|
+
variant += "_f32";
|
|
2868
|
+
break;
|
|
2869
|
+
case GGML_TYPE_F16:
|
|
2870
|
+
defines.push_back("DST_F16");
|
|
2871
|
+
variant += "_f16";
|
|
2872
|
+
break;
|
|
2873
|
+
case GGML_TYPE_I32:
|
|
2874
|
+
defines.push_back("DST_I32");
|
|
2875
|
+
variant += "_i32";
|
|
2876
|
+
break;
|
|
2877
|
+
default:
|
|
2878
|
+
GGML_ABORT("Unsupported dst type for cpy shader");
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2882
|
+
|
|
2883
|
+
auto processed = preprocessor.preprocess(wgsl_cpy, defines);
|
|
2884
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2885
|
+
decisions->wg_size = context.max_wg_size;
|
|
2886
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2887
|
+
pipeline.context = decisions;
|
|
2888
|
+
cpy_pipelines[key] = pipeline;
|
|
2889
|
+
return cpy_pipelines[key];
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
webgpu_pipeline get_glu_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2893
|
+
ggml_webgpu_glu_pipeline_key key = {};
|
|
2894
|
+
key.glu_op = ggml_get_glu_op(context.dst);
|
|
2895
|
+
key.type = context.dst->type;
|
|
2896
|
+
key.split = (context.src1 != nullptr);
|
|
2897
|
+
|
|
2898
|
+
auto it = glu_pipelines.find(key);
|
|
2899
|
+
if (it != glu_pipelines.end()) {
|
|
2900
|
+
return it->second;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
std::vector<std::string> defines;
|
|
2904
|
+
std::string variant = "glu";
|
|
2905
|
+
|
|
2906
|
+
switch (key.glu_op) {
|
|
2907
|
+
case GGML_GLU_OP_REGLU:
|
|
2908
|
+
defines.push_back("OP_REGLU");
|
|
2909
|
+
variant += "_reglu";
|
|
2910
|
+
break;
|
|
2911
|
+
case GGML_GLU_OP_GEGLU:
|
|
2912
|
+
defines.push_back("OP_GEGLU");
|
|
2913
|
+
variant += "_geglu";
|
|
2914
|
+
break;
|
|
2915
|
+
case GGML_GLU_OP_SWIGLU:
|
|
2916
|
+
defines.push_back("OP_SWIGLU");
|
|
2917
|
+
variant += "_swiglu";
|
|
2918
|
+
break;
|
|
2919
|
+
case GGML_GLU_OP_SWIGLU_OAI:
|
|
2920
|
+
defines.push_back("OP_SWIGLU_OAI");
|
|
2921
|
+
variant += "_swiglu_oai";
|
|
2922
|
+
break;
|
|
2923
|
+
case GGML_GLU_OP_GEGLU_ERF:
|
|
2924
|
+
defines.push_back("OP_GEGLU_ERF");
|
|
2925
|
+
variant += "_geglu_erf";
|
|
2926
|
+
break;
|
|
2927
|
+
case GGML_GLU_OP_GEGLU_QUICK:
|
|
2928
|
+
defines.push_back("OP_GEGLU_QUICK");
|
|
2929
|
+
variant += "_geglu_quick";
|
|
2930
|
+
break;
|
|
2931
|
+
default:
|
|
2932
|
+
GGML_ABORT("Unsupported GLU op");
|
|
2933
|
+
}
|
|
2934
|
+
switch (key.type) {
|
|
2935
|
+
case GGML_TYPE_F32:
|
|
2936
|
+
defines.push_back("TYPE_F32");
|
|
2937
|
+
variant += "_f32";
|
|
2938
|
+
break;
|
|
2939
|
+
case GGML_TYPE_F16:
|
|
2940
|
+
defines.push_back("TYPE_F16");
|
|
2941
|
+
variant += "_f16";
|
|
2942
|
+
break;
|
|
2943
|
+
default:
|
|
2944
|
+
GGML_ABORT("Unsupported type for GLU shader");
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
if (key.split) {
|
|
2948
|
+
variant += "_split";
|
|
2949
|
+
} else {
|
|
2950
|
+
defines.push_back("NO_SPLIT");
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
2954
|
+
|
|
2955
|
+
auto processed = preprocessor.preprocess(wgsl_glu, defines);
|
|
2956
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
2957
|
+
decisions->wg_size = context.max_wg_size;
|
|
2958
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
2959
|
+
pipeline.context = decisions;
|
|
2960
|
+
glu_pipelines[key] = pipeline;
|
|
2961
|
+
return glu_pipelines[key];
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
webgpu_pipeline get_rope_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
2965
|
+
ggml_webgpu_rope_pipeline_key key = {};
|
|
2966
|
+
key.type = context.dst->type;
|
|
2967
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
2968
|
+
key.has_ff = (context.src2 != nullptr);
|
|
2969
|
+
|
|
2970
|
+
auto it = rope_pipelines.find(key);
|
|
2971
|
+
if (it != rope_pipelines.end()) {
|
|
2972
|
+
return it->second;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
std::vector<std::string> defines;
|
|
2976
|
+
std::string variant = "rope";
|
|
2977
|
+
|
|
2978
|
+
switch (key.type) {
|
|
2979
|
+
case GGML_TYPE_F32:
|
|
2980
|
+
defines.push_back("TYPE_F32");
|
|
2981
|
+
variant += "_f32";
|
|
2982
|
+
break;
|
|
2983
|
+
case GGML_TYPE_F16:
|
|
2984
|
+
defines.push_back("TYPE_F16");
|
|
2985
|
+
variant += "_f16";
|
|
2986
|
+
break;
|
|
2987
|
+
default:
|
|
2988
|
+
GGML_ABORT("Unsupported type for ROPE shader");
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
if (key.inplace) {
|
|
2992
|
+
defines.push_back("INPLACE");
|
|
2993
|
+
variant += "_inplace";
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
if (key.has_ff) {
|
|
2997
|
+
defines.push_back("FF_FUNC");
|
|
2998
|
+
variant += "_ff";
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
3002
|
+
|
|
3003
|
+
auto processed = preprocessor.preprocess(wgsl_rope, defines);
|
|
3004
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
3005
|
+
decisions->wg_size = context.max_wg_size;
|
|
3006
|
+
decisions->inplace = key.inplace;
|
|
3007
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
3008
|
+
pipeline.context = decisions;
|
|
3009
|
+
rope_pipelines[key] = pipeline;
|
|
3010
|
+
return rope_pipelines[key];
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
webgpu_pipeline get_soft_max_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
3014
|
+
ggml_webgpu_soft_max_pipeline_key key = {};
|
|
3015
|
+
key.mask_type = context.src1 ? context.src1->type : GGML_TYPE_F32;
|
|
3016
|
+
key.has_mask = (context.src1 != nullptr);
|
|
3017
|
+
key.has_sink = (context.src2 != nullptr);
|
|
3018
|
+
key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst);
|
|
3019
|
+
|
|
3020
|
+
auto it = soft_max_pipelines.find(key);
|
|
3021
|
+
if (it != soft_max_pipelines.end()) {
|
|
3022
|
+
return it->second;
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
std::vector<std::string> defines;
|
|
3026
|
+
std::string variant = "soft_max";
|
|
3027
|
+
|
|
3028
|
+
if (key.has_mask) {
|
|
3029
|
+
defines.push_back("HAS_MASK");
|
|
3030
|
+
switch (key.mask_type) {
|
|
3031
|
+
case GGML_TYPE_F32:
|
|
3032
|
+
defines.push_back("MASK_F32");
|
|
3033
|
+
variant += "_mask_f32";
|
|
3034
|
+
break;
|
|
3035
|
+
case GGML_TYPE_F16:
|
|
3036
|
+
defines.push_back("MASK_F16");
|
|
3037
|
+
variant += "_mask_f16";
|
|
3038
|
+
break;
|
|
3039
|
+
default:
|
|
3040
|
+
GGML_ABORT("Unsupported type for SOFT_MAX shader");
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
if (key.has_sink) {
|
|
3045
|
+
defines.push_back("HAS_SINK");
|
|
3046
|
+
variant += "_sink";
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
if (key.inplace) {
|
|
3050
|
+
defines.push_back("INPLACE");
|
|
3051
|
+
variant += "_inplace";
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
3055
|
+
|
|
3056
|
+
auto processed = preprocessor.preprocess(wgsl_soft_max, defines);
|
|
3057
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
3058
|
+
decisions->wg_size = context.max_wg_size;
|
|
3059
|
+
decisions->inplace = key.inplace;
|
|
3060
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
3061
|
+
pipeline.context = decisions;
|
|
3062
|
+
soft_max_pipelines[key] = pipeline;
|
|
3063
|
+
return soft_max_pipelines[key];
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
webgpu_pipeline get_conv2d_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
3067
|
+
ggml_webgpu_conv2d_pipeline_key key = {};
|
|
3068
|
+
key.weight_type = context.src0->type;
|
|
3069
|
+
key.input_type = context.src1->type;
|
|
3070
|
+
key.output_type = context.dst->type;
|
|
3071
|
+
|
|
3072
|
+
auto it = conv2d_pipelines.find(key);
|
|
3073
|
+
if (it != conv2d_pipelines.end()) {
|
|
3074
|
+
return it->second;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
std::vector<std::string> defines;
|
|
3078
|
+
std::string variant = "conv_2d";
|
|
3079
|
+
|
|
3080
|
+
auto push_type_defines = [&](const char * prefix, ggml_type type) {
|
|
3081
|
+
std::string s_prefix = prefix;
|
|
3082
|
+
if (type == GGML_TYPE_F32) {
|
|
3083
|
+
defines.push_back(s_prefix + "_F32");
|
|
3084
|
+
} else if (type == GGML_TYPE_F16) {
|
|
3085
|
+
defines.push_back(s_prefix + "_F16");
|
|
3086
|
+
} else {
|
|
3087
|
+
GGML_ABORT("Unsupported type for CONV_2D shader");
|
|
3088
|
+
}
|
|
3089
|
+
};
|
|
3090
|
+
|
|
3091
|
+
push_type_defines("WEIGHT", key.weight_type);
|
|
3092
|
+
push_type_defines("INPUT", key.input_type);
|
|
3093
|
+
push_type_defines("OUTPUT", key.output_type);
|
|
3094
|
+
|
|
3095
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
3096
|
+
|
|
3097
|
+
auto processed = preprocessor.preprocess(wgsl_conv2d, defines);
|
|
3098
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
3099
|
+
decisions->wg_size = context.max_wg_size;
|
|
3100
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
3101
|
+
pipeline.context = decisions;
|
|
3102
|
+
conv2d_pipelines[key] = pipeline;
|
|
3103
|
+
return conv2d_pipelines[key];
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
webgpu_pipeline get_im2col_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
3107
|
+
ggml_webgpu_im2col_pipeline_key key = {};
|
|
3108
|
+
key.input_type = context.src1->type;
|
|
3109
|
+
key.output_type = context.dst->type;
|
|
3110
|
+
|
|
3111
|
+
auto it = im2col_pipelines.find(key);
|
|
3112
|
+
if (it != im2col_pipelines.end()) {
|
|
3113
|
+
return it->second;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
std::vector<std::string> defines;
|
|
3117
|
+
std::string variant = "im2col";
|
|
3118
|
+
|
|
3119
|
+
auto push_type_defines = [&](const char * prefix, ggml_type type) {
|
|
3120
|
+
std::string s_prefix = prefix;
|
|
3121
|
+
if (type == GGML_TYPE_F32) {
|
|
3122
|
+
defines.push_back(s_prefix + "_F32");
|
|
3123
|
+
} else if (type == GGML_TYPE_F16) {
|
|
3124
|
+
defines.push_back(s_prefix + "_F16");
|
|
3125
|
+
} else {
|
|
3126
|
+
GGML_ABORT("Unsupported type for IM2COL shader");
|
|
3127
|
+
}
|
|
3128
|
+
};
|
|
3129
|
+
|
|
3130
|
+
push_type_defines("INPUT", key.input_type);
|
|
3131
|
+
push_type_defines("OUTPUT", key.output_type);
|
|
3132
|
+
|
|
3133
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
3134
|
+
|
|
3135
|
+
auto processed = preprocessor.preprocess(wgsl_im2col, defines);
|
|
3136
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
3137
|
+
decisions->wg_size = context.max_wg_size;
|
|
3138
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
3139
|
+
pipeline.context = decisions;
|
|
3140
|
+
im2col_pipelines[key] = pipeline;
|
|
3141
|
+
return im2col_pipelines[key];
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
webgpu_pipeline get_upscale_pipeline(const ggml_webgpu_shader_lib_context & context) {
|
|
3145
|
+
const uint32_t mode_flags = (uint32_t) ggml_get_op_params_i32(context.dst, 0);
|
|
3146
|
+
const uint32_t base_mode = mode_flags & 0xFFu;
|
|
3147
|
+
const bool antialias = (mode_flags & GGML_SCALE_FLAG_ANTIALIAS) != 0u;
|
|
3148
|
+
|
|
3149
|
+
ggml_webgpu_upscale_pipeline_key key = {};
|
|
3150
|
+
key.input_type = context.src0->type;
|
|
3151
|
+
key.output_type = context.dst->type;
|
|
3152
|
+
key.base_mode = base_mode;
|
|
3153
|
+
key.antialias = antialias;
|
|
3154
|
+
|
|
3155
|
+
auto it = upscale_pipelines.find(key);
|
|
3156
|
+
if (it != upscale_pipelines.end()) {
|
|
3157
|
+
return it->second;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
std::vector<std::string> defines;
|
|
3161
|
+
std::string variant = "upscale";
|
|
3162
|
+
|
|
3163
|
+
if (key.input_type == GGML_TYPE_F16) {
|
|
3164
|
+
defines.push_back("SRC_F16");
|
|
3165
|
+
variant += "_src_f16";
|
|
3166
|
+
} else {
|
|
3167
|
+
variant += "_src_f32";
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
if (key.output_type == GGML_TYPE_F16) {
|
|
3171
|
+
defines.push_back("DST_F16");
|
|
3172
|
+
variant += "_dst_f16";
|
|
3173
|
+
} else {
|
|
3174
|
+
variant += "_dst_f32";
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
switch (base_mode) {
|
|
3178
|
+
case GGML_SCALE_MODE_NEAREST:
|
|
3179
|
+
defines.push_back("NEAREST");
|
|
3180
|
+
variant += "_nearest";
|
|
3181
|
+
break;
|
|
3182
|
+
case GGML_SCALE_MODE_BILINEAR:
|
|
3183
|
+
defines.push_back("BILINEAR");
|
|
3184
|
+
variant += "_bilinear";
|
|
3185
|
+
break;
|
|
3186
|
+
case GGML_SCALE_MODE_BICUBIC:
|
|
3187
|
+
defines.push_back("BICUBIC");
|
|
3188
|
+
variant += "_bicubic";
|
|
3189
|
+
break;
|
|
3190
|
+
default:
|
|
3191
|
+
GGML_ABORT("Unsupported upscale mode");
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
if (antialias) {
|
|
3195
|
+
defines.push_back("ANTIALIAS");
|
|
3196
|
+
variant += "_aa";
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
defines.push_back(std::string("WG_SIZE=") + std::to_string(context.max_wg_size));
|
|
3200
|
+
|
|
3201
|
+
auto processed = preprocessor.preprocess(wgsl_upscale, defines);
|
|
3202
|
+
auto decisions = std::make_shared<ggml_webgpu_generic_shader_decisions>();
|
|
3203
|
+
decisions->wg_size = context.max_wg_size;
|
|
3204
|
+
webgpu_pipeline pipeline = ggml_webgpu_create_pipeline(device, processed, variant);
|
|
3205
|
+
pipeline.context = decisions;
|
|
3206
|
+
upscale_pipelines[key] = pipeline;
|
|
3207
|
+
return upscale_pipelines[key];
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
private:
|
|
3211
|
+
static webgpu_pipeline ggml_webgpu_create_pipeline(wgpu::Device & device,
|
|
3212
|
+
std::string shader_code,
|
|
3213
|
+
std::string label) {
|
|
3214
|
+
wgpu::ShaderSourceWGSL shader_source;
|
|
3215
|
+
shader_source.code = shader_code.c_str();
|
|
3216
|
+
|
|
3217
|
+
wgpu::ShaderModuleDescriptor shader_desc;
|
|
3218
|
+
shader_desc.nextInChain = &shader_source;
|
|
3219
|
+
|
|
3220
|
+
wgpu::ShaderModule shader_module = device.CreateShaderModule(&shader_desc);
|
|
3221
|
+
|
|
3222
|
+
wgpu::ComputePipelineDescriptor pipeline_desc;
|
|
3223
|
+
pipeline_desc.label = label.c_str();
|
|
3224
|
+
pipeline_desc.compute.module = shader_module;
|
|
3225
|
+
pipeline_desc.compute.entryPoint = "main"; // Entry point in the WGSL code
|
|
3226
|
+
pipeline_desc.layout = nullptr; // nullptr means auto layout
|
|
3227
|
+
return { device.CreateComputePipeline(&pipeline_desc), label };
|
|
3228
|
+
}
|
|
3229
|
+
};
|
|
3230
|
+
|
|
3231
|
+
#endif // GGML_WEBGPU_SHADER_LIB_HPP
|